Class FacesContext
- java.lang.Object
-
- jakarta.faces.context.FacesContext
-
- Direct Known Subclasses:
FacesContextWrapper
public abstract class FacesContext extends Object
see Javadoc of JSF Specification
-
-
Constructor Summary
Constructors Constructor Description FacesContext()
-
Method Summary
-
-
-
Method Detail
-
addMessage
public abstract void addMessage(String clientId, FacesMessage message)
-
getApplication
public abstract Application getApplication()
-
getCurrentInstance
public static FacesContext getCurrentInstance()
-
getCurrentPhaseId
public PhaseId getCurrentPhaseId()
- Returns:
- Since:
- 2.0
-
getELContext
public jakarta.el.ELContext getELContext()
Return the context within which all EL-expressions are evaluated.A JSF implementation is expected to provide a full implementation of this class. However JSF 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 JSF1.2. Decorator classes that were written for JSF1.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 JSF 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 JSF 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 JSF implementation (Mojarra) does something similar.
- Since:
- 1.2
-
getExceptionHandler
public ExceptionHandler getExceptionHandler()
- Returns:
- Since:
- 2.0
-
getExternalContext
public abstract ExternalContext getExternalContext()
-
getMaximumSeverity
public abstract FacesMessage.Severity getMaximumSeverity()
-
getMessageList
public List<FacesMessage> getMessageList()
- Returns:
- Since:
- 2.0
-
getMessageList
public List<FacesMessage> getMessageList(String clientId)
- Parameters:
clientId
-- Returns:
- Since:
- 2.0
-
getMessages
public abstract Iterator<FacesMessage> getMessages()
-
getMessages
public abstract Iterator<FacesMessage> getMessages(String clientId)
-
getPartialViewContext
public PartialViewContext 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
public abstract RenderKit getRenderKit()
-
getRenderResponse
public abstract boolean getRenderResponse()
-
getResponseComplete
public abstract boolean getResponseComplete()
-
getResponseStream
public abstract ResponseStream getResponseStream()
-
getResponseWriter
public abstract ResponseWriter getResponseWriter()
-
isValidationFailed
public boolean isValidationFailed()
- Returns:
- Since:
- 2.0
-
getViewRoot
public abstract UIViewRoot 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
protected static void setCurrentInstance(FacesContext context)
-
setCurrentPhaseId
public void setCurrentPhaseId(PhaseId currentPhaseId)
- Parameters:
currentPhaseId
-- Since:
- 2.0
-
setExceptionHandler
public void setExceptionHandler(ExceptionHandler exceptionHandler)
- Parameters:
exceptionHandler
-- Since:
- 2.0
-
setProcessingEvents
public void setProcessingEvents(boolean processingEvents)
- Parameters:
processingEvents
-- Since:
- 2.0
-
setResponseStream
public abstract void setResponseStream(ResponseStream responseStream)
-
setResponseWriter
public abstract void setResponseWriter(ResponseWriter responseWriter)
-
setViewRoot
public abstract void setViewRoot(UIViewRoot root)
-
validationFailed
public void validationFailed()
- Since:
- 2.0
-
isProjectStage
public boolean isProjectStage(ProjectStage stage)
-
isReleased
public boolean isReleased()
- Returns:
- Since:
- 2.1
-
setResourceLibraryContracts
public void setResourceLibraryContracts(List<String> contracts)
- Parameters:
contracts
-- Since:
- 2.2
-
getNamingContainerSeparatorChar
public char getNamingContainerSeparatorChar()
- Returns:
- Since:
- 2.2
-
getLifecycle
public abstract Lifecycle getLifecycle()
- Returns:
- the current Lifecycle
- Since:
- 4.0
-
-