-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addServletContextEntryForInitContext
(ServletContext servletContext) static void
cleanupInitMaps
(ServletContext servletContext) Clean up entries from the threadInitContext and initContextServletContext maps using a ServletContext.Return theApplication
instance associated with this web application.Return a mutableMap
representing the attributes associated wth thisFacesContext
instance.Return theELContext
instance for thisFacesContext
instance.Return theExceptionHandler
for this request.static InitFacesContext
getInstance
(ServletContext servletContext) Return the root component that is associated with the this request.boolean
isProjectStage
(ProjectStage stage) Returntrue
if the currentProjectStage
as returned by theApplication
instance is equal tostage
, otherwise returnfalse
void
void
release()
Release any resources associated with thisFacesContext
instance.void
void
void
void
setELContext
(ELContext elContext) Methods inherited from class com.sun.faces.config.initfacescontext.NoOpFacesContext
addMessage, getClientIdsWithMessages, getLifecycle, getMaximumSeverity, getMessageList, getMessageList, getMessages, getMessages, getRenderKit, getRenderResponse, getResponseComplete, getResponseStream, getResponseWriter, isValidationFailed, renderResponse, responseComplete, setResponseStream, setResponseWriter, setViewRoot, validationFailed
Methods inherited from class jakarta.faces.context.FacesContext
getCurrentInstance, getCurrentPhaseId, getNamingContainerSeparatorChar, getPartialViewContext, getResourceLibraryContracts, isPostback, isProcessingEvents, isReleased, setCurrentInstance, setCurrentPhaseId, setExceptionHandler, setProcessingEvents, setResourceLibraryContracts
-
Constructor Details
-
InitFacesContext
-
-
Method Details
-
getAttributes
Description copied from class:FacesContext
Return a mutable
Map
representing the attributes associated wth thisFacesContext
instance. ThisMap
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 thisMap
does not cause any events to fire, as is the case with the other maps: for request, session, and application scope. WhenFacesContext.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, seeExternalContext.getRequestMap()
.The default implementation throws
UnsupportedOperationException
and is provided for the sole purpose of not breaking existing applications that extend this class.- Overrides:
getAttributes
in classFacesContext
- Returns:
- mutable
Map
representing the attributes associated wth thisFacesContext
instance.
-
getExternalContext
Description copied from class:FacesContext
Return the
ExternalContext
instance for thisFacesContext
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.- Specified by:
getExternalContext
in classFacesContext
- Returns:
- instance of
ExternalContext
-
getViewRoot
Description copied from class: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 toLocale.getDefault()
.- Specified by:
getViewRoot
in classFacesContext
- Returns:
UIViewRoot
instance.
-
getELContext
Description copied from class:FacesContext
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(jakarta.el.ELContextEvent)
method.
- Overrides:
getELContext
in classFacesContext
- Returns:
- instance of
ELContext
.
-
-
setELContext
-
getApplication
Description copied from class: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.- Specified by:
getApplication
in classFacesContext
- Returns:
- the
Application
instance associated with this web application.
-
getExceptionHandler
Description copied from class:FacesContext
Return the
ExceptionHandler
for this request.- Overrides:
getExceptionHandler
in classFacesContext
- Returns:
- instance of
ExceptionHandler
.
-
isProjectStage
Description copied from class:FacesContext
Return
true
if the currentProjectStage
as returned by theApplication
instance is equal tostage
, otherwise returnfalse
- Overrides:
isProjectStage
in classFacesContext
- Parameters:
stage
- theProjectStage
to check- Returns:
- boolean indicating whether the application has the same stage.
-
release
public void release()Description copied from class:FacesContext
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.If a call was made to
FacesContext.getAttributes()
during the processing for this request, the implementation must callclear()
on theMap
returned fromgetAttributes()
, and then de-allocate the data-structure behind thatMap
.The implementation must call
FacesContext.setCurrentInstance(jakarta.faces.context.FacesContext)
passingnull
to remove the association between this thread and this deadFacesContext
instance.- Specified by:
release
in classFacesContext
-
releaseCurrentInstance
public void releaseCurrentInstance() -
addInitContextEntryForCurrentThread
public void addInitContextEntryForCurrentThread() -
removeInitContextEntryForCurrentThread
public void removeInitContextEntryForCurrentThread() -
addServletContextEntryForInitContext
-
removeServletContextEntryForInitContext
public void removeServletContextEntryForInitContext() -
cleanupInitMaps
Clean up entries from the threadInitContext and initContextServletContext maps using a ServletContext. First remove entry(s) with matching ServletContext from initContextServletContext map. Then remove entries from threadInitContext map where the entry value(s) match the initFacesContext (associated with the ServletContext).- Parameters:
servletContext
- the involved servlet context
-
getInstance
-
reInitializeExternalContext
-