All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.faces.context.PartialViewContext Maven / Gradle / Ivy

Go to download

This is the master POM file for Oracle's Implementation of the JSF 2.2 Specification.

There is a newer version: 2.4.0
Show newest version
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 1997-2017 Oracle and/or its affiliates. All rights reserved.
 *
 * The contents of this file are subject to the terms of either the GNU
 * General Public License Version 2 only ("GPL") or the Common Development
 * and Distribution License("CDDL") (collectively, the "License").  You
 * may not use this file except in compliance with the License.  You can
 * obtain a copy of the License at
 * https://glassfish.java.net/public/CDDL+GPL_1_1.html
 * or packager/legal/LICENSE.txt.  See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * When distributing the software, include this License Header Notice in each
 * file and include the License file at packager/legal/LICENSE.txt.
 *
 * GPL Classpath Exception:
 * Oracle designates this particular file as subject to the "Classpath"
 * exception as provided by Oracle in the GPL Version 2 section of the License
 * file that accompanied this code.
 *
 * Modifications:
 * If applicable, add the following below the License Header, with the fields
 * enclosed by brackets [] replaced by your own identifying information:
 * "Portions Copyright [year] [name of copyright owner]"
 *
 * Contributor(s):
 * If you wish your version of this file to be governed by only the CDDL or
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
 * elects to include this software in this distribution under the [CDDL or GPL
 * Version 2] license."  If you don't indicate a single choice of license, a
 * recipient has the option to distribute your version of this file under
 * either the CDDL, the GPL Version 2 or to extend the choice of license to
 * its licensees as provided above.  However, if you add GPL Version 2 code
 * and therefore, elected the GPL Version 2 license, then the option applies
 * only if the new code is made subject to such option by the copyright
 * holder.
 */

package javax.faces.context;

import java.util.Collection;
import java.util.List;

import javax.faces.application.ResourceHandler;
import javax.faces.application.StateManager;
import javax.faces.component.UIComponent;
import javax.faces.component.UINamingContainer;
import javax.faces.component.UIViewRoot;
import javax.faces.event.PhaseId;

/**
 * 

PartialViewContext * contains methods and properties that pertain to partial request * processing and partial response rendering on a view.

* *

The {@link PartialViewContext} instance is used to determine if * the current request indicates the requirement to perform * partial processing and/or partial rendering. * Partial processing is the processing of selected components * through the execute portion of the request processing * lifecycle. Partial rendering is the rendering of specified * components in the Render Response Phase of the * request processing lifecycle.

* */ public abstract class PartialViewContext { /** *

* The request parameter name whose request parameter value identifies the type of partial event.

* * @since 2.3 */ public static final String PARTIAL_EVENT_PARAM_NAME = "javax.faces.partial.event"; /** *

* The request parameter name whose request parameter value * is a Collection of client identifiers identifying the * components that must be processed during the * Render Response phase of the request processing * lifecycle.

* * @since 2.0 */ public static final String PARTIAL_RENDER_PARAM_NAME = "javax.faces.partial.render"; /** *

* The request parameter name whose request parameter value * is a Collection of client identifiers identifying the * components that must be processed during the * Apply Request Values, Process Validations, * and Update Model Values phases of the request * processing lifecycle.

* * @since 2.0 */ public static final String PARTIAL_EXECUTE_PARAM_NAME = "javax.faces.partial.execute"; /** *

* If the request parameter named by the value of this constant has * a parameter value of true, the implementation * must return true from {@link #isResetValues}.

* * @since 2.2 */ public static final String RESET_VALUES_PARAM_NAME = "javax.faces.partial.resetValues"; /** *

* The value that when used with {@link #PARTIAL_EXECUTE_PARAM_NAME} * or {@link #PARTIAL_RENDER_PARAM_NAME} indicates these phases * must be skipped.

* * @since 2.0 */ public static final String ALL_PARTIAL_PHASE_CLIENT_IDS = "@all"; // -------------------------------------------------------------- Properties /** *

Return a * Collection of client identifiers from the current request * with the request parameter name {@link #PARTIAL_EXECUTE_PARAM_NAME}. * If there is no such request parameter, return an empty Collection. * These client identifiers are used to identify components that * will be processed during the execute phase of the * request processing lifecycle. The returned Collection is * mutable.

* * @throws IllegalStateException if this method is called after * this instance has been released * * @since 2.0 * * @return the ids for the execute portion of the lifecycle */ public abstract Collection getExecuteIds(); /** *

Return a * Collection of client identifiers from the current request * with the request parameter name {@link #PARTIAL_RENDER_PARAM_NAME}. * If there is no such request parameter, return an empty Collection. * These client identifiers are used to identify components that * will be processed during the render phase of the * request processing lifecycle. The returned Collection is * mutable.

* * @throws IllegalStateException if this method is called after * this instance has been released * * @since 2.0 * * @return the ids for the render portion of the lifecycle */ public abstract Collection getRenderIds(); /** *

* Returns a mutable List of scripts to be evaluated in client side on complete of ajax request. *

* * @return A mutable List of scripts to be evaluated in client side on complete of ajax request. * @throws IllegalStateException If this method is called after this instance has been released. * @since 2.3 */ public abstract List getEvalScripts(); /** *

Return the {@link ResponseWriter} * to which components should * direct their output for partial view rendering. Within a given * response, components can use either the ResponseStream or the * ResponseWriter, but not both.

* * @throws IllegalStateException if this method is called after * this instance has been released * * @since 2.0 * * @return the {@code ResponseWriter} for output */ public abstract PartialResponseWriter getPartialResponseWriter(); /** *

* Return true if the request header * Faces-Request is present with the value * partial/ajax. * Otherwise, return false.

* * @throws IllegalStateException if this method is called after * this instance has been released * * @since 2.0 * * @return whether or not this is an ajax request */ public abstract boolean isAjaxRequest(); /** *

* Return true {@link #isAjaxRequest} returns * true or if the request header * Faces-Request is present with the value * partial/process. * Otherwise, return false.

* * @throws IllegalStateException if this method is called after * this instance has been released * * @since 2.0 * * @return whether or not this request is partial */ public abstract boolean isPartialRequest(); /** *

* Return true if {@link #isAjaxRequest} * returns true and {@link #PARTIAL_EXECUTE_PARAM_NAME} * is present in the current request with the value * {@link #ALL_PARTIAL_PHASE_CLIENT_IDS}. * Otherwise, return false.

* * @throws IllegalStateException if this method is called after * this instance has been released * * @since 2.0 * * @return whether or not this is an execute all request */ public abstract boolean isExecuteAll(); /** *

* Return true if {@link #isAjaxRequest} * returns true and {@link #PARTIAL_RENDER_PARAM_NAME} * is present in the current request with the value * {@link #ALL_PARTIAL_PHASE_CLIENT_IDS}. * Otherwise, return false.

* * @throws IllegalStateException if this method is called after * this instance has been released * * @since 2.0 * * @return whether or not this is a render all request */ public abstract boolean isRenderAll(); /** *

Return true if * the incoming request has a parameter named by the value of {@link #RESET_VALUES_PARAM_NAME} * and that value is true. To preserve backward compatibility * with custom implementations that may have extended from an earlier * version of this class, an implementation is provided that returns * false. A compliant implementation must override this * method to take the specified action.

* * @since 2.2 * * @return whether or not this is a reset values request */ public boolean isResetValues() { return false; } /** *

* Indicate the entire view must be rendered if * renderAll is true.

* * @param renderAll the value true indicates * the entire view must be rendered. * * @throws IllegalStateException if this method is called after * this instance has been released * * @since 2.0 */ public abstract void setRenderAll(boolean renderAll); /** *

* Dynamically indicate that this is a partial request.

* * @param isPartialRequest the value true indicates * this is a partial request. * * @throws IllegalStateException if this method is called after * this instance has been released * * @since 2.0 */ public abstract void setPartialRequest(boolean isPartialRequest); /** *

Release any * resources associated with this PartialViewContext * instance.

* * @throws IllegalStateException if this method is called after * this instance has been released */ public abstract void release(); /** *

Perform lifecycle processing on components during the indicated * phaseId. Only those components with identifiers existing in the Collection returned * from {@link #getExecuteIds} and {@link #getRenderIds} will be processed.

* *
*

When the indicated phaseId equals {@link PhaseId#RENDER_RESPONSE}, then perform the following * tasks in sequence: *

  1. If {@link #isResetValues()} returns true, then call * {@link UIViewRoot#resetValues(FacesContext, Collection)}, passing {@link #getRenderIds()}.
  2. *
  3. If {@link #isRenderAll()} returns false, then render any component resource of * {@link UIViewRoot} whose {@link ResourceHandler#getRendererTypeForResourceName(String)} does not return * null, and whose {@link UIComponent#getChildCount()} is zero, and whose * {@link ResourceHandler#isResourceRendered(FacesContext, String, String)} returns false, in an * update element with an identifier of javax.faces.Resource.
  4. *
  5. Process the components.
  6. *
  7. Obtain the state by calling {@link StateManager#getViewState} and write it out as an update * element with an identifier of <VIEW_ROOT_CONTAINER_CLIENT_ID><SEP>javax.faces.ViewState * where <VIEW_ROOT_CONTAINER_CLIENT_ID> is the return from * {@link UIViewRoot#getContainerClientId(FacesContext)} on the view from whence this state originated, and * <SEP> is the currently configured {@link UINamingContainer#getSeparatorChar(FacesContext)}. *
  8. *
  9. If {@link #isRenderAll()} returns false, then write out each script of {@link #getEvalScripts()} * as an eval element.
  10. *
* * @param phaseId the {@link javax.faces.event.PhaseId} that indicates * the lifecycle phase the components will be processed in. */ public abstract void processPartial(PhaseId phaseId); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy