-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessage
(String clientId, FacesMessage message) Append aFacesMessage
to the set of messages associated with the specified client identifier, ifclientId
is notnull
.Return theApplication
instance associated with this web application.Return a mutableMap
representing the attributes associated wth thisFacesContext
instance.Return anIterator
over the client identifiers for which at least oneFacesMessage
has been queued.Return the value last set on thisFacesContext
instance whenFacesContext.setCurrentPhaseId(jakarta.faces.event.PhaseId)
was called.static FacesContext
Return theELContext
instance for thisFacesContext
instance.Return theExceptionHandler
for this request.Return the maximum severity level recorded on anyFacesMessage
s that has been queued, whether or not they are associated with any specificUIComponent
.LikeFacesContext.getMessages()
, but returns aList<FacesMessage>
, enabling use from Jakarta Expression Language expressions.getMessageList
(String clientId) LikeFacesContext.getMessages(java.lang.String)
, but returns aList<FacesMessage>
of messages for the component with client id matching argumentclientId
.Return anIterator
over theFacesMessage
s that have been queued, whether or not they are associated with any specific client identifier.getMessages
(String clientId) Return anIterator
over theFacesMessage
s that have been queued that are associated with the specified client identifier (ifclientId
is notnull
), or over theFacesMessage
s that have been queued that are not associated with any specific client identifier (ifclientId
isnull
).Return thePartialViewContext
for this request.Return theRenderKit
instance for the render kit identifier specified on ourUIViewRoot
, if there is one.boolean
Returntrue
if therenderResponse()
method has been called for the current request.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
Returntrue
if theresponseComplete()
method has been called for the current request.Return theResponseStream
to which components should direct their binary output.Return theResponseWriter
to which components should direct their character-based output.Return the root component that is associated with the this request.boolean
This utility method simply returns the result ofResponseStateManager.isPostback(FacesContext)
.boolean
Return a flag indicating if the resources associated with thisFacesContext
instance have been released.boolean
Returntrue
if thevalidationFailed()
method has been called for the current request.void
release()
Release any resources associated with thisFacesContext
instance.void
Signal the Jakarta 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
Signal the Jakarta 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
(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
(ExceptionHandler exceptionHandler) Set theExceptionHandler
for this request.void
setResourceLibraryContracts
(List<String> contracts) Set the resource library contracts calculated as valid to use with this view.void
setResponseStream
(ResponseStream responseStream) Set theResponseStream
to which components should direct their binary output.void
setResponseWriter
(ResponseWriter responseWriter) Set theResponseWriter
to which components should direct their character-based output.void
setViewRoot
(UIViewRoot root) Set the root component that is associated with this request.void
Sets a flag which indicates that a conversion or validation error occurred while processing the inputs.Methods inherited from class jakarta.faces.context.FacesContext
getCurrentInstance, getNamingContainerSeparatorChar, isProcessingEvents, isProjectStage, setCurrentInstance, setProcessingEvents
-
Constructor Details
-
FacesContextImpl
-
-
Method Details
-
getLifecycle
Description copied from class:FacesContext
Return the
Lifecycle
instance for thisFacesContext
instance.- Specified by:
getLifecycle
in classFacesContext
- Returns:
- instance of
Lifecycle
- See Also:
-
getExternalContext
Description copied from class:FacesContext
Return the
ExternalContext
instance for thisFacesContext
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.- Specified by:
getExternalContext
in classFacesContext
- Returns:
- instance of
ExternalContext
- See Also:
-
getApplication
Description copied from class: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.- Specified by:
getApplication
in classFacesContext
- Returns:
- the
Application
instance associated with this web application. - See Also:
-
getExceptionHandler
Description copied from class:FacesContext
Return the
ExceptionHandler
for this request.- Overrides:
getExceptionHandler
in classFacesContext
- Returns:
- instance of
ExceptionHandler
. - See Also:
-
setExceptionHandler
Description copied from class:FacesContext
Set the
ExceptionHandler
for this request.- Overrides:
setExceptionHandler
in classFacesContext
- Parameters:
exceptionHandler
- theExceptionHandler
for this request.- See Also:
-
getPartialViewContext
Description copied from class:FacesContext
Return the
PartialViewContext
for this request. ThePartialViewContext
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 newPartialViewContext
if one does not already exist.- Overrides:
getPartialViewContext
in classFacesContext
- Returns:
- the instance of
PartialViewContext
for this request. - See Also:
-
isPostback
public boolean isPostback()Description copied from class: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.- Overrides:
isPostback
in classFacesContext
- Returns:
- the boolean indicating whether this request is a post one.
- See Also:
-
isReleased
public boolean isReleased()Description copied from class:FacesContext
Return a flag indicating if the resources associated with this
FacesContext
instance have been released.- Overrides:
isReleased
in classFacesContext
- Returns:
true
if the resources have been released.- See Also:
-
getAttributes
Description copied from class:FacesContext
Return a mutable
Map
representing the attributes associated wth thisFacesContext
instance. ThisMap
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 thisMap
does not cause any events to fire, as is the case with the other maps: for request, session, and application scope. WhenFacesContext.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, seeExternalContext.getRequestMap()
.The default implementation throws
UnsupportedOperationException
and is provided for the sole purpose of not breaking existing applications that extend this class.- Overrides:
getAttributes
in classFacesContext
- Returns:
- mutable
Map
representing the attributes associated wth thisFacesContext
instance. - See Also:
-
getELContext
Description copied from class:FacesContext
Return the
ELContext
instance for thisFacesContext
instance. ThisELContext
instance has the same lifetime and scope as theFacesContext
instance with which it is associated, and may be created lazily the first time this method is called for a givenFacesContext
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 inFacesContext.class
and thethis
reference for theFacesContext
instance itself. -
If the
Collection
returned byApplication.getELContextListeners()
is non-empty, create an instance ofELContextEvent
and pass it to eachELContextListener
instance in theCollection
by calling theELContextListener.contextCreated(jakarta.el.ELContextEvent)
method.
- Overrides:
getELContext
in classFacesContext
- Returns:
- instance of
ELContext
. - See Also:
-
-
getClientIdsWithMessages
Description copied from class:FacesContext
Return an
Iterator
over the client identifiers for which at least oneFacesMessage
has been queued. If there are no such client identifiers, an emptyIterator
is returned. If any messages have been queued that were not associated with any specific client identifier, anull
value will be included in the iterated values. The elements in theIterator
must be returned in the order in which they were added withFacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage)
.- Specified by:
getClientIdsWithMessages
in classFacesContext
- Returns:
- the
Iterator
over the client identifiers for which at least oneFacesMessage
has been queued. - See Also:
-
getMaximumSeverity
Description copied from class:FacesContext
Return the maximum severity level recorded on any
FacesMessage
s that has been queued, whether or not they are associated with any specificUIComponent
. If no such messages have been queued, returnnull
.- Specified by:
getMaximumSeverity
in classFacesContext
- Returns:
- the maximum severity level.
- See Also:
-
getMessageList
Description copied from class:FacesContext
Like
FacesContext.getMessages()
, but returns aList<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.- Overrides:
getMessageList
in classFacesContext
- Returns:
- an immutable
List
which is effectively a snapshot of the messages present at the time of invocation. - See Also:
-
getMessageList
Description copied from class:FacesContext
Like
FacesContext.getMessages(java.lang.String)
, but returns aList<FacesMessage>
of messages for the component with client id matching argumentclientId
.The default implementation throws
UnsupportedOperationException
and is provided for the sole purpose of not breaking existing applications that extend this class.- Overrides:
getMessageList
in classFacesContext
- Parameters:
clientId
- the client id of a component.- Returns:
- an immutable
List
which is effectively a snapshot of the messages present at the time of invocation. - See Also:
-
getMessages
Description copied from class:FacesContext
Return an
Iterator
over theFacesMessage
s that have been queued, whether or not they are associated with any specific client identifier. If no such messages have been queued, return an emptyIterator
. The elements of theIterator
must be returned in the order in which they were added with calls toFacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage)
.- Specified by:
getMessages
in classFacesContext
- Returns:
Iterator
over theFacesMessage
s that have been queued.- See Also:
-
getMessages
Description copied from class:FacesContext
Return an
Iterator
over theFacesMessage
s that have been queued that are associated with the specified client identifier (ifclientId
is notnull
), or over theFacesMessage
s that have been queued that are not associated with any specific client identifier (ifclientId
isnull
). If no such messages have been queued, return an emptyIterator
. The elements of theIterator
must be returned in the order in which they were added with calls toFacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage)
.- Specified by:
getMessages
in classFacesContext
- Parameters:
clientId
- The client identifier for which messages are requested, ornull
for messages not associated with any client identifier- Returns:
Iterator
over theFacesMessage
s.- See Also:
-
getRenderKit
Description copied from class:FacesContext
Return the
RenderKit
instance for the render kit identifier specified on ourUIViewRoot
, if there is one. If there is no currentUIViewRoot
, if theUIViewRoot
does not have a specifiedrenderKitId
, or if there is noRenderKit
for the specified identifier, returnnull
instead.- Specified by:
getRenderKit
in classFacesContext
- Returns:
- instance of
RenderKit
associated with theUIViewRoot
. - See Also:
-
getResponseStream
Description copied from class: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.- Specified by:
getResponseStream
in classFacesContext
- Returns:
ResponseStream
instance.- See Also:
-
setResponseStream
Description copied from class:FacesContext
Set the
ResponseStream
to which components should direct their binary output.- Specified by:
setResponseStream
in classFacesContext
- Parameters:
responseStream
- The new ResponseStream for this response- See Also:
-
getViewRoot
Description copied from class:FacesContext
Return 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 toLocale.getDefault()
.- Specified by:
getViewRoot
in classFacesContext
- Returns:
UIViewRoot
instance.- See Also:
-
setViewRoot
Description copied from class:FacesContext
Set 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 callingequals()
on the argumentroot
, passing the currentUIViewRoot
returnsfalse
, theclear
method must be called on theMap
returned fromUIViewRoot.getViewMap()
.- Specified by:
setViewRoot
in classFacesContext
- Parameters:
root
- The new componentUIViewRoot
component- See Also:
-
getResponseWriter
Description copied from class: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.- Specified by:
getResponseWriter
in classFacesContext
- Returns:
ResponseWriter
instance.- See Also:
-
setResponseWriter
Description copied from class:FacesContext
Set the
ResponseWriter
to which components should direct their character-based output.- Specified by:
setResponseWriter
in classFacesContext
- Parameters:
responseWriter
- The new ResponseWriter for this response- See Also:
-
addMessage
Description copied from class:FacesContext
Append a
FacesMessage
to the set of messages associated with the specified client identifier, ifclientId
is notnull
. IfclientId
isnull
, thisFacesMessage
is assumed to not be associated with any specific component instance.- Specified by:
addMessage
in classFacesContext
- Parameters:
clientId
- The client identifier with which this message is associated (if any)message
- The message to be appended- See Also:
-
getCurrentPhaseId
Description copied from class:FacesContext
Return the value last set on this
FacesContext
instance whenFacesContext.setCurrentPhaseId(jakarta.faces.event.PhaseId)
was called.- Overrides:
getCurrentPhaseId
in classFacesContext
- Returns:
- the current phase id.
- See Also:
-
setCurrentPhaseId
Description copied from class:FacesContext
The implementation must call this method at the earliest possble point in time after entering into a new phase in the request processing lifecycle.
- Overrides:
setCurrentPhaseId
in classFacesContext
- Parameters:
currentPhaseId
- ThePhaseId
for the current phase.- See Also:
-
release
public void release()Description copied from class:FacesContext
Release any resources associated with this
FacesContext
instance. Faces implementations may choose to pool instances in the associatedFacesContextFactory
to avoid repeated object creation and garbage collection. Afterrelease()
is called on aFacesContext
instance (until theFacesContext
instance has been recycled by the implementation for re-use), calling any other methods will cause anIllegalStateException
to be thrown.If a call was made to
FacesContext.getAttributes()
during the processing for this request, the implementation must callclear()
on theMap
returned fromgetAttributes()
, and then de-allocate the data-structure behind thatMap
.The implementation must call
FacesContext.setCurrentInstance(jakarta.faces.context.FacesContext)
passingnull
to remove the association between this thread and this deadFacesContext
instance.- Specified by:
release
in classFacesContext
- See Also:
-
renderResponse
public void renderResponse()Description copied from class:FacesContext
Signal the Jakarta 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.
- Specified by:
renderResponse
in classFacesContext
- See Also:
-
responseComplete
public void responseComplete()Description copied from class:FacesContext
Signal the Jakarta 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.
- Specified by:
responseComplete
in classFacesContext
- See Also:
-
validationFailed
public void validationFailed()Description copied from class: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()
.- Overrides:
validationFailed
in classFacesContext
- See Also:
-
getRenderResponse
public boolean getRenderResponse()Description copied from class:FacesContext
Return
true
if therenderResponse()
method has been called for the current request.- Specified by:
getRenderResponse
in classFacesContext
- Returns:
- flag indicating whether the
renderResponse()
has been called. - See Also:
-
getResourceLibraryContracts
Description copied from class:FacesContext
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. 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.
- Overrides:
getResourceLibraryContracts
in classFacesContext
- Returns:
- the list of resource library contracts.
-
setResourceLibraryContracts
Description copied from class: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 immutableList
for return fromFacesContext.getResourceLibraryContracts()
. If the argument isnull
or empty, the action taken is the same as if the argument isnull
: a subsequent call togetResourceLibraryContracts
returnsnull
. This method may only be called during the processing ofViewDeclarationLanguage.createView(jakarta.faces.context.FacesContext, java.lang.String)
and during the VDL tag handler for the tag corresponding to an instance ofUIViewRoot
. 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.- Overrides:
setResourceLibraryContracts
in classFacesContext
- Parameters:
contracts
- The new contracts to be returned, as an immutableList
. from a subsequent call toFacesContext.getResourceLibraryContracts()
.
-
getResponseComplete
public boolean getResponseComplete()Description copied from class:FacesContext
Return
true
if theresponseComplete()
method has been called for the current request.- Specified by:
getResponseComplete
in classFacesContext
- Returns:
- the boolean indicating whether
responseComplete()
method has been called. - See Also:
-
isValidationFailed
public boolean isValidationFailed()Description copied from class:FacesContext
Return
true
if thevalidationFailed()
method has been called for the current request.- Overrides:
isValidationFailed
in classFacesContext
- Returns:
- boolean indicating if the
validationFailed()
method has been called for the current request - See Also:
-
getDefaultFacesContext
-