public class InitFacesContext extends NoOpFacesContext
Constructor and Description |
---|
InitFacesContext(javax.servlet.ServletContext servletContext) |
Modifier and Type | Method and Description |
---|---|
void |
addInitContextEntryForCurrentThread() |
void |
addServletContextEntryForInitContext(javax.servlet.ServletContext servletContext) |
static void |
cleanupInitMaps(javax.servlet.ServletContext servletContext)
Clean up entries from the threadInitContext and initContextServletContext maps using a ServletContext.
|
Application |
getApplication()
Return the
Application instance associated with this web application. |
Map<Object,Object> |
getAttributes()
Return a mutable |
javax.el.ELContext |
getELContext()
Return the
ELContext instance for this
FacesContext instance. |
ExternalContext |
getExternalContext()
|
static InitFacesContext |
getInstance(javax.servlet.ServletContext servletContext) |
UIViewRoot |
getViewRoot()
Return the root
component that is associated with the this request.
|
boolean |
isProjectStage(ProjectStage stage)
Return |
void |
reInitializeExternalContext(javax.servlet.ServletContext sc) |
void |
release()
Release any
resources associated with this
FacesContext
instance. |
void |
releaseCurrentInstance() |
void |
removeInitContextEntryForCurrentThread() |
void |
removeServletContextEntryForInitContext() |
void |
setELContext(javax.el.ELContext elContext) |
addMessage, getClientIdsWithMessages, getMaximumSeverity, getMessageList, getMessageList, getMessages, getMessages, getRenderKit, getRenderResponse, getResponseComplete, getResponseStream, getResponseWriter, isValidationFailed, renderResponse, responseComplete, setResponseStream, setResponseWriter, setViewRoot, validationFailed
getCurrentInstance, getCurrentPhaseId, getExceptionHandler, getNamingContainerSeparatorChar, getPartialViewContext, getResourceLibraryContracts, isPostback, isProcessingEvents, isReleased, setCurrentInstance, setCurrentPhaseId, setExceptionHandler, setProcessingEvents, setResourceLibraryContracts
public InitFacesContext(javax.servlet.ServletContext servletContext)
public Map<Object,Object> getAttributes()
FacesContext
Return a mutable Map
representing the attributes associated wth this
FacesContext
instance. This Map
is
useful to store attributes that you want to go out of scope when the
Faces lifecycle for the current request ends, which is not always the same
as the request ending, especially in the case of Jakarta Servlet filters
that are invoked after the Faces lifecycle for this
request completes. Accessing this Map
does not cause any
events to fire, as is the case with the other maps: for request, session, and
application scope. When FacesContext.release()
is invoked, the attributes
must be cleared.
The Map
returned by this method is not associated with
the request. If you would like to get or set request attributes,
see ExternalContext.getRequestMap()
.
The default implementation throws
UnsupportedOperationException
and is provided
for the sole purpose of not breaking existing applications that extend
this class.
getAttributes
in class FacesContext
Map
representing the attributes associated wth this
FacesContext
instance.public ExternalContext getExternalContext()
FacesContext
Return the ExternalContext
instance for this FacesContext
instance.
It is valid to call this method
during application startup or shutdown. If called during application
startup or shutdown, this method returns an ExternalContext
instance
with the special behaviors indicated in the javadoc for that
class. Methods document as being valid to call during
application startup or shutdown must be supported.
getExternalContext
in class FacesContext
ExternalContext
public UIViewRoot getViewRoot()
FacesContext
Return the root component that is associated with the this request.
It is valid to call this method
during application startup or shutdown. If called during application
startup or shutdown, this method returns a new UIViewRoot
with
its locale set to Locale.getDefault()
.
getViewRoot
in class FacesContext
UIViewRoot
instance.public javax.el.ELContext getELContext()
FacesContext
Return the ELContext
instance for this
FacesContext
instance. This ELContext
instance has the same lifetime and scope as the
FacesContext
instance with which it is associated,
and may be created lazily the first time this method is called
for a given FacesContext
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 in FacesContext.class
and the
this
reference for the FacesContext
instance itself.
If the Collection
returned by Application.getELContextListeners()
is
non-empty, create an instance of ELContextEvent
and pass it to each ELContextListener
instance in the
Collection
by calling the ELContextListener.contextCreated(javax.el.ELContextEvent)
method.
getELContext
in class FacesContext
ELContext
.public void setELContext(javax.el.ELContext elContext)
public Application getApplication()
FacesContext
Return the Application
instance associated with this web application.
It is valid to call this method
during application startup or shutdown. If called during application
startup or shutdown, returns the correct current Application
instance.
getApplication
in class FacesContext
Application
instance associated with this web application.public boolean isProjectStage(ProjectStage stage)
FacesContext
Return true
if the
current ProjectStage
as returned by the Application
instance is equal to stage
, otherwise
return false
isProjectStage
in class FacesContext
stage
- the ProjectStage
to checkpublic void release()
FacesContext
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.
If a call was made to FacesContext.getAttributes()
during the processing for this request, the
implementation must call clear()
on the
Map
returned from getAttributes()
, and
then de-allocate the data-structure behind that
Map
.
The implementation must call FacesContext.setCurrentInstance(javax.faces.context.FacesContext)
passing null
to remove the association between this
thread and this dead FacesContext
instance.
release
in class FacesContext
public void releaseCurrentInstance()
public void addInitContextEntryForCurrentThread()
public void removeInitContextEntryForCurrentThread()
public void addServletContextEntryForInitContext(javax.servlet.ServletContext servletContext)
public void removeServletContextEntryForInitContext()
public static void cleanupInitMaps(javax.servlet.ServletContext servletContext)
servletContext
- public static InitFacesContext getInstance(javax.servlet.ServletContext servletContext)
public void reInitializeExternalContext(javax.servlet.ServletContext sc)
Comments to: faces-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.