Class PartialViewContext
- Direct Known Subclasses:
PartialViewContextWrapper
PartialViewContext contains methods and properties that pertain to partial request processing and partial response rendering on a view.
The 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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe value that when used withPARTIAL_EXECUTE_PARAM_NAMEorPARTIAL_RENDER_PARAM_NAMEindicates these phases must be skipped.static final StringThe request parameter name whose request parameter value identifies the type of partial event.static final StringThe request parameter name whose request parameter value is aCollectionof 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.static final StringThe request parameter name whose request parameter value is aCollectionof client identifiers identifying the components that must be processed during the Render Response phase of the request processing lifecycle.static final StringIf the request parameter named by the value of this constant has a parameter value oftrue, the implementation must returntruefromisResetValues(). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a mutableListof scripts to be evaluated in client side on complete of ajax request.abstract Collection<String>Return aCollectionof client identifiers from the current request with the request parameter namePARTIAL_EXECUTE_PARAM_NAME.abstract PartialResponseWriterReturn theResponseWriterto which components should direct their output for partial view rendering.abstract Collection<String>Return aCollectionof client identifiers from the current request with the request parameter namePARTIAL_RENDER_PARAM_NAME.abstract booleanReturntrueif the request headerFaces-Requestis present with the valuepartial/ajax.abstract booleanReturntrueifisAjaxRequest()returnstrueandPARTIAL_EXECUTE_PARAM_NAMEis present in the current request with the valueALL_PARTIAL_PHASE_CLIENT_IDS.abstract booleanReturntrueisAjaxRequest()returnstrueor if the request headerFaces-Requestis present with the valuepartial/process.abstract booleanReturntrueifisAjaxRequest()returnstrueandPARTIAL_RENDER_PARAM_NAMEis present in the current request with the valueALL_PARTIAL_PHASE_CLIENT_IDS.booleanReturntrueif the incoming request has a parameter named by the value ofRESET_VALUES_PARAM_NAMEand that value istrue.abstract voidprocessPartial(PhaseId phaseId) Perform lifecycle processing on components during the indicatedphaseId.abstract voidrelease()Release any resources associated with thisPartialViewContextinstance.abstract voidsetPartialRequest(boolean isPartialRequest) Dynamically indicate that this is a partial request.abstract voidsetRenderAll(boolean renderAll) Indicate the entire view must be rendered ifrenderAllistrue.
-
Field Details
-
PARTIAL_EVENT_PARAM_NAME
The request parameter name whose request parameter value identifies the type of partial event.
- Since:
- 2.3
- See Also:
-
PARTIAL_RENDER_PARAM_NAME
The request parameter name whose request parameter value is a
Collectionof client identifiers identifying the components that must be processed during the Render Response phase of the request processing lifecycle.- Since:
- 2.0
- See Also:
-
PARTIAL_EXECUTE_PARAM_NAME
The request parameter name whose request parameter value is a
Collectionof 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
- See Also:
-
RESET_VALUES_PARAM_NAME
If the request parameter named by the value of this constant has a parameter value of
true, the implementation must returntruefromisResetValues().- Since:
- 2.2
- See Also:
-
ALL_PARTIAL_PHASE_CLIENT_IDS
The value that when used with
PARTIAL_EXECUTE_PARAM_NAMEorPARTIAL_RENDER_PARAM_NAMEindicates these phases must be skipped.- Since:
- 2.0
- See Also:
-
-
Constructor Details
-
PartialViewContext
public PartialViewContext()
-
-
Method Details
-
getExecuteIds
Return a
Collectionof client identifiers from the current request with the request parameter namePARTIAL_EXECUTE_PARAM_NAME. If there is no such request parameter, return an emptyCollection. These client identifiers are used to identify components that will be processed during theexecutephase of the request processing lifecycle. The returnedCollectionis mutable.- Returns:
- the ids for the execute portion of the lifecycle
- Throws:
IllegalStateException- if this method is called after this instance has been released- Since:
- 2.0
-
getRenderIds
Return a
Collectionof client identifiers from the current request with the request parameter namePARTIAL_RENDER_PARAM_NAME. If there is no such request parameter, return an emptyCollection. These client identifiers are used to identify components that will be processed during therenderphase of the request processing lifecycle. The returnedCollectionis mutable.- Returns:
- the ids for the render portion of the lifecycle
- Throws:
IllegalStateException- if this method is called after this instance has been released- Since:
- 2.0
-
getEvalScripts
Returns a mutable
Listof scripts to be evaluated in client side on complete of ajax request.- Returns:
- A mutable
Listof 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
-
getPartialResponseWriter
Return the
ResponseWriterto 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.- Returns:
- the
ResponseWriterfor output - Throws:
IllegalStateException- if this method is called after this instance has been released- Since:
- 2.0
-
isAjaxRequest
public abstract boolean isAjaxRequest()Return
trueif the request headerFaces-Requestis present with the valuepartial/ajax. Otherwise, returnfalse.- Returns:
- whether or not this is an ajax request
- Throws:
IllegalStateException- if this method is called after this instance has been released- Since:
- 2.0
-
isPartialRequest
public abstract boolean isPartialRequest()Return
trueisAjaxRequest()returnstrueor if the request headerFaces-Requestis present with the valuepartial/process. Otherwise, returnfalse.- Returns:
- whether or not this request is partial
- Throws:
IllegalStateException- if this method is called after this instance has been released- Since:
- 2.0
-
isExecuteAll
public abstract boolean isExecuteAll()Return
trueifisAjaxRequest()returnstrueandPARTIAL_EXECUTE_PARAM_NAMEis present in the current request with the valueALL_PARTIAL_PHASE_CLIENT_IDS. Otherwise, returnfalse.- Returns:
- whether or not this is an execute all request
- Throws:
IllegalStateException- if this method is called after this instance has been released- Since:
- 2.0
-
isRenderAll
public abstract boolean isRenderAll()Return
trueifisAjaxRequest()returnstrueandPARTIAL_RENDER_PARAM_NAMEis present in the current request with the valueALL_PARTIAL_PHASE_CLIENT_IDS. Otherwise, returnfalse.- Returns:
- whether or not this is a render all request
- Throws:
IllegalStateException- if this method is called after this instance has been released- Since:
- 2.0
-
isResetValues
public boolean isResetValues()Return
trueif the incoming request has a parameter named by the value ofRESET_VALUES_PARAM_NAMEand that value istrue. To preserve backward compatibility with custom implementations that may have extended from an earlier version of this class, an implementation is provided that returnsfalse. A compliant implementation must override this method to take the specified action.- Returns:
- whether or not this is a reset values request
- Since:
- 2.2
-
setRenderAll
public abstract void setRenderAll(boolean renderAll) Indicate the entire view must be rendered if
renderAllistrue.- Parameters:
renderAll- the valuetrueindicates the entire view must be rendered.- Throws:
IllegalStateException- if this method is called after this instance has been released- Since:
- 2.0
-
setPartialRequest
public abstract void setPartialRequest(boolean isPartialRequest) Dynamically indicate that this is a partial request.
- Parameters:
isPartialRequest- the valuetrueindicates this is a partial request.- Throws:
IllegalStateException- if this method is called after this instance has been released- Since:
- 2.0
-
release
public abstract void release()Release any resources associated with this
PartialViewContextinstance.- Throws:
IllegalStateException- if this method is called after this instance has been released
-
processPartial
Perform lifecycle processing on components during the indicated
phaseId. Only those components with identifiers existing in theCollectionreturned fromgetExecuteIds()andgetRenderIds()will be processed.When the indicated
phaseIdequalsPhaseId.RENDER_RESPONSE, then perform the following tasks in sequence:- If
isResetValues()returnstrue, then callUIViewRoot.resetValues(FacesContext, Collection), passinggetRenderIds(). - If
isRenderAll()returnsfalse, then render any component resource ofUIViewRootwhoseResourceHandler.getRendererTypeForResourceName(String)does not returnnull, and whoseUIComponent.getChildCount()is zero, and whoseResourceHandler.isResourceRendered(FacesContext, String, String)returnsfalse, in anupdateelement with an identifier ofjakarta.faces.Resource. - Process the components.
- Obtain the state by calling
StateManager.getViewState(jakarta.faces.context.FacesContext)and write it out as anupdateelement with an identifier of<VIEW_ROOT_CONTAINER_CLIENT_ID><SEP>jakarta.faces.ViewStatewhere<VIEW_ROOT_CONTAINER_CLIENT_ID>is the return fromUIComponent.getContainerClientId(FacesContext)on the view from whence this state originated, and<SEP>is the currently configuredUINamingContainer.getSeparatorChar(FacesContext). - If
isRenderAll()returnsfalse, then write out each script ofgetEvalScripts()as anevalelement.
- Parameters:
phaseId- thePhaseIdthat indicates the lifecycle phase the components will be processed in.
- If
-