Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.faces.component;
import java.util.Map;
import com.sun.faces.application.MethodBindingMethodExpressionAdapter;
import jakarta.el.MethodExpression;
import jakarta.faces.FacesException;
import jakarta.faces.application.NavigationHandler;
import jakarta.faces.context.FacesContext;
import jakarta.faces.context.FacesContextWrapper;
import jakarta.faces.el.MethodBinding;
import jakarta.faces.event.AbortProcessingException;
import jakarta.faces.event.ActionEvent;
import jakarta.faces.event.ActionListener;
import jakarta.faces.event.FacesEvent;
import jakarta.faces.event.PhaseId;
import jakarta.faces.event.PreRenderViewEvent;
import jakarta.faces.view.ViewMetadata;
/**
*
*
* UIViewAction represents a method invocation that occurs during the
* request processing lifecycle, usually in response to an initial request, as opposed to a postback.
*
*
*
*
*
* The {@link jakarta.faces.view.ViewDeclarationLanguage} implementation must cause an instance of this component to be
* placed in the view for each occurrence of an <f:viewAction
* /> element placed inside of an <f:metadata
* /> element. The user must place <f:metadata
* /> as a direct child of the UIViewRoot.
*
*
*
* Because this class implements {@link ActionSource2}, any actions that one would normally take on a component that
* implements ActionSource2, such as {@link UICommand}, are valid for instances of this class. Instances of
* this class participate in the regular Jakarta Server Faces lifecycle, including on Ajax requests.
*
*
*
* The purpose of this component is to provide a light-weight front-controller solution for executing code upon the
* loading of a Jakarta Server Faces view to support the integration of system services, content retrieval, view
* management, and navigation. This functionality is especially useful for non-faces (initial) requests.
*
*
*
* The most common use case for this component is to take actions necessary for a particular view, often with the help
* of one or more {@link UIViewParameter}s.
*
*
*
* The {@link NavigationHandler} is consulted after the action is invoked to carry out the navigation case that matches
* the action signature and outcome. If a navigation case is matched that causes the new viewId to be different from the
* current viewId, the runtime must force a redirect to that matched navigation case with different viewId, regardless
* of whether or not the matched navigation case with different viewId called for a redirect.
* If the navigation will result in a flow transition, the appropriate metadata must be
* included in the query string for the redirect. See section 7.4.2 Default NavigationHandler Algorithm, for the
* discussion of how to handle {@code <redirect />} cases.
*
*
*
* It's important to note that the full component tree is not built before the UIViewAction components are processed on
* an non-faces (initial) request. Rather, the component tree only contains the {@link ViewMetadata}, an important part
* of the optimization of this component and what sets it apart from a {@link PreRenderViewEvent} listener.
*
*
*
*
* @since 2.2
*/
public class UIViewAction extends UIComponentBase implements ActionSource2 {
// ------------------------------------------------------ Manifest Constants
/**
*
* The standard component type for this component.
*
*/
public static final String COMPONENT_TYPE = "jakarta.faces.ViewAction";
/**
*
* The standard component family for this component.
*
*/
public static final String COMPONENT_FAMILY = "jakarta.faces.ViewAction";
private static final String UIVIEWACTION_BROADCAST = "jakarta.faces.ViewAction.broadcast";
private static final String UIVIEWACTION_EVENT_COUNT = "jakarta.faces.ViewAction.eventCount";
/**
* Properties that are tracked by state saving.
*/
enum PropertyKeys {
onPostback, actionExpression, immediate, phase, renderedAttr("if");
private String name;
PropertyKeys() {
}
PropertyKeys(final String name) {
this.name = name;
}
@Override
public String toString() {
return name != null ? name : super.toString();
}
}
// ------------------------------------------------------------ Constructors
/**
*
* Create a new {@link UIViewAction} instance with default property values.
*