public class FacesContextImpl
extends jakarta.faces.context.FacesContext
| Constructor and Description |
|---|
FacesContextImpl(jakarta.faces.context.ExternalContext ec,
jakarta.faces.lifecycle.Lifecycle lifecycle) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMessage(String clientId,
jakarta.faces.application.FacesMessage message)
Append a
FacesMessage to the set of messages associated with the specified client
identifier, if clientId is not null. |
jakarta.faces.application.Application |
getApplication()
Return the
Application instance associated with this web
application. |
Map<Object,Object> |
getAttributes()
Return a mutable |
Iterator<String> |
getClientIdsWithMessages()
Return an
Iterator over the client identifiers for which at least one
FacesMessage has been queued. |
jakarta.faces.event.PhaseId |
getCurrentPhaseId()
Return the value last set on this |
static jakarta.faces.context.FacesContext |
getDefaultFacesContext() |
jakarta.el.ELContext |
getELContext()
Return the
ELContext instance for this FacesContext instance. |
jakarta.faces.context.ExceptionHandler |
getExceptionHandler()
Return the |
jakarta.faces.context.ExternalContext |
getExternalContext()
Return the
ExternalContext instance for this
FacesContext instance. |
jakarta.faces.application.FacesMessage.Severity |
getMaximumSeverity()
Return the maximum severity level recorded on any
FacesMessages that has been
queued, whether or not they are associated with any specific UIComponent. |
List<jakarta.faces.application.FacesMessage> |
getMessageList()
Like |
List<jakarta.faces.application.FacesMessage> |
getMessageList(String clientId)
Like |
Iterator<jakarta.faces.application.FacesMessage> |
getMessages()
Return an
Iterator over the FacesMessages that have been queued,
whether or not they are associated with any specific client identifier. |
Iterator<jakarta.faces.application.FacesMessage> |
getMessages(String clientId)
Return an
Iterator over the FacesMessages that have been queued that
are associated with the specified client identifier (if clientId is not null), or over the
FacesMessages that have been queued that are not associated with any specific
client identifier (if clientId is null). |
jakarta.faces.context.PartialViewContext |
getPartialViewContext()
Return the |
jakarta.faces.render.RenderKit |
getRenderKit()
Return the
RenderKit instance for the render kit identifier specified on our UIViewRoot, if there is
one. |
boolean |
getRenderResponse()
Return
true if the renderResponse() method has been called for the current request. |
List<String> |
getResourceLibraryContracts()
Return the list of resource library contracts that have been calculated to be appropriate for use with this view, or an empty list if there are no such resource library contracts. |
boolean |
getResponseComplete()
Return
true if the responseComplete() method has been called for the current request. |
jakarta.faces.context.ResponseStream |
getResponseStream()
Return the
ResponseStream to which components should direct their binary output. |
jakarta.faces.context.ResponseWriter |
getResponseWriter()
Return the
ResponseWriter to which components should direct their character-based output. |
jakarta.faces.component.UIViewRoot |
getViewRoot()
Return the root component that is associated with the this request.
|
boolean |
isPostback()
This utility method simply returns the result of
|
boolean |
isReleased()
Return a flag indicating if the resources associated with this |
boolean |
isValidationFailed()
Return |
void |
release()
Release any resources associated with this
FacesContext
instance. |
void |
renderResponse()
Signal the Jakarta Server Faces implementation that, as soon as the current phase of the request processing lifecycle
has been completed, control should be passed to the Render Response phase, bypassing any phases that have
not been executed yet.
|
void |
responseComplete()
Signal the Jakarta Server Faces implementation that the HTTP response for this request has already been generated
(such as an HTTP redirect), and that the request processing lifecycle should be terminated as soon as the current
phase is completed.
|
void |
setCurrentPhaseId(jakarta.faces.event.PhaseId currentPhaseId)
The implementation must call this method at the earliest possble point in time after entering into a new phase in the request processing lifecycle. |
void |
setExceptionHandler(jakarta.faces.context.ExceptionHandler exceptionHandler)
Set the |
void |
setResourceLibraryContracts(List<String> contracts)
Set the resource library contracts calculated as valid to use with this view. |
void |
setResponseStream(jakarta.faces.context.ResponseStream responseStream)
Set the
ResponseStream to which components should direct their binary output. |
void |
setResponseWriter(jakarta.faces.context.ResponseWriter responseWriter)
Set the
ResponseWriter to which components should direct their character-based output. |
void |
setViewRoot(jakarta.faces.component.UIViewRoot root)
Set the root component that is associated with this
request.
|
void |
validationFailed()
Sets a flag which indicates that a conversion or validation error occurred while processing the inputs. |
public FacesContextImpl(jakarta.faces.context.ExternalContext ec,
jakarta.faces.lifecycle.Lifecycle lifecycle)
public jakarta.faces.context.ExternalContext getExternalContext()
jakarta.faces.context.FacesContext
Return the ExternalContext instance for this
FacesContext instance.
It is valid to call this method during application startup or shutdown. If called during application startup or
shutdown, this method returns an ExternalContext instance with the special behaviors indicated in the javadoc
for that class. Methods document as being valid to call during application startup or shutdown must be supported.
getExternalContext in class jakarta.faces.context.FacesContextExternalContextFacesContext.getExternalContext()public jakarta.faces.application.Application getApplication()
jakarta.faces.context.FacesContext
Return the Application instance associated with this web
application.
It is valid to call this method during application startup or shutdown. If called during application startup or
shutdown, returns the correct current Application instance.
getApplication in class jakarta.faces.context.FacesContextApplication instance associated with this web application.FacesContext.getApplication()public jakarta.faces.context.ExceptionHandler getExceptionHandler()
jakarta.faces.context.FacesContext
Return the ExceptionHandler for this request.
getExceptionHandler in class jakarta.faces.context.FacesContextExceptionHandler.FacesContext.getExceptionHandler()public void setExceptionHandler(jakarta.faces.context.ExceptionHandler exceptionHandler)
jakarta.faces.context.FacesContext
Set the ExceptionHandler for this request.
setExceptionHandler in class jakarta.faces.context.FacesContextexceptionHandler - the ExceptionHandler for this request.FacesContext.setExceptionHandler(jakarta.faces.context.ExceptionHandler)public jakarta.faces.context.PartialViewContext getPartialViewContext()
jakarta.faces.context.FacesContext
Return the PartialViewContext for this request. The PartialViewContext is used to control the
processing of specified components during the execute portion of the request processing lifecycle (known as partial
processing) and the rendering of specified components (known as partial rendering). This method must return a new
PartialViewContext if one does not already exist.
getPartialViewContext in class jakarta.faces.context.FacesContextPartialViewContext for this request.FacesContext.getPartialViewContext()public boolean isPostback()
jakarta.faces.context.FacesContext
This utility method simply returns the result of
ResponseStateManager.isPostback(FacesContext).
The default implementation throws UnsupportedOperationException and is provided for the sole purpose of
not breaking existing applications that extend this class.
isPostback in class jakarta.faces.context.FacesContextFacesContext.isPostback()public boolean isReleased()
jakarta.faces.context.FacesContext
Return a flag indicating if the resources associated with this FacesContext instance have been released.
isReleased in class jakarta.faces.context.FacesContexttrue if the resources have been released.FacesContext.isReleased()public Map<Object,Object> getAttributes()
jakarta.faces.context.FacesContext
Return a mutable Map representing the attributes associated wth this FacesContext instance.
This Map is useful to store attributes that you want to go out of scope when the Faces lifecycle for the
current request ends, which is not always the same as the request ending, especially in the case of Jakarta Servlet
filters that are invoked after the Faces lifecycle for this request completes. Accessing this
Map does not cause any events to fire, as is the case with the other maps: for request, session, and
application scope. When FacesContext.release() is invoked, the attributes must be cleared.
The Map returned by this method is not associated with the request. If you would like to get or set
request attributes, see ExternalContext.getRequestMap().
The default implementation throws UnsupportedOperationException and is provided for the sole purpose of
not breaking existing applications that extend this class.
getAttributes in class jakarta.faces.context.FacesContextMap representing the attributes associated wth this FacesContext instance.FacesContext.getAttributes()public jakarta.el.ELContext getELContext()
jakarta.faces.context.FacesContext
Return the ELContext instance for this FacesContext instance. This ELContext
instance has the same lifetime and scope as the FacesContext instance with which it is associated, and
may be created lazily the first time this method is called for a given FacesContext instance. Upon
creation of the ELContext instance, the implementation must take the following action:
Call the ELContext.putContext(java.lang.Class<?>, java.lang.Object) method on the instance, passing in FacesContext.class and the
this reference for the FacesContext instance itself.
If the Collection returned by Application.getELContextListeners() is
non-empty, create an instance of ELContextEvent and pass it to each
ELContextListener instance in the Collection by calling the
ELContextListener.contextCreated(jakarta.el.ELContextEvent) method.
getELContext in class jakarta.faces.context.FacesContextELContext.FacesContext.getELContext()public Iterator<String> getClientIdsWithMessages()
jakarta.faces.context.FacesContext
Return an Iterator over the client identifiers for which at least one
FacesMessage has been queued. If there are no such client identifiers, an empty
Iterator is returned. If any messages have been queued that were not associated with any specific client
identifier, a null value will be included in the iterated values. The elements in the
Iterator must be returned in the order in which they were added with FacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage).
getClientIdsWithMessages in class jakarta.faces.context.FacesContextIterator over the client identifiers for which at least one
FacesMessage has been queued.FacesContext.getClientIdsWithMessages()public jakarta.faces.application.FacesMessage.Severity getMaximumSeverity()
jakarta.faces.context.FacesContext
Return the maximum severity level recorded on any FacesMessages that has been
queued, whether or not they are associated with any specific UIComponent. If no such
messages have been queued, return null.
getMaximumSeverity in class jakarta.faces.context.FacesContextFacesContext.getMaximumSeverity()public List<jakarta.faces.application.FacesMessage> getMessageList()
jakarta.faces.context.FacesContext
Like FacesContext.getMessages(), but returns a List<FacesMessage>, enabling use from Jakarta Expression
Language expressions.
The default implementation throws UnsupportedOperationException and is provided for the sole purpose of
not breaking existing applications that extend this class.
getMessageList in class jakarta.faces.context.FacesContextList which is effectively a snapshot of the messages present at the time of
invocation.FacesContext.getMessageList()public List<jakarta.faces.application.FacesMessage> getMessageList(String clientId)
jakarta.faces.context.FacesContext
Like FacesContext.getMessages(java.lang.String), but returns a List<FacesMessage> of messages for the
component with client id matching argument clientId.
The default implementation throws UnsupportedOperationException and is provided for the sole purpose of
not breaking existing applications that extend this class.
getMessageList in class jakarta.faces.context.FacesContextclientId - the client id of a component.List which is effectively a snapshot of the messages present at the time of
invocation.FacesContext.getMessageList(String)public Iterator<jakarta.faces.application.FacesMessage> getMessages()
jakarta.faces.context.FacesContext
Return an Iterator over the FacesMessages that have been queued,
whether or not they are associated with any specific client identifier. If no such messages have been queued, return
an empty Iterator. The elements of the Iterator must be returned in the order in which they
were added with calls to FacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage).
getMessages in class jakarta.faces.context.FacesContextIterator over the FacesMessages that have been queued.FacesContext.getMessages()public Iterator<jakarta.faces.application.FacesMessage> getMessages(String clientId)
jakarta.faces.context.FacesContext
Return an Iterator over the FacesMessages that have been queued that
are associated with the specified client identifier (if clientId is not null), or over the
FacesMessages that have been queued that are not associated with any specific
client identifier (if clientId is null). If no such messages have been queued, return an
empty Iterator. The elements of the Iterator must be returned in the order in which they
were added with calls to FacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage).
getMessages in class jakarta.faces.context.FacesContextclientId - The client identifier for which messages are requested, or null for messages not
associated with any client identifierIterator over the FacesMessages.FacesContext.getMessages(String)public jakarta.faces.render.RenderKit getRenderKit()
jakarta.faces.context.FacesContext
Return the RenderKit instance for the render kit identifier specified on our UIViewRoot, if there is
one. If there is no current UIViewRoot, if the UIViewRoot does not have a specified
renderKitId, or if there is no RenderKit for the specified identifier, return null
instead.
getRenderKit in class jakarta.faces.context.FacesContextRenderKit associated with the UIViewRoot.FacesContext.getRenderKit()public jakarta.faces.context.ResponseStream getResponseStream()
jakarta.faces.context.FacesContext
Return the ResponseStream to which components should direct their binary output. Within a given response,
components can use either the ResponseStream or the ResponseWriter, but not both.
getResponseStream in class jakarta.faces.context.FacesContextResponseStream instance.FacesContext.getResponseStream()public void setResponseStream(jakarta.faces.context.ResponseStream responseStream)
jakarta.faces.context.FacesContext
Set the ResponseStream to which components should direct their binary output.
setResponseStream in class jakarta.faces.context.FacesContextresponseStream - The new ResponseStream for this responseFacesContext.setResponseStream(jakarta.faces.context.ResponseStream)public jakarta.faces.component.UIViewRoot getViewRoot()
jakarta.faces.context.FacesContextReturn the root component that is associated with the this request.
It is valid to call this method during application startup or shutdown. If called during application startup or
shutdown, this method returns a new UIViewRoot with its locale set to Locale.getDefault().
getViewRoot in class jakarta.faces.context.FacesContextUIViewRoot instance.FacesContext.getViewRoot()public void setViewRoot(jakarta.faces.component.UIViewRoot root)
jakarta.faces.context.FacesContextSet the root component that is associated with this request.
This method can be called by the application handler (or a class that the handler calls), during the Invoke Application phase of the request processing lifecycle and during the Restore View phase of the request processing lifecycle (especially when a new root component is created). In the present version of the specification, implementations are not required to enforce this restriction, though a future version of the specification may require enforcement.
If the current UIViewRoot is non-null, and calling equals() on the argument
root, passing the current UIViewRoot returns false, the clear
method must be called on the Map returned from UIViewRoot.getViewMap().
setViewRoot in class jakarta.faces.context.FacesContextroot - The new component UIViewRoot componentFacesContext.setViewRoot(jakarta.faces.component.UIViewRoot)public jakarta.faces.context.ResponseWriter getResponseWriter()
jakarta.faces.context.FacesContext
Return the ResponseWriter to which components should direct their character-based output. Within a given
response, components can use either the ResponseStream or the ResponseWriter, but not both.
getResponseWriter in class jakarta.faces.context.FacesContextResponseWriter instance.FacesContext.getResponseWriter()public void setResponseWriter(jakarta.faces.context.ResponseWriter responseWriter)
jakarta.faces.context.FacesContext
Set the ResponseWriter to which components should direct their character-based output.
setResponseWriter in class jakarta.faces.context.FacesContextresponseWriter - The new ResponseWriter for this responseFacesContext.setResponseWriter(jakarta.faces.context.ResponseWriter)public void addMessage(String clientId, jakarta.faces.application.FacesMessage message)
jakarta.faces.context.FacesContext
Append a FacesMessage to the set of messages associated with the specified client
identifier, if clientId is not null. If clientId is null, this
FacesMessage is assumed to not be associated with any specific component instance.
addMessage in class jakarta.faces.context.FacesContextclientId - The client identifier with which this message is associated (if any)message - The message to be appendedFacesContext.addMessage(String, jakarta.faces.application.FacesMessage)public jakarta.faces.event.PhaseId getCurrentPhaseId()
jakarta.faces.context.FacesContext
Return the value last set on this FacesContext instance when FacesContext.setCurrentPhaseId(jakarta.faces.event.PhaseId) was called.
getCurrentPhaseId in class jakarta.faces.context.FacesContextFacesContext.getCurrentPhaseId()public void setCurrentPhaseId(jakarta.faces.event.PhaseId currentPhaseId)
jakarta.faces.context.FacesContextThe implementation must call this method at the earliest possble point in time after entering into a new phase in the request processing lifecycle.
setCurrentPhaseId in class jakarta.faces.context.FacesContextcurrentPhaseId - The PhaseId for the current phase.FacesContext.setCurrentPhaseId(jakarta.faces.event.PhaseId)public void release()
jakarta.faces.context.FacesContext
Release any resources associated with this FacesContext
instance. Faces implementations may choose to pool instances in the associated FacesContextFactory to avoid
repeated object creation and garbage collection. After release() is called on a
FacesContext instance (until the FacesContext instance has been recycled by the
implementation for re-use), calling any other methods will cause an IllegalStateException to be thrown.
If a call was made to FacesContext.getAttributes() during the processing for this request, the implementation must call
clear() on the Map returned from getAttributes(), and then de-allocate the
data-structure behind that Map.
The implementation must call FacesContext.setCurrentInstance(jakarta.faces.context.FacesContext) passing null to remove the association between
this thread and this dead FacesContext instance.
release in class jakarta.faces.context.FacesContextFacesContext.release()public void renderResponse()
jakarta.faces.context.FacesContextSignal the Jakarta Server Faces implementation that, as soon as the current phase of the request processing lifecycle has been completed, control should be passed to the Render Response phase, bypassing any phases that have not been executed yet.
renderResponse in class jakarta.faces.context.FacesContextFacesContext.renderResponse()public void responseComplete()
jakarta.faces.context.FacesContextSignal the Jakarta Server Faces implementation that the HTTP response for this request has already been generated (such as an HTTP redirect), and that the request processing lifecycle should be terminated as soon as the current phase is completed.
responseComplete in class jakarta.faces.context.FacesContextFacesContext.responseComplete()public void validationFailed()
jakarta.faces.context.FacesContext
Sets a flag which indicates that a conversion or validation error occurred while processing the inputs. Inputs
consist of either page parameters or form bindings. This flag can be read using FacesContext.isValidationFailed().
validationFailed in class jakarta.faces.context.FacesContextFacesContext.validationFailed()public boolean getRenderResponse()
jakarta.faces.context.FacesContext
Return true if the renderResponse() method has been called for the current request.
getRenderResponse in class jakarta.faces.context.FacesContextrenderResponse() has been called.FacesContext.getRenderResponse()public List<String> getResourceLibraryContracts()
jakarta.faces.context.FacesContextReturn the list of resource library contracts that have been calculated to be appropriate for use with this view, or an empty list if there are no such resource library contracts. The list returned by this method must be immutable. For backward compatibility with implementations of the specification prior to when this method was introduced, an implementation is provided that returns an empty list. Implementations compliant with the version in which this method was introduced must implement this method as specified.
getResourceLibraryContracts in class jakarta.faces.context.FacesContextpublic void setResourceLibraryContracts(List<String> contracts)
jakarta.faces.context.FacesContext
Set the resource library contracts calculated as valid to use with this view. The implementation must copy the
contents of the incoming List into an immutable List for return from
FacesContext.getResourceLibraryContracts(). If the argument is null or empty, the action taken is the same as if
the argument is null: a subsequent call to getResourceLibraryContracts returns null. This
method may only be called during the processing of ViewDeclarationLanguage.createView(jakarta.faces.context.FacesContext, java.lang.String) and
during the VDL tag handler for the tag corresponding to an instance of UIViewRoot. For backward compatibility
with implementations of the specification prior to when this method was introduced, an implementation is provided
that takes no action. Implementations compliant with the version in which this method was introduced must implement
this method as specified.
setResourceLibraryContracts in class jakarta.faces.context.FacesContextcontracts - The new contracts to be returned, as an immutable List. from a subsequent call to
FacesContext.getResourceLibraryContracts().public boolean getResponseComplete()
jakarta.faces.context.FacesContext
Return true if the responseComplete() method has been called for the current request.
getResponseComplete in class jakarta.faces.context.FacesContextresponseComplete() method has been called.FacesContext.getResponseComplete()public boolean isValidationFailed()
jakarta.faces.context.FacesContext
Return true if the validationFailed() method has been called for the current request.
isValidationFailed in class jakarta.faces.context.FacesContextvalidationFailed() method has been called for the current requestFacesContext.isValidationFailed()public static jakarta.faces.context.FacesContext getDefaultFacesContext()
Copyright © 2010–2022 JBoss by Red Hat. All rights reserved.