javax.faces.context
Class FacesContextWrapper

java.lang.Object
  extended by javax.faces.context.FacesContext
      extended by javax.faces.context.FacesContextWrapper
All Implemented Interfaces:
FacesWrapper<FacesContext>

public abstract class FacesContextWrapper
extends FacesContext
implements FacesWrapper<FacesContext>

Since:
2.0
Version:
$Revision: 1187700 $ $Date: 2011-10-22 07:19:37 -0500 (Sat, 22 Oct 2011) $
Author:
Simon Lessard (latest modification by $Author: bommel $)

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

Constructor Detail

FacesContextWrapper

public FacesContextWrapper()
Method Detail

addMessage

public void addMessage(String clientId,
                       FacesMessage message)
Specified by:
addMessage in class FacesContext

getApplication

public Application getApplication()
Specified by:
getApplication in class FacesContext

getAttributes

public Map<Object,Object> getAttributes()
Overrides:
getAttributes in class FacesContext
Returns:

getClientIdsWithMessages

public Iterator<String> getClientIdsWithMessages()
Specified by:
getClientIdsWithMessages in class FacesContext

getCurrentPhaseId

public PhaseId getCurrentPhaseId()
Overrides:
getCurrentPhaseId in class FacesContext
Returns:

getELContext

public javax.el.ELContext getELContext()
Description copied from class: FacesContext
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.

Overrides:
getELContext in class FacesContext

getExceptionHandler

public ExceptionHandler getExceptionHandler()
Overrides:
getExceptionHandler in class FacesContext
Returns:

getExternalContext

public ExternalContext getExternalContext()
Specified by:
getExternalContext in class FacesContext

getMaximumSeverity

public FacesMessage.Severity getMaximumSeverity()
Specified by:
getMaximumSeverity in class FacesContext

getMessageList

public List<FacesMessage> getMessageList()
Overrides:
getMessageList in class FacesContext
Returns:

getMessageList

public List<FacesMessage> getMessageList(String clientId)
Overrides:
getMessageList in class FacesContext
Returns:

getMessages

public Iterator<FacesMessage> getMessages()
Specified by:
getMessages in class FacesContext

getMessages

public Iterator<FacesMessage> getMessages(String clientId)
Specified by:
getMessages in class FacesContext

getPartialViewContext

public PartialViewContext getPartialViewContext()
Description copied from class: FacesContext

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.

Overrides:
getPartialViewContext in class FacesContext
Returns:
The PartialViewContext

getRenderKit

public RenderKit getRenderKit()
Specified by:
getRenderKit in class FacesContext

getRenderResponse

public boolean getRenderResponse()
Specified by:
getRenderResponse in class FacesContext

getResponseComplete

public boolean getResponseComplete()
Specified by:
getResponseComplete in class FacesContext

getResponseStream

public ResponseStream getResponseStream()
Specified by:
getResponseStream in class FacesContext

getResponseWriter

public ResponseWriter getResponseWriter()
Specified by:
getResponseWriter in class FacesContext

isValidationFailed

public boolean isValidationFailed()
Overrides:
isValidationFailed in class FacesContext
Returns:

getViewRoot

public UIViewRoot getViewRoot()
Specified by:
getViewRoot in class FacesContext

getWrapped

public abstract FacesContext getWrapped()
Description copied from interface: FacesWrapper
A class that implements this interface uses this method to return an instance of the class being wrapped.

Specified by:
getWrapped in interface FacesWrapper<FacesContext>
Returns:
the instance of the class being wrapped

isPostback

public boolean isPostback()
Overrides:
isPostback in class FacesContext
Returns:

isProcessingEvents

public boolean isProcessingEvents()
Overrides:
isProcessingEvents in class FacesContext
Returns:

release

public void release()
Specified by:
release in class FacesContext

renderResponse

public void renderResponse()
Specified by:
renderResponse in class FacesContext

responseComplete

public void responseComplete()
Specified by:
responseComplete in class FacesContext

setCurrentPhaseId

public void setCurrentPhaseId(PhaseId currentPhaseId)
Overrides:
setCurrentPhaseId in class FacesContext

setExceptionHandler

public void setExceptionHandler(ExceptionHandler exceptionHandler)
Overrides:
setExceptionHandler in class FacesContext

setProcessingEvents

public void setProcessingEvents(boolean processingEvents)
Overrides:
setProcessingEvents in class FacesContext

setResponseStream

public void setResponseStream(ResponseStream responseStream)
Specified by:
setResponseStream in class FacesContext

setResponseWriter

public void setResponseWriter(ResponseWriter responseWriter)
Specified by:
setResponseWriter in class FacesContext

setViewRoot

public void setViewRoot(UIViewRoot root)
Specified by:
setViewRoot in class FacesContext

validationFailed

public void validationFailed()
Overrides:
validationFailed in class FacesContext

isProjectStage

public boolean isProjectStage(ProjectStage stage)
Overrides:
isProjectStage in class FacesContext


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