javax.faces.context
Class FacesContext

java.lang.Object
  extended by javax.faces.context.FacesContext

public abstract class FacesContext
extends Object

see Javadoc of JSF Specification

Version:
$Revision: 676298 $ $Date: 2008-07-13 05:31:48 -0500 (Sun, 13 Jul 2008) $
Author:
Manfred Geiler (latest modification by $Author: skitching $)

Constructor Summary
FacesContext()
           
 
Method Summary
abstract  void addMessage(String clientId, FacesMessage message)
           
abstract  Application getApplication()
           
abstract  Iterator<String> getClientIdsWithMessages()
           
static FacesContext getCurrentInstance()
           
 javax.el.ELContext getELContext()
          Return the context within which all EL-expressions are evaluated.
abstract  ExternalContext getExternalContext()
           
abstract  FacesMessage.Severity getMaximumSeverity()
           
abstract  Iterator<FacesMessage> getMessages()
           
abstract  Iterator<FacesMessage> getMessages(String clientId)
           
abstract  RenderKit getRenderKit()
           
abstract  boolean getRenderResponse()
           
abstract  boolean getResponseComplete()
           
abstract  ResponseStream getResponseStream()
           
abstract  ResponseWriter getResponseWriter()
           
abstract  UIViewRoot getViewRoot()
           
abstract  void release()
           
abstract  void renderResponse()
           
abstract  void responseComplete()
           
protected static void setCurrentInstance(FacesContext context)
           
abstract  void setResponseStream(ResponseStream responseStream)
           
abstract  void setResponseWriter(ResponseWriter responseWriter)
           
abstract  void setViewRoot(UIViewRoot root)
           
 
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

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

getApplication

public abstract Application getApplication()

getClientIdsWithMessages

public abstract Iterator<String> getClientIdsWithMessages()

getExternalContext

public abstract ExternalContext getExternalContext()

getMaximumSeverity

public abstract FacesMessage.Severity getMaximumSeverity()

getMessages

public abstract Iterator<FacesMessage> getMessages()

getMessages

public abstract Iterator<FacesMessage> getMessages(String clientId)

getRenderKit

public abstract RenderKit getRenderKit()

getRenderResponse

public abstract boolean getRenderResponse()

getResponseComplete

public abstract boolean getResponseComplete()

getResponseStream

public abstract ResponseStream getResponseStream()

setResponseStream

public abstract void setResponseStream(ResponseStream responseStream)

getResponseWriter

public abstract ResponseWriter getResponseWriter()

setResponseWriter

public abstract void setResponseWriter(ResponseWriter responseWriter)

getViewRoot

public abstract UIViewRoot getViewRoot()

setViewRoot

public abstract void setViewRoot(UIViewRoot root)

addMessage

public abstract void addMessage(String clientId,
                                FacesMessage message)

release

public abstract void release()

renderResponse

public abstract void renderResponse()

responseComplete

public abstract void responseComplete()

getCurrentInstance

public static FacesContext getCurrentInstance()

setCurrentInstance

protected static void setCurrentInstance(FacesContext context)


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