Class FacesContextWrapper
- All Implemented Interfaces:
FacesWrapper<FacesContext>
Provides a simple implementation
of FacesContext that can be subclassed by developers wishing to provide specialized behavior to an existing
FacesContext instance. The default implementation of all methods is to call through to the wrapped
FacesContext instance.
Usage: extend this class and push the implementation being wrapped to the constructor and use getWrapped() to
access the instance being wrapped.
- Since:
- 2.0
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Use the other constructor taking the implementation being wrapped.FacesContextWrapper(FacesContext wrapped) If this faces context has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(String clientId, FacesMessage message) The default behavior of this method is to callFacesContext.addMessage(String, FacesMessage)on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getApplication()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getAttributes()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getClientIdsWithMessages()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getCurrentPhaseId()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getELContext()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getExceptionHandler()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getExternalContext()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getMaximumSeverity()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getMessageList()on the wrappedFacesContextobject.getMessageList(String clientId) The default behavior of this method is to callFacesContext.getMessageList(String)on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getMessages()on the wrappedFacesContextobject.getMessages(String clientId) The default behavior of this method is to callFacesContext.getMessages(String)on the wrappedFacesContextobject.charThe default behavior of this method is to callFacesContext.getNamingContainerSeparatorChar()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getPartialViewContext()()} on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getRenderKit()on the wrappedFacesContextobject.booleanThe default behavior of this method is to callFacesContext.getRenderResponse()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getResourceLibraryContracts()on the wrappedFacesContextobject.booleanThe default behavior of this method is to callFacesContext.getResponseComplete()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getResponseStream()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getResponseWriter()on the wrappedFacesContextobject.The default behavior of this method is to callFacesContext.getViewRoot()on the wrappedFacesContextobject.A class that implements this interface uses this method to return an instance of the class being wrapped.booleanThe default behavior of this method is to callFacesContext.isPostback()on the wrappedFacesContextobject.booleanThe default behavior of this method is to callFacesContext.isProcessingEvents()on the wrappedFacesContextobject.booleanisProjectStage(ProjectStage stage) The default behavior of this method is to callFacesContext.isProjectStage(jakarta.faces.application.ProjectStage)on the wrappedFacesContextobject.booleanThe default behavior of this method is to callFacesContext.isReleased()on the wrappedFacesContextobject.booleanThe default behavior of this method is to callFacesContext.isValidationFailed()on the wrappedFacesContextobject.voidrelease()The default behavior of this method is to callFacesContext.release()on the wrappedFacesContextobject.voidThe default behavior of this method is to callFacesContext.renderResponse()on the wrappedFacesContextobject.voidThe default behavior of this method is to callFacesContext.responseComplete()on the wrappedFacesContextobject.voidsetCurrentPhaseId(PhaseId currentPhaseId) The default behavior of this method is to callFacesContext.setCurrentPhaseId(PhaseId)on the wrappedFacesContextobject.voidsetExceptionHandler(ExceptionHandler exceptionHandler) The default behavior of this method is to callFacesContext.setExceptionHandler(ExceptionHandler)on the wrappedFacesContextobject.voidsetProcessingEvents(boolean processingEvents) The default behavior of this method is to callFacesContext.setProcessingEvents(boolean)on the wrappedFacesContextobject.voidsetResourceLibraryContracts(List<String> contracts) The default behavior of this method is to callFacesContext.setResourceLibraryContracts(java.util.List<java.lang.String>)on the wrappedFacesContextobject.voidsetResponseStream(ResponseStream responseStream) The default behavior of this method is to callFacesContext.setResponseStream(ResponseStream)on the wrappedFacesContextobject.voidsetResponseWriter(ResponseWriter responseWriter) The default behavior of this method is to callFacesContext.setResponseWriter(ResponseWriter)on the wrappedFacesContextobject.voidsetViewRoot(UIViewRoot root) The default behavior of this method is to callFacesContext.setViewRoot(UIViewRoot)on the wrappedFacesContextobject.voidThe default behavior of this method is to callFacesContext.validationFailed()on the wrappedFacesContextobject.Methods inherited from class jakarta.faces.context.FacesContext
getCurrentInstance, setCurrentInstance
-
Constructor Details
-
FacesContextWrapper
Deprecated.Use the other constructor taking the implementation being wrapped. -
FacesContextWrapper
If this faces context has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor. The
getWrapped()will then return the implementation being wrapped.- Parameters:
wrapped- The implementation being wrapped.- Since:
- 2.3
-
-
Method Details
-
getWrapped
Description copied from interface:FacesWrapperA class that implements this interface uses this method to return an instance of the class being wrapped.
- Specified by:
getWrappedin interfaceFacesWrapper<FacesContext>- Returns:
- the wrapped instance.
-
getApplication
The default behavior of this method is to call
FacesContext.getApplication()on the wrappedFacesContextobject.- Specified by:
getApplicationin classFacesContext- Returns:
- the
Applicationinstance associated with this web application. - See Also:
-
getClientIdsWithMessages
The default behavior of this method is to call
FacesContext.getClientIdsWithMessages()on the wrappedFacesContextobject.- Specified by:
getClientIdsWithMessagesin classFacesContext- Returns:
- the
Iteratorover the client identifiers for which at least oneFacesMessagehas been queued. - See Also:
-
getExternalContext
The default behavior of this method is to call
FacesContext.getExternalContext()on the wrappedFacesContextobject.- Specified by:
getExternalContextin classFacesContext- Returns:
- instance of
ExternalContext - See Also:
-
getMaximumSeverity
The default behavior of this method is to call
FacesContext.getMaximumSeverity()on the wrappedFacesContextobject.- Specified by:
getMaximumSeverityin classFacesContext- Returns:
- the maximum severity level.
- See Also:
-
getMessages
The default behavior of this method is to call
FacesContext.getMessages()on the wrappedFacesContextobject.- Specified by:
getMessagesin classFacesContext- Returns:
Iteratorover theFacesMessages that have been queued.- See Also:
-
getMessages
The default behavior of this method is to call
FacesContext.getMessages(String)on the wrappedFacesContextobject.- 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
The default behavior of this method is to call
FacesContext.getRenderKit()on the wrappedFacesContextobject.- Specified by:
getRenderKitin classFacesContext- Returns:
- instance of
RenderKitassociated with theUIViewRoot. - See Also:
-
getRenderResponse
public boolean getRenderResponse()The default behavior of this method is to call
FacesContext.getRenderResponse()on the wrappedFacesContextobject.- Specified by:
getRenderResponsein classFacesContext- Returns:
- flag indicating whether the
renderResponse()has been called. - See Also:
-
getResourceLibraryContracts
The default behavior of this method is to call
FacesContext.getResourceLibraryContracts()on the wrappedFacesContextobject.- Overrides:
getResourceLibraryContractsin classFacesContext- Returns:
- the list of resource library contracts.
- See Also:
-
setResourceLibraryContracts
The default behavior of this method is to call
FacesContext.setResourceLibraryContracts(java.util.List<java.lang.String>)on the wrappedFacesContextobject.- Overrides:
setResourceLibraryContractsin classFacesContext- Parameters:
contracts- The new contracts to be returned, as an immutableList. from a subsequent call toFacesContext.getResourceLibraryContracts().- See Also:
-
getResponseComplete
public boolean getResponseComplete()The default behavior of this method is to call
FacesContext.getResponseComplete()on the wrappedFacesContextobject.- Specified by:
getResponseCompletein classFacesContext- Returns:
- the boolean indicating whether
responseComplete()method has been called. - See Also:
-
getResponseStream
The default behavior of this method is to call
FacesContext.getResponseStream()on the wrappedFacesContextobject.- Specified by:
getResponseStreamin classFacesContext- Returns:
ResponseStreaminstance.- See Also:
-
setResponseStream
The default behavior of this method is to call
FacesContext.setResponseStream(ResponseStream)on the wrappedFacesContextobject.- Specified by:
setResponseStreamin classFacesContext- Parameters:
responseStream- The new ResponseStream for this response- See Also:
-
getResponseWriter
The default behavior of this method is to call
FacesContext.getResponseWriter()on the wrappedFacesContextobject.- Specified by:
getResponseWriterin classFacesContext- Returns:
ResponseWriterinstance.- See Also:
-
setResponseWriter
The default behavior of this method is to call
FacesContext.setResponseWriter(ResponseWriter)on the wrappedFacesContextobject.- Specified by:
setResponseWriterin classFacesContext- Parameters:
responseWriter- The new ResponseWriter for this response- See Also:
-
getViewRoot
The default behavior of this method is to call
FacesContext.getViewRoot()on the wrappedFacesContextobject.- Specified by:
getViewRootin classFacesContext- Returns:
UIViewRootinstance.- See Also:
-
setViewRoot
The default behavior of this method is to call
FacesContext.setViewRoot(UIViewRoot)on the wrappedFacesContextobject.- Specified by:
setViewRootin classFacesContext- Parameters:
root- The new componentUIViewRootcomponent- See Also:
-
addMessage
The default behavior of this method is to call
FacesContext.addMessage(String, FacesMessage)on the wrappedFacesContextobject.- 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:
-
isReleased
public boolean isReleased()The default behavior of this method is to call
FacesContext.isReleased()on the wrappedFacesContextobject.- Overrides:
isReleasedin classFacesContext- Returns:
trueif the resources have been released.- Since:
- 2.1
- See Also:
-
release
public void release()The default behavior of this method is to call
FacesContext.release()on the wrappedFacesContextobject.- Specified by:
releasein classFacesContext- See Also:
-
renderResponse
public void renderResponse()The default behavior of this method is to call
FacesContext.renderResponse()on the wrappedFacesContextobject.- Specified by:
renderResponsein classFacesContext- See Also:
-
responseComplete
public void responseComplete()The default behavior of this method is to call
FacesContext.responseComplete()on the wrappedFacesContextobject.- Specified by:
responseCompletein classFacesContext- See Also:
-
getAttributes
The default behavior of this method is to call
FacesContext.getAttributes()on the wrappedFacesContextobject.- Overrides:
getAttributesin classFacesContext- Returns:
- mutable
Maprepresenting the attributes associated wth thisFacesContextinstance. - See Also:
-
getNamingContainerSeparatorChar
public char getNamingContainerSeparatorChar()The default behavior of this method is to call
FacesContext.getNamingContainerSeparatorChar()on the wrappedFacesContextobject.- Overrides:
getNamingContainerSeparatorCharin classFacesContext- Returns:
- the separator char.
- See Also:
-
getPartialViewContext
The default behavior of this method is to call
FacesContext.getPartialViewContext()()} on the wrappedFacesContextobject.- Overrides:
getPartialViewContextin classFacesContext- Returns:
- the instance of
PartialViewContextfor this request. - See Also:
-
getELContext
The default behavior of this method is to call
FacesContext.getELContext()on the wrappedFacesContextobject.- Overrides:
getELContextin classFacesContext- Returns:
- instance of
ELContext. - See Also:
-
getExceptionHandler
The default behavior of this method is to call
FacesContext.getExceptionHandler()on the wrappedFacesContextobject.- Overrides:
getExceptionHandlerin classFacesContext- Returns:
- instance of
ExceptionHandler. - See Also:
-
setExceptionHandler
The default behavior of this method is to call
FacesContext.setExceptionHandler(ExceptionHandler)on the wrappedFacesContextobject.- Overrides:
setExceptionHandlerin classFacesContext- Parameters:
exceptionHandler- theExceptionHandlerfor this request.- See Also:
-
getMessageList
The default behavior of this method is to call
FacesContext.getMessageList()on the wrappedFacesContextobject.- Overrides:
getMessageListin classFacesContext- Returns:
- an immutable
Listwhich is effectively a snapshot of the messages present at the time of invocation. - See Also:
-
getMessageList
The default behavior of this method is to call
FacesContext.getMessageList(String)on the wrappedFacesContextobject.- 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:
-
isPostback
public boolean isPostback()The default behavior of this method is to call
FacesContext.isPostback()on the wrappedFacesContextobject.- Overrides:
isPostbackin classFacesContext- Returns:
- the boolean indicating whether this request is a post one.
- See Also:
-
getCurrentPhaseId
The default behavior of this method is to call
FacesContext.getCurrentPhaseId()on the wrappedFacesContextobject.- Overrides:
getCurrentPhaseIdin classFacesContext- Returns:
- the current phase id.
- See Also:
-
setCurrentPhaseId
The default behavior of this method is to call
FacesContext.setCurrentPhaseId(PhaseId)on the wrappedFacesContextobject.- Overrides:
setCurrentPhaseIdin classFacesContext- Parameters:
currentPhaseId- ThePhaseIdfor the current phase.- See Also:
-
isValidationFailed
public boolean isValidationFailed()The default behavior of this method is to call
FacesContext.isValidationFailed()on the wrappedFacesContextobject.- Overrides:
isValidationFailedin classFacesContext- Returns:
- boolean indicating if the
validationFailed()method has been called for the current request - See Also:
-
validationFailed
public void validationFailed()The default behavior of this method is to call
FacesContext.validationFailed()on the wrappedFacesContextobject.- Overrides:
validationFailedin classFacesContext- See Also:
-
setProcessingEvents
public void setProcessingEvents(boolean processingEvents) The default behavior of this method is to call
FacesContext.setProcessingEvents(boolean)on the wrappedFacesContextobject.- Overrides:
setProcessingEventsin classFacesContext- Parameters:
processingEvents- flag indicating events should be processed or not- See Also:
-
isProcessingEvents
public boolean isProcessingEvents()The default behavior of this method is to call
FacesContext.isProcessingEvents()on the wrappedFacesContextobject.- Overrides:
isProcessingEventsin classFacesContext- Returns:
trueif events should be published, otherwisefalse- See Also:
-
isProjectStage
The default behavior of this method is to call
FacesContext.isProjectStage(jakarta.faces.application.ProjectStage)on the wrappedFacesContextobject.- Overrides:
isProjectStagein classFacesContext- Parameters:
stage- theProjectStageto check- Returns:
- boolean indicating whether the application has the same stage.
- See Also:
-