Class FacesContext
- Direct Known Subclasses:
FacesContextWrapper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
addMessage
(String clientId, FacesMessage message) abstract Application
static FacesContext
jakarta.el.ELContext
Return the context within which all EL-expressions are evaluated.abstract ExternalContext
abstract Lifecycle
abstract FacesMessage.Severity
getMessageList
(String clientId) abstract Iterator<FacesMessage>
abstract Iterator<FacesMessage>
getMessages
(String clientId) char
Return the PartialViewContext for this request.abstract RenderKit
abstract boolean
abstract boolean
abstract ResponseStream
abstract ResponseWriter
abstract UIViewRoot
boolean
boolean
boolean
isProjectStage
(ProjectStage stage) boolean
boolean
abstract void
release()
abstract void
abstract void
protected static void
setCurrentInstance
(FacesContext context) void
setCurrentPhaseId
(PhaseId currentPhaseId) void
setExceptionHandler
(ExceptionHandler exceptionHandler) void
setProcessingEvents
(boolean processingEvents) void
setResourceLibraryContracts
(List<String> contracts) abstract void
setResponseStream
(ResponseStream responseStream) abstract void
setResponseWriter
(ResponseWriter responseWriter) abstract void
setViewRoot
(UIViewRoot root) void
-
Constructor Details
-
FacesContext
public FacesContext()
-
-
Method Details
-
addMessage
-
getApplication
-
getAttributes
- Returns:
- Since:
- 2.0
-
getClientIdsWithMessages
-
getCurrentInstance
-
getCurrentPhaseId
- Returns:
- Since:
- 2.0
-
getELContext
public jakarta.el.ELContext getELContext()Return the context within which all EL-expressions are evaluated.A Faces implementation is expected to provide a full implementation of this class. However Faces also explicitly allows user code to apply the "decorator" pattern to this type, by overriding the FacesContextFactory class. In that pattern, the decorating class has a reference to an "underlying" implementation and forward calls to it, possibly after taking other related actions.
The decorator pattern does have difficulties with backwards-compatibility when new methods are added to the class being decorated, as with this method which was added in Faces1.2. Decorator classes that were written for Faces1.1 will subclass this class, but will not override this method to pass the call on to the "underlying" instance. This base implementation therefore must do that for it.
Unfortunately the Faces designers stuffed up the design; this base class has no way of knowing what the "underlying" instance is! The current implementation here is therefore to delegate directly to the very first FacesContext instance registered within this request (via setCurrentInstance). This instance should be the "full" implementation provided by the Faces framework. The drawback is that when any decorator class is present which defaults to this base implementation, then any following decorator instances that do override this method do not get it invoked.
It is believed that the Sun Faces implementation (Mojarra) does something similar.
- Since:
- 1.2
-
getExceptionHandler
- Returns:
- Since:
- 2.0
-
getExternalContext
-
getMaximumSeverity
-
getMessageList
- Returns:
- Since:
- 2.0
-
getMessageList
- Parameters:
clientId
-- Returns:
- Since:
- 2.0
-
getMessages
-
getMessages
-
getPartialViewContext
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.
- Returns:
- The PartialViewContext
- Throws:
IllegalStateException
- if this method is called after this instance has been released- Since:
- 2.0
-
getRenderKit
-
getRenderResponse
public abstract boolean getRenderResponse() -
getResponseComplete
public abstract boolean getResponseComplete() -
getResponseStream
-
getResponseWriter
-
isValidationFailed
public boolean isValidationFailed()- Returns:
- Since:
- 2.0
-
getViewRoot
-
isPostback
public boolean isPostback()- Returns:
- Since:
- 2.0
-
isProcessingEvents
public boolean isProcessingEvents()- Returns:
- Since:
- 2.0
-
release
public abstract void release() -
renderResponse
public abstract void renderResponse() -
responseComplete
public abstract void responseComplete() -
setCurrentInstance
-
setCurrentPhaseId
- Parameters:
currentPhaseId
-- Since:
- 2.0
-
setExceptionHandler
- Parameters:
exceptionHandler
-- Since:
- 2.0
-
setProcessingEvents
public void setProcessingEvents(boolean processingEvents) - Parameters:
processingEvents
-- Since:
- 2.0
-
setResponseStream
-
setResponseWriter
-
setViewRoot
-
validationFailed
public void validationFailed()- Since:
- 2.0
-
isProjectStage
-
isReleased
public boolean isReleased()- Returns:
- Since:
- 2.1
-
getResourceLibraryContracts
- Returns:
- Since:
- 2.2
-
setResourceLibraryContracts
- Parameters:
contracts
-- Since:
- 2.2
-
getNamingContainerSeparatorChar
public char getNamingContainerSeparatorChar()- Returns:
- Since:
- 2.2
-
getLifecycle
- Returns:
- the current Lifecycle
- Since:
- 4.0
-