public abstract class PartialViewContext
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL_PARTIAL_PHASE_CLIENT_IDS
The value that when used with |
static java.lang.String |
PARTIAL_EVENT_PARAM_NAME
The request parameter name whose request parameter value identifies the type of partial event. |
static java.lang.String |
PARTIAL_EXECUTE_PARAM_NAME
The request parameter name whose request parameter value
is a |
static java.lang.String |
PARTIAL_RENDER_PARAM_NAME
The request parameter name whose request parameter value
is a |
static java.lang.String |
RESET_VALUES_PARAM_NAME
If the request parameter named by the value of this constant has
a parameter value of |
Constructor and Description |
---|
PartialViewContext() |
Modifier and Type | Method and Description |
---|---|
abstract java.util.List<java.lang.String> |
getEvalScripts()
Returns a mutable |
abstract java.util.Collection<java.lang.String> |
getExecuteIds()
Return a
|
abstract PartialResponseWriter |
getPartialResponseWriter()
Return the |
abstract java.util.Collection<java.lang.String> |
getRenderIds()
Return a
|
abstract boolean |
isAjaxRequest()
Return |
abstract boolean |
isExecuteAll()
Return |
abstract boolean |
isPartialRequest()
Return |
abstract boolean |
isRenderAll()
Return |
boolean |
isResetValues()
Return |
abstract void |
processPartial(PhaseId phaseId)
Perform lifecycle processing on components during the indicated
|
abstract void |
release()
Release any
resources associated with this
PartialViewContext
instance. |
abstract void |
setPartialRequest(boolean isPartialRequest)
Dynamically indicate that this is a partial request. |
abstract void |
setRenderAll(boolean renderAll)
Indicate the entire view must be rendered if
|
public static final java.lang.String PARTIAL_EVENT_PARAM_NAME
The request parameter name whose request parameter value identifies the type of partial event.
public static final java.lang.String PARTIAL_RENDER_PARAM_NAME
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.
public static final java.lang.String PARTIAL_EXECUTE_PARAM_NAME
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.
public static final java.lang.String RESET_VALUES_PARAM_NAME
If the request parameter named by the value of this constant has
a parameter value of true
, the implementation
must return true
from isResetValues()
.
public static final java.lang.String ALL_PARTIAL_PHASE_CLIENT_IDS
The value that when used with PARTIAL_EXECUTE_PARAM_NAME
or PARTIAL_RENDER_PARAM_NAME
indicates these phases
must be skipped.
public abstract java.util.Collection<java.lang.String> getExecuteIds()
Return a
Collection
of client identifiers from the current request
with the request parameter name 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.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract java.util.Collection<java.lang.String> getRenderIds()
Return a
Collection
of client identifiers from the current request
with the request parameter name 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.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract java.util.List<java.lang.String> getEvalScripts()
Returns a mutable List
of scripts to be evaluated in client side on complete of ajax request.
List
of scripts to be evaluated in client side on complete of ajax request.java.lang.IllegalStateException
- If this method is called after this instance has been released.public abstract PartialResponseWriter getPartialResponseWriter()
Return the 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.
ResponseWriter
for outputjava.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract boolean isAjaxRequest()
Return true
if the request header
Faces-Request
is present with the value
partial/ajax
.
Otherwise, return false
.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract boolean isPartialRequest()
Return true
isAjaxRequest()
returns
true
or if the request header
Faces-Request
is present with the value
partial/process
.
Otherwise, return false
.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract boolean isExecuteAll()
Return true
if isAjaxRequest()
returns true
and PARTIAL_EXECUTE_PARAM_NAME
is present in the current request with the value
ALL_PARTIAL_PHASE_CLIENT_IDS
.
Otherwise, return false
.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract boolean isRenderAll()
Return true
if isAjaxRequest()
returns true
and PARTIAL_RENDER_PARAM_NAME
is present in the current request with the value
ALL_PARTIAL_PHASE_CLIENT_IDS
.
Otherwise, return false
.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic boolean isResetValues()
Return true
if
the incoming request has a parameter named by the value of 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.
public abstract void setRenderAll(boolean renderAll)
Indicate the entire view must be rendered if
renderAll
is true
.
renderAll
- the value true
indicates
the entire view must be rendered.java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract void setPartialRequest(boolean isPartialRequest)
Dynamically indicate that this is a partial request.
isPartialRequest
- the value true
indicates
this is a partial request.java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract void release()
Release any
resources associated with this PartialViewContext
instance.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract void processPartial(PhaseId phaseId)
Perform lifecycle processing on components during the indicated
phaseId
. Only those components with identifiers existing in the Collection
returned
from getExecuteIds()
and getRenderIds()
will be processed.
When the indicated phaseId
equals PhaseId.RENDER_RESPONSE
, then perform the following
tasks in sequence:
isResetValues()
returns true
, then call
UIViewRoot.resetValues(FacesContext, Collection)
, passing getRenderIds()
.isRenderAll()
returns false
, then render any component resource of
UIViewRoot
whose ResourceHandler.getRendererTypeForResourceName(String)
does not return
null
, and whose UIComponent.getChildCount()
is zero, and whose
ResourceHandler.isResourceRendered(FacesContext, String, String)
returns false
, in an
update
element with an identifier of javax.faces.Resource
.StateManager.getViewState(javax.faces.context.FacesContext)
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
UIComponent.getContainerClientId(FacesContext)
on the view from whence this state originated, and
<SEP>
is the currently configured UINamingContainer.getSeparatorChar(FacesContext)
.
isRenderAll()
returns false
, then write out each script of getEvalScripts()
as an eval
element.phaseId
- the PhaseId
that indicates
the lifecycle phase the components will be processed in.