|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.faces.context.FacesContext
FacesContext contains all of the per-request state information related to the processing of a single JavaServer Faces request, and the rendering of the corresponding response. It is passed to, and potentially modified by, each phase of the request processing lifecycle.
A FacesContext
instance is associated with a particular
request at the beginning of request processing, by a call to the
getFacesContext()
method of the FacesContextFactory
instance associated with the current web application. The instance
remains active until its release()
method is called, after
which no further references to this instance are allowed. While a
FacesContext
instance is active, it must not be referenced
from any thread other than the one upon which the servlet container
executing this web application utilizes for the processing of this request.
Constructor Summary | |
FacesContext()
|
Method Summary | |
abstract void |
addMessage(java.lang.String clientId,
javax.faces.application.FacesMessage message)
Append a FacesMessage to the set of messages associated with
the specified client identifier, if clientId is
not null . |
abstract javax.faces.application.Application |
getApplication()
Return the Application instance associated with this
web application. |
abstract java.util.Iterator |
getClientIdsWithMessages()
Return an Iterator over the client identifiers for
which at least one FacesMessage has been queued. |
static javax.faces.context.FacesContext |
getCurrentInstance()
Return the FacesContext instance for the request that is
being processed by the current thread, if any. |
abstract javax.faces.context.ExternalContext |
getExternalContext()
Return the ExternalContext instance for this
FacesContext instance. |
abstract FacesMessage.Severity |
getMaximumSeverity()
Return the maximum severity level recorded on any FacesMessage s that has been queued, whether or not they are
associated with any specific UIComponent . |
abstract java.util.Iterator |
getMessages()
Return an Iterator over the FacesMessage s
that have been queued, whether or not they are associated with any
specific client identifier. |
abstract java.util.Iterator |
getMessages(java.lang.String clientId)
Return an Iterator over the FacesMessage s that
have been queued that are associated with the specified client identifier
(if clientId is not null ), or over the
FacesMessage s that have been queued that are not associated with
any specific client identifier (if clientId is
null ). |
abstract javax.faces.render.RenderKit |
getRenderKit()
Return the RenderKit instance for the render kit identifier
specified on our UIViewRoot , if there is one. |
abstract boolean |
getRenderResponse()
Return true if the renderResponse()
method has been called for the current request. |
abstract boolean |
getResponseComplete()
Return true if the responseComplete()
method has been called for the current request. |
abstract javax.faces.context.ResponseStream |
getResponseStream()
Return the ResponseStream to which components should
direct their binary output. |
abstract javax.faces.context.ResponseWriter |
getResponseWriter()
Return the ResponseWriter to which components should
direct their character-based output. |
abstract javax.faces.component.UIViewRoot |
getViewRoot()
Return the root component that is associated with the this request. |
abstract void |
release()
Release any resources associated with this FacesContext instance. |
abstract void |
renderResponse()
Signal the JavaServer faces implementation that, as soon as the current phase of the request processing lifecycle has been completed, control should be passed to the Render Response phase, bypassing any phases that have not been executed yet. |
abstract void |
responseComplete()
Signal the JavaServer Faces implementation that the HTTP response for this request has already been generated (such as an HTTP redirect), and that the request processing lifecycle should be terminated as soon as the current phase is completed. |
protected static void |
setCurrentInstance(javax.faces.context.FacesContext context)
Set the FacesContext instance for the request that is
being processed by the current thread. |
abstract void |
setResponseStream(javax.faces.context.ResponseStream responseStream)
Set the ResponseStream to which components should
direct their binary output. |
abstract void |
setResponseWriter(javax.faces.context.ResponseWriter responseWriter)
Set the ResponseWriter to which components should
direct their character-based output. |
abstract void |
setViewRoot(javax.faces.component.UIViewRoot root)
Set the root component that is associated with this request. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FacesContext()
Method Detail |
public abstract javax.faces.application.Application getApplication()
Return the Application
instance associated with this
web application.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract java.util.Iterator getClientIdsWithMessages()
Return an Iterator
over the client identifiers for
which at least one FacesMessage
has been queued. If there are no
such client identifiers, an empty Iterator
is returned.
If any messages have been queued that were not associated with any
specific client identifier, a null
value will be included
in the iterated values.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract javax.faces.context.ExternalContext getExternalContext()
Return the ExternalContext
instance for this
FacesContext
instance.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract FacesMessage.Severity getMaximumSeverity()
Return the maximum severity level recorded on any
FacesMessage
s that has been queued, whether or not they are
associated with any specific UIComponent
. If no such messages
have been queued, return null
.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract java.util.Iterator getMessages()
Return an Iterator
over the FacesMessage
s
that have been queued, whether or not they are associated with any
specific client identifier. If no such messages have been queued,
return an empty Iterator
.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract java.util.Iterator getMessages(java.lang.String clientId)
Return an Iterator
over the FacesMessage
s that
have been queued that are associated with the specified client identifier
(if clientId
is not null
), or over the
FacesMessage
s that have been queued that are not associated with
any specific client identifier (if clientId
is
null
). If no such messages have been queued, return an
empty Iterator
.
clientId
- The client identifier for which messages are
requested, or null
for messages not associated with
any client identifier
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract javax.faces.render.RenderKit getRenderKit()
Return the RenderKit
instance for the render kit identifier
specified on our UIViewRoot
, if there is one. If there is no
current UIViewRoot
, if the UIViewRoot
does not have a
specified renderKitId
, or if there is no RenderKit
for the specified identifier, return null
instead.
public abstract boolean getRenderResponse()
Return true
if the renderResponse()
method has been called for the current request.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract boolean getResponseComplete()
Return true
if the responseComplete()
method has been called for the current request.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract javax.faces.context.ResponseStream getResponseStream()
Return the ResponseStream
to which components should
direct their binary output. Within a given response, components
can use either the ResponseStream or the ResponseWriter,
but not both.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract void setResponseStream(javax.faces.context.ResponseStream responseStream)
Set the ResponseStream
to which components should
direct their binary output.
responseStream
- The new ResponseStream for this response
java.lang.NullPointerException
- if responseStream
is null
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract javax.faces.context.ResponseWriter getResponseWriter()
Return the ResponseWriter
to which components should
direct their character-based output. Within a given response,
components can use either the ResponseStream or the ResponseWriter,
but not both.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract void setResponseWriter(javax.faces.context.ResponseWriter responseWriter)
Set the ResponseWriter
to which components should
direct their character-based output.
responseWriter
- The new ResponseWriter for this response
java.lang.IllegalStateException
- if this method is called after
this instance has been released
java.lang.NullPointerException
- if responseWriter
is null
public abstract javax.faces.component.UIViewRoot getViewRoot()
Return the root component that is associated with the this request.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract void setViewRoot(javax.faces.component.UIViewRoot root)
Set the root component that is associated with this request. This method can only be called by the application handler (or a class that the handler calls), and only during the Invoke Application phase of the request processing lifecycle.
root
- The new component UIViewRoot
component
java.lang.IllegalStateException
- if this method is called after
this instance has been released
java.lang.NullPointerException
- if root
is null
public abstract void addMessage(java.lang.String clientId, javax.faces.application.FacesMessage message)
Append a FacesMessage
to the set of messages associated with
the specified client identifier, if clientId
is
not null
. If clientId
is null
,
this FacesMessage
is assumed to not be associated with any
specific component instance.
clientId
- The client identifier with which this message is
associated (if any)message
- The message to be appended
java.lang.IllegalStateException
- if this method is called after
this instance has been released
java.lang.NullPointerException
- if message
is null
public abstract void release()
Release any resources associated with this
FacesContext
instance. Faces implementations may
choose to pool instances in the associated FacesContextFactory
to avoid repeated object creation and
garbage collection. After release()
is called on a
FacesContext
instance (until the
FacesContext
instance has been recycled by the
implementation for re-use), calling any other methods will cause
an IllegalStateException
to be thrown.
The implementation must call setCurrentInstance(javax.faces.context.FacesContext)
passing null
to remove the association between this
thread and this dead FacesContext
instance.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract void renderResponse()
Signal the JavaServer faces implementation that, as soon as the current phase of the request processing lifecycle has been completed, control should be passed to the Render Response phase, bypassing any phases that have not been executed yet.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic abstract void responseComplete()
Signal the JavaServer Faces implementation that the HTTP response for this request has already been generated (such as an HTTP redirect), and that the request processing lifecycle should be terminated as soon as the current phase is completed.
java.lang.IllegalStateException
- if this method is called after
this instance has been releasedpublic static javax.faces.context.FacesContext getCurrentInstance()
Return the FacesContext
instance for the request that is
being processed by the current thread, if any.
protected static void setCurrentInstance(javax.faces.context.FacesContext context)
Set the FacesContext
instance for the request that is
being processed by the current thread.
context
- The FacesContext
instance for the current
thread, or null
if this thread no longer has a
FacesContext
instance.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |