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

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

The newest version!
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 1997-2011 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.dev.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 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 * 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"; /** *

* 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 */ 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 */ public abstract Collection getRenderIds(); /** *

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 */ 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 */ 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 */ 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 */ 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 */ public abstract boolean isRenderAll(); /** *

* 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.

* * @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