javax.faces.context
Class FacesContext

java.lang.Object
  extended by javax.faces.context.FacesContext
Direct Known Subclasses:
FacesContextWrapper

public abstract class FacesContext
extends Object

see Javadoc of JSF Specification

Version:
$Revision: 1188565 $ $Date: 2011-10-25 03:38:53 -0500 (Tue, 25 Oct 2011) $
Author:
Manfred Geiler (latest modification by $Author: struberg $)

Constructor Summary
FacesContext()
           
 
Method Summary
abstract  void addMessage(String clientId, FacesMessage message)
           
abstract  Application getApplication()
           
 Map<Object,Object> getAttributes()
           
abstract  Iterator<String> getClientIdsWithMessages()
           
static FacesContext getCurrentInstance()
           
 PhaseId getCurrentPhaseId()
           
 javax.el.ELContext getELContext()
          Return the context within which all EL-expressions are evaluated.
 ExceptionHandler getExceptionHandler()
           
abstract  ExternalContext getExternalContext()
           
abstract  FacesMessage.Severity getMaximumSeverity()
           
 List<FacesMessage> getMessageList()
           
 List<FacesMessage> getMessageList(String clientId)
           
abstract  Iterator<FacesMessage> getMessages()
           
abstract  Iterator<FacesMessage> getMessages(String clientId)
           
 PartialViewContext getPartialViewContext()
           Return the PartialViewContext for this request.
abstract  RenderKit getRenderKit()
           
abstract  boolean getRenderResponse()
           
abstract  boolean getResponseComplete()
           
abstract  ResponseStream getResponseStream()
           
abstract  ResponseWriter getResponseWriter()
           
abstract  UIViewRoot getViewRoot()
           
 boolean isPostback()
           
 boolean isProcessingEvents()
           
 boolean isProjectStage(ProjectStage stage)
           
 boolean isReleased()
           
 boolean isValidationFailed()
           
abstract  void release()
           
abstract  void renderResponse()
           
abstract  void responseComplete()
           
protected static void setCurrentInstance(FacesContext context)
           
 void setCurrentPhaseId(PhaseId currentPhaseId)
           
 void setExceptionHandler(ExceptionHandler exceptionHandler)
           
 void setProcessingEvents(boolean processingEvents)
           
abstract  void setResponseStream(ResponseStream responseStream)
           
abstract  void setResponseWriter(ResponseWriter responseWriter)
           
abstract  void setViewRoot(UIViewRoot root)
           
 void validationFailed()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FacesContext

public FacesContext()
Method Detail

addMessage

public abstract void addMessage(String clientId,
                                FacesMessage message)

getApplication

public abstract Application getApplication()

getAttributes

public Map<Object,Object> getAttributes()
Returns:
Since:
2.0

getClientIdsWithMessages

public abstract Iterator<String> getClientIdsWithMessages()

getCurrentInstance

public static FacesContext getCurrentInstance()

getCurrentPhaseId

public PhaseId getCurrentPhaseId()
Returns:
Since:
2.0

getELContext

public javax.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)
Since:
2.0

setExceptionHandler

public void setExceptionHandler(ExceptionHandler 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


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.