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.
|
javax.faces.application.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. |
javax.faces.context.ExternalContext |
getExternalContext()
Return the
ExternalContext instance for this FacesContext
instance. |
static InitFacesContext |
getInstance(javax.servlet.ServletContext servletContext) |
javax.faces.component.UIViewRoot |
getViewRoot()
Return the root
component that is associated with the this request.
|
boolean |
isProjectStage(javax.faces.application.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, validationFailedgetCurrentInstance, getCurrentPhaseId, getExceptionHandler, getNamingContainerSeparatorChar, getPartialViewContext, getResourceLibraryContracts, isPostback, isProcessingEvents, isReleased, setCurrentInstance, setCurrentPhaseId, setExceptionHandler, setProcessingEvents, setResourceLibraryContractspublic InitFacesContext(javax.servlet.ServletContext servletContext)
public Map<Object,Object> getAttributes()
javax.faces.context.FacesContextReturn 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 javax.faces.context.FacesContextMap representing the attributes associated wth this
FacesContext instance.public javax.faces.context.ExternalContext getExternalContext()
javax.faces.context.FacesContextReturn 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 javax.faces.context.FacesContextExternalContextpublic javax.faces.component.UIViewRoot getViewRoot()
javax.faces.context.FacesContextReturn 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 javax.faces.context.FacesContextUIViewRoot instance.public javax.el.ELContext getELContext()
javax.faces.context.FacesContextReturn 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 javax.faces.context.FacesContextELContext.public void setELContext(javax.el.ELContext elContext)
public javax.faces.application.Application getApplication()
javax.faces.context.FacesContextReturn 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 javax.faces.context.FacesContextApplication instance associated with this web application.public boolean isProjectStage(javax.faces.application.ProjectStage stage)
javax.faces.context.FacesContextReturn true if the
current ProjectStage as returned by the Application instance is equal to stage, otherwise
return false
isProjectStage in class javax.faces.context.FacesContextstage - the ProjectStage to checkpublic void release()
javax.faces.context.FacesContextRelease 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 javax.faces.context.FacesContextpublic 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)
Copyright © 2010–2024 JBoss by Red Hat. All rights reserved.