-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(String clientId, FacesMessage message) Append aFacesMessageto the set of messages associated with the specified client identifier, ifclientIdis notnull.Return theApplicationinstance associated with this web application.Return a mutableMaprepresenting the attributes associated wth thisFacesContextinstance.Return anIteratorover the client identifiers for which at least oneFacesMessagehas been queued.Return the value last set on thisFacesContextinstance whenFacesContext.setCurrentPhaseId(jakarta.faces.event.PhaseId)was called.static FacesContextReturn theELContextinstance for thisFacesContextinstance.Return theExceptionHandlerfor this request.Return the maximum severity level recorded on anyFacesMessages 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 anIteratorover theFacesMessages that have been queued, whether or not they are associated with any specific client identifier.getMessages(String clientId) Return anIteratorover theFacesMessages that have been queued that are associated with the specified client identifier (ifclientIdis notnull), or over theFacesMessages that have been queued that are not associated with any specific client identifier (ifclientIdisnull).Return thePartialViewContextfor this request.Return theRenderKitinstance for the render kit identifier specified on ourUIViewRoot, if there is one.booleanReturntrueif 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.booleanReturntrueif theresponseComplete()method has been called for the current request.Return theResponseStreamto which components should direct their binary output.Return theResponseWriterto which components should direct their character-based output.Return the root component that is associated with the this request.booleanThis utility method simply returns the result ofResponseStateManager.isPostback(FacesContext).booleanReturn a flag indicating if the resources associated with thisFacesContextinstance have been released.booleanReturntrueif thevalidationFailed()method has been called for the current request.voidrelease()Release any resources associated with thisFacesContextinstance.voidSignal 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.voidSignal 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.voidsetCurrentPhaseId(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.voidsetExceptionHandler(ExceptionHandler exceptionHandler) Set theExceptionHandlerfor this request.voidsetResourceLibraryContracts(List<String> contracts) Set the resource library contracts calculated as valid to use with this view.voidsetResponseStream(ResponseStream responseStream) Set theResponseStreamto which components should direct their binary output.voidsetResponseWriter(ResponseWriter responseWriter) Set theResponseWriterto which components should direct their character-based output.voidsetViewRoot(UIViewRoot root) Set the root component that is associated with this request.voidSets 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:FacesContextReturn the
Lifecycleinstance for thisFacesContextinstance.- Specified by:
getLifecyclein classFacesContext- Returns:
- instance of
Lifecycle - See Also:
-
getExternalContext
Description copied from class:FacesContextReturn the
ExternalContextinstance for thisFacesContextinstance.It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this method returns an
ExternalContextinstance 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:
getExternalContextin classFacesContext- Returns:
- instance of
ExternalContext - See Also:
-
getApplication
Description copied from class:FacesContextReturn the
Applicationinstance 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
Applicationinstance.- Specified by:
getApplicationin classFacesContext- Returns:
- the
Applicationinstance associated with this web application. - See Also:
-
getExceptionHandler
Description copied from class:FacesContextReturn the
ExceptionHandlerfor this request.- Overrides:
getExceptionHandlerin classFacesContext- Returns:
- instance of
ExceptionHandler. - See Also:
-
setExceptionHandler
Description copied from class:FacesContextSet the
ExceptionHandlerfor this request.- Overrides:
setExceptionHandlerin classFacesContext- Parameters:
exceptionHandler- theExceptionHandlerfor this request.- See Also:
-
getPartialViewContext
Description copied from class:FacesContextReturn the
PartialViewContextfor this request. ThePartialViewContextis 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 newPartialViewContextif one does not already exist.- Overrides:
getPartialViewContextin classFacesContext- Returns:
- the instance of
PartialViewContextfor this request. - See Also:
-
isPostback
public boolean isPostback()Description copied from class:FacesContextThis utility method simply returns the result of
ResponseStateManager.isPostback(FacesContext).The default implementation throws
UnsupportedOperationExceptionand is provided for the sole purpose of not breaking existing applications that extend this class.- Overrides:
isPostbackin classFacesContext- Returns:
- the boolean indicating whether this request is a post one.
- See Also:
-
isReleased
public boolean isReleased()Description copied from class:FacesContextReturn a flag indicating if the resources associated with this
FacesContextinstance have been released.- Overrides:
isReleasedin classFacesContext- Returns:
trueif the resources have been released.- See Also:
-
getAttributes
Description copied from class:FacesContextReturn a mutable
Maprepresenting the attributes associated wth thisFacesContextinstance. ThisMapis 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 thisMapdoes 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
Mapreturned 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
UnsupportedOperationExceptionand is provided for the sole purpose of not breaking existing applications that extend this class.- Overrides:
getAttributesin classFacesContext- Returns:
- mutable
Maprepresenting the attributes associated wth thisFacesContextinstance. - See Also:
-
getELContext
Description copied from class:FacesContextReturn the
ELContextinstance for thisFacesContextinstance. ThisELContextinstance has the same lifetime and scope as theFacesContextinstance with which it is associated, and may be created lazily the first time this method is called for a givenFacesContextinstance. 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.classand thethisreference for theFacesContextinstance itself. -
If the
Collectionreturned byApplication.getELContextListeners()is non-empty, create an instance ofELContextEventand pass it to eachELContextListenerinstance in theCollectionby calling theELContextListener.contextCreated(jakarta.el.ELContextEvent)method.
- Overrides:
getELContextin classFacesContext- Returns:
- instance of
ELContext. - See Also:
-
-
getClientIdsWithMessages
Description copied from class:FacesContextReturn an
Iteratorover the client identifiers for which at least oneFacesMessagehas been queued. If there are no such client identifiers, an emptyIteratoris returned. If any messages have been queued that were not associated with any specific client identifier, anullvalue will be included in the iterated values. The elements in theIteratormust be returned in the order in which they were added withFacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage).- Specified by:
getClientIdsWithMessagesin classFacesContext- Returns:
- the
Iteratorover the client identifiers for which at least oneFacesMessagehas been queued. - See Also:
-
getMaximumSeverity
Description copied from class:FacesContextReturn the maximum severity level recorded on any
FacesMessages that has been queued, whether or not they are associated with any specificUIComponent. If no such messages have been queued, returnnull.- Specified by:
getMaximumSeverityin classFacesContext- Returns:
- the maximum severity level.
- See Also:
-
getMessageList
Description copied from class:FacesContextLike
FacesContext.getMessages(), but returns aList<FacesMessage>, enabling use from Jakarta Expression Language expressions.The default implementation throws
UnsupportedOperationExceptionand is provided for the sole purpose of not breaking existing applications that extend this class.- Overrides:
getMessageListin classFacesContext- Returns:
- an immutable
Listwhich is effectively a snapshot of the messages present at the time of invocation. - See Also:
-
getMessageList
Description copied from class:FacesContextLike
FacesContext.getMessages(java.lang.String), but returns aList<FacesMessage>of messages for the component with client id matching argumentclientId.The default implementation throws
UnsupportedOperationExceptionand is provided for the sole purpose of not breaking existing applications that extend this class.- Overrides:
getMessageListin classFacesContext- Parameters:
clientId- the client id of a component.- Returns:
- an immutable
Listwhich is effectively a snapshot of the messages present at the time of invocation. - See Also:
-
getMessages
Description copied from class:FacesContextReturn an
Iteratorover theFacesMessages 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 theIteratormust be returned in the order in which they were added with calls toFacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage).- Specified by:
getMessagesin classFacesContext- Returns:
Iteratorover theFacesMessages that have been queued.- See Also:
-
getMessages
Description copied from class:FacesContextReturn an
Iteratorover theFacesMessages that have been queued that are associated with the specified client identifier (ifclientIdis notnull), or over theFacesMessages that have been queued that are not associated with any specific client identifier (ifclientIdisnull). If no such messages have been queued, return an emptyIterator. The elements of theIteratormust be returned in the order in which they were added with calls toFacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage).- Specified by:
getMessagesin classFacesContext- Parameters:
clientId- The client identifier for which messages are requested, ornullfor messages not associated with any client identifier- Returns:
Iteratorover theFacesMessages.- See Also:
-
getRenderKit
Description copied from class:FacesContextReturn the
RenderKitinstance for the render kit identifier specified on ourUIViewRoot, if there is one. If there is no currentUIViewRoot, if theUIViewRootdoes not have a specifiedrenderKitId, or if there is noRenderKitfor the specified identifier, returnnullinstead.- Specified by:
getRenderKitin classFacesContext- Returns:
- instance of
RenderKitassociated with theUIViewRoot. - See Also:
-
getResponseStream
Description copied from class:FacesContextReturn the
ResponseStreamto 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:
getResponseStreamin classFacesContext- Returns:
ResponseStreaminstance.- See Also:
-
setResponseStream
Description copied from class:FacesContextSet the
ResponseStreamto which components should direct their binary output.- Specified by:
setResponseStreamin classFacesContext- Parameters:
responseStream- The new ResponseStream for this response- See Also:
-
getViewRoot
Description copied from class: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
UIViewRootwith its locale set toLocale.getDefault().- Specified by:
getViewRootin classFacesContext- Returns:
UIViewRootinstance.- See Also:
-
setViewRoot
Description copied from class: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
UIViewRootis non-null, and callingequals()on the argumentroot, passing the currentUIViewRootreturnsfalse, theclearmethod must be called on theMapreturned fromUIViewRoot.getViewMap().- Specified by:
setViewRootin classFacesContext- Parameters:
root- The new componentUIViewRootcomponent- See Also:
-
getResponseWriter
Description copied from class:FacesContextReturn the
ResponseWriterto 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:
getResponseWriterin classFacesContext- Returns:
ResponseWriterinstance.- See Also:
-
setResponseWriter
Description copied from class:FacesContextSet the
ResponseWriterto which components should direct their character-based output.- Specified by:
setResponseWriterin classFacesContext- Parameters:
responseWriter- The new ResponseWriter for this response- See Also:
-
addMessage
Description copied from class:FacesContextAppend a
FacesMessageto the set of messages associated with the specified client identifier, ifclientIdis notnull. IfclientIdisnull, thisFacesMessageis assumed to not be associated with any specific component instance.- Specified by:
addMessagein 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:FacesContextReturn the value last set on this
FacesContextinstance whenFacesContext.setCurrentPhaseId(jakarta.faces.event.PhaseId)was called.- Overrides:
getCurrentPhaseIdin classFacesContext- Returns:
- the current phase id.
- See Also:
-
setCurrentPhaseId
Description copied from class:FacesContextThe implementation must call this method at the earliest possble point in time after entering into a new phase in the request processing lifecycle.
- Overrides:
setCurrentPhaseIdin classFacesContext- Parameters:
currentPhaseId- ThePhaseIdfor the current phase.- See Also:
-
release
public void release()Description copied from class:FacesContextRelease any resources associated with this
FacesContextinstance. Faces implementations may choose to pool instances in the associatedFacesContextFactoryto avoid repeated object creation and garbage collection. Afterrelease()is called on aFacesContextinstance (until theFacesContextinstance has been recycled by the implementation for re-use), calling any other methods will cause anIllegalStateExceptionto be thrown.If a call was made to
FacesContext.getAttributes()during the processing for this request, the implementation must callclear()on theMapreturned fromgetAttributes(), and then de-allocate the data-structure behind thatMap.The implementation must call
FacesContext.setCurrentInstance(jakarta.faces.context.FacesContext)passingnullto remove the association between this thread and this deadFacesContextinstance.- Specified by:
releasein classFacesContext- See Also:
-
renderResponse
public void renderResponse()Description copied from class:FacesContextSignal 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:
renderResponsein classFacesContext- See Also:
-
responseComplete
public void responseComplete()Description copied from class:FacesContextSignal 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:
responseCompletein classFacesContext- See Also:
-
validationFailed
public void validationFailed()Description copied from class:FacesContextSets 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:
validationFailedin classFacesContext- See Also:
-
getRenderResponse
public boolean getRenderResponse()Description copied from class:FacesContextReturn
trueif therenderResponse()method has been called for the current request.- Specified by:
getRenderResponsein classFacesContext- Returns:
- flag indicating whether the
renderResponse()has been called. - See Also:
-
getResourceLibraryContracts
Description copied from class: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.
- Overrides:
getResourceLibraryContractsin classFacesContext- Returns:
- the list of resource library contracts.
-
setResourceLibraryContracts
Description copied from class:FacesContextSet the resource library contracts calculated as valid to use with this view. The implementation must copy the contents of the incoming
Listinto an immutableListfor return fromFacesContext.getResourceLibraryContracts(). If the argument isnullor empty, the action taken is the same as if the argument isnull: a subsequent call togetResourceLibraryContractsreturnsnull. 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:
setResourceLibraryContractsin 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:FacesContextReturn
trueif theresponseComplete()method has been called for the current request.- Specified by:
getResponseCompletein classFacesContext- Returns:
- the boolean indicating whether
responseComplete()method has been called. - See Also:
-
isValidationFailed
public boolean isValidationFailed()Description copied from class:FacesContextReturn
trueif thevalidationFailed()method has been called for the current request.- Overrides:
isValidationFailedin classFacesContext- Returns:
- boolean indicating if the
validationFailed()method has been called for the current request - See Also:
-
getDefaultFacesContext
-