|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
javax.faces.context Class FacesContext
java.lang.Object javax.faces.context.FacesContext
public abstract class FacesContext
- extends Object
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.
构造器摘要 | |
---|---|
FacesContext()
|
方法摘要 | |
---|---|
abstract void |
addMessage(String clientId,
FacesMessage message)
Append a FacesMessage to the set of messages associated with
the specified client identifier, if clientId is
not null . |
abstract Application |
getApplication()
Return the Application instance associated with this
web application. |
abstract Iterator<String> |
getClientIdsWithMessages()
Return an Iterator over the client identifiers for
which at least one FacesMessage has been queued. |
static FacesContext |
getCurrentInstance()
Return the FacesContext instance for the request that is
being processed by the current thread, if any. |
ELContext |
getELContext()
Return the ELContext instance for this
FacesContext instance. |
abstract 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 Iterator<FacesMessage> |
getMessages()
Return an Iterator over the FacesMessage s
that have been queued, whether or not they are associated with any
specific client identifier. |
abstract Iterator<FacesMessage> |
getMessages(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 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 ResponseStream |
getResponseStream()
Return the ResponseStream to which components should
direct their binary output. |
abstract ResponseWriter |
getResponseWriter()
Return the ResponseWriter to which components should
direct their character-based output. |
abstract 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(FacesContext context)
Set the FacesContext instance for the request that is
being processed by the current thread. |
abstract void |
setResponseStream(ResponseStream responseStream)
Set the ResponseStream to which components should
direct their binary output. |
abstract void |
setResponseWriter(ResponseWriter responseWriter)
Set the ResponseWriter to which components should
direct their character-based output. |
abstract void |
setViewRoot(UIViewRoot root)
Set the root component that is associated with this request. |
类方法继承 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造器详细信息 |
---|
FacesContext
public FacesContext()
方法详细信息 |
---|
getApplication
public abstract Application getApplication()
Return the
Application
instance associated with this web application.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
getClientIdsWithMessages
public abstract Iterator<String> getClientIdsWithMessages()
Return an
Iterator
over the client identifiers for which at least oneFacesMessage
has been queued. If there are no such client identifiers, an emptyIterator
is returned. If any messages have been queued that were not associated with any specific client identifier, anull
value will be included in the iterated values. The elements in theIterator
must be returned in the order in which they were added withaddMessage(java.lang.String, javax.faces.application.FacesMessage)
.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
getELContext
public ELContext getELContext()
Return the
ELContext
instance for thisFacesContext
instance. ThisELContext
instance has the same lifetime and scope as theFacesContext
instance with which it is associated, and may be created lazily the first time this method is called for a givenFacesContext
instance. Upon creation of the ELContext instance, the implementation must take the following action:Call the
ELContext.putContext(java.lang.Class, java.lang.Object)
method on the instance, passing inFacesContext.class
and thethis
reference for theFacesContext
instance itself.If the
Collection
returned byApplication.getELContextListeners()
is non-empty, create an instance ofELContextEvent
and pass it to eachELContextListener
instance in theCollection
by calling theELContextListener.contextCreated(javax.el.ELContextEvent)
method.
The default implementation throws
UnsupportedOperationException
and is provided for the sole purpose of not breaking existing applications that extend this class.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released- 从以下版本开始:
- 1.2
getExternalContext
public abstract ExternalContext getExternalContext()
Return the
ExternalContext
instance for thisFacesContext
instance.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
getMaximumSeverity
public 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 specificUIComponent
. If no such messages have been queued, returnnull
.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
getMessages
public abstract Iterator<FacesMessage> getMessages()
Return an
Iterator
over theFacesMessage
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 emptyIterator
. The elements of theIterator
must be returned in the order in which they were added with calls toaddMessage(java.lang.String, javax.faces.application.FacesMessage)
.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
getMessages
public abstract Iterator<FacesMessage> getMessages(String clientId)
Return an
Iterator
over theFacesMessage
s that have been queued that are associated with the specified client identifier (ifclientId
is notnull
), or over theFacesMessage
s that have been queued that are not associated with any specific client identifier (ifclientId
isnull
). If no such messages have been queued, return an emptyIterator
. The elements of theIterator
must be returned in the order in which they were added with calls toaddMessage(java.lang.String, javax.faces.application.FacesMessage)
.- 参数:
clientId
- The client identifier for which messages are requested, ornull
for messages not associated with any client identifier- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
getRenderKit
public abstract RenderKit getRenderKit()
Return the
RenderKit
instance for the render kit identifier specified on ourUIViewRoot
, if there is one. If there is no currentUIViewRoot
, if theUIViewRoot
does not have a specifiedrenderKitId
, or if there is noRenderKit
for the specified identifier, returnnull
instead.
getRenderResponse
public abstract boolean getRenderResponse()
Return
true
if therenderResponse()
method has been called for the current request.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
getResponseComplete
public abstract boolean getResponseComplete()
Return
true
if theresponseComplete()
method has been called for the current request.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
getResponseStream
public abstract 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.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
setResponseStream
public abstract void setResponseStream(ResponseStream responseStream)
Set the
ResponseStream
to which components should direct their binary output.- 参数:
responseStream
- The new ResponseStream for this response- 抛出异常:
NullPointerException
- ifresponseStream
isnull
IllegalStateException
- if this method is called after this instance has been released
getResponseWriter
public abstract 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.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
setResponseWriter
public abstract void setResponseWriter(ResponseWriter responseWriter)
Set the
ResponseWriter
to which components should direct their character-based output.- 参数:
responseWriter
- The new ResponseWriter for this response- 抛出异常:
IllegalStateException
- if this method is called after this instance has been releasedNullPointerException
- ifresponseWriter
isnull
getViewRoot
public abstract UIViewRoot getViewRoot()
Return the root component that is associated with the this request.
- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
setViewRoot
public abstract void setViewRoot(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 componentUIViewRoot
component- 抛出异常:
IllegalStateException
- if this method is called after this instance has been releasedNullPointerException
- ifroot
isnull
addMessage
public abstract void addMessage(String clientId, FacesMessage message)
Append a
FacesMessage
to the set of messages associated with the specified client identifier, ifclientId
is notnull
. IfclientId
isnull
, thisFacesMessage
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- 抛出异常:
IllegalStateException
- if this method is called after this instance has been releasedNullPointerException
- ifmessage
isnull
release
public abstract void release()
Release any resources associated with this
FacesContext
instance. Faces implementations may choose to pool instances in the associatedFacesContextFactory
to avoid repeated object creation and garbage collection. Afterrelease()
is called on aFacesContext
instance (until theFacesContext
instance has been recycled by the implementation for re-use), calling any other methods will cause anIllegalStateException
to be thrown.The implementation must call
setCurrentInstance(javax.faces.context.FacesContext)
passingnull
to remove the association between this thread and this deadFacesContext
instance.- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
renderResponse
public 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.
- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
responseComplete
public 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.
- 抛出异常:
IllegalStateException
- if this method is called after this instance has been released
getCurrentInstance
public static FacesContext getCurrentInstance()
Return the
FacesContext
instance for the request that is being processed by the current thread, if any.
setCurrentInstance
protected static void setCurrentInstance(FacesContext context)
Set the
FacesContext
instance for the request that is being processed by the current thread.- 参数:
context
- TheFacesContext
instance for the current thread, ornull
if this thread no longer has aFacesContext
instance.
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.