Class InitFacesContext
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidvoidaddServletContextEntryForInitContext(jakarta.servlet.ServletContext servletContext) static voidcleanupInitMaps(jakarta.servlet.ServletContext servletContext) Clean up entries from the threadInitContext and initContextServletContext maps using a ServletContext.Return theApplicationinstance associated with this web application.Return a mutableMaprepresenting the attributes associated wth thisFacesContextinstance.jakarta.el.ELContextReturn theELContextinstance for thisFacesContextinstance.static InitFacesContextgetInstance(jakarta.servlet.ServletContext servletContext) Return the root component that is associated with the this request.booleanisProjectStage(ProjectStage stage) Returntrueif the currentProjectStageas returned by theApplicationinstance is equal tostage, otherwise returnfalsevoidreInitializeExternalContext(jakarta.servlet.ServletContext sc) voidrelease()Release any resources associated with thisFacesContextinstance.voidvoidvoidvoidsetELContext(jakarta.el.ELContext elContext) Methods inherited from class com.sun.faces.config.initfacescontext.NoOpFacesContextaddMessage, getClientIdsWithMessages, getLifecycle, getMaximumSeverity, getMessageList, getMessageList, getMessages, getMessages, getRenderKit, getRenderResponse, getResponseComplete, getResponseStream, getResponseWriter, isValidationFailed, renderResponse, responseComplete, setResponseStream, setResponseWriter, setViewRoot, validationFailedMethods inherited from class jakarta.faces.context.FacesContextgetCurrentInstance, getCurrentPhaseId, getExceptionHandler, getNamingContainerSeparatorChar, getPartialViewContext, getResourceLibraryContracts, isPostback, isProcessingEvents, isReleased, setCurrentInstance, setCurrentPhaseId, setExceptionHandler, setProcessingEvents, setResourceLibraryContracts
- 
Constructor Details- 
InitFacesContextpublic InitFacesContext(jakarta.servlet.ServletContext servletContext) 
 
- 
- 
Method Details- 
getAttributesDescription copied from class:FacesContextReturn a mutable Maprepresenting the attributes associated wth thisFacesContextinstance. ThisMapis 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 thisMapdoes 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 Mapreturned 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 UnsupportedOperationExceptionand is provided for the sole purpose of not breaking existing applications that extend this class.- Overrides:
- getAttributesin class- FacesContext
- Returns:
- mutable Maprepresenting the attributes associated wth thisFacesContextinstance.
 
- 
getExternalContextDescription copied from class:FacesContextReturn the ExternalContextinstance for thisFacesContextinstance.It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this method returns an ExternalContextinstance 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:
- getExternalContextin class- FacesContext
- Returns:
- instance of ExternalContext
 
- 
getViewRootDescription copied from class: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 UIViewRootwith its locale set toLocale.getDefault().- Specified by:
- getViewRootin class- FacesContext
- Returns:
- UIViewRootinstance.
 
- 
getELContextpublic jakarta.el.ELContext getELContext()Description copied from class:FacesContextReturn the ELContextinstance for thisFacesContextinstance. ThisELContextinstance has the same lifetime and scope as theFacesContextinstance with which it is associated, and may be created lazily the first time this method is called for a givenFacesContextinstance. 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.classand thethisreference for theFacesContextinstance itself.
- 
 If the Collectionreturned byApplication.getELContextListeners()is non-empty, create an instance ofELContextEventand pass it to eachELContextListenerinstance in theCollectionby calling theELContextListener.contextCreated(jakarta.el.ELContextEvent)method.
 - Overrides:
- getELContextin class- FacesContext
- Returns:
- instance of ELContext.
 
- 
 
- 
setELContextpublic void setELContext(jakarta.el.ELContext elContext) 
- 
getApplicationDescription copied from class:FacesContextReturn the Applicationinstance 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 Applicationinstance.- Specified by:
- getApplicationin class- FacesContext
- Returns:
- the Applicationinstance associated with this web application.
 
- 
isProjectStageDescription copied from class:FacesContextReturn trueif the currentProjectStageas returned by theApplicationinstance is equal tostage, otherwise returnfalse- Overrides:
- isProjectStagein class- FacesContext
- Parameters:
- stage- the- ProjectStageto check
- Returns:
- boolean indicating whether the application has the same stage.
 
- 
releasepublic void release()Description copied from class:FacesContextRelease any resources associated with this FacesContextinstance. Faces implementations may choose to pool instances in the associatedFacesContextFactoryto avoid repeated object creation and garbage collection. Afterrelease()is called on aFacesContextinstance (until theFacesContextinstance has been recycled by the implementation for re-use), calling any other methods will cause anIllegalStateExceptionto be thrown.If a call was made to FacesContext.getAttributes()during the processing for this request, the implementation must callclear()on theMapreturned fromgetAttributes(), and then de-allocate the data-structure behind thatMap.The implementation must call FacesContext.setCurrentInstance(jakarta.faces.context.FacesContext)passingnullto remove the association between this thread and this deadFacesContextinstance.- Specified by:
- releasein class- FacesContext
 
- 
releaseCurrentInstancepublic void releaseCurrentInstance()
- 
addInitContextEntryForCurrentThreadpublic void addInitContextEntryForCurrentThread()
- 
removeInitContextEntryForCurrentThreadpublic void removeInitContextEntryForCurrentThread()
- 
addServletContextEntryForInitContextpublic void addServletContextEntryForInitContext(jakarta.servlet.ServletContext servletContext) 
- 
removeServletContextEntryForInitContextpublic void removeServletContextEntryForInitContext()
- 
cleanupInitMapspublic static void cleanupInitMaps(jakarta.servlet.ServletContext servletContext) 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
- 
reInitializeExternalContextpublic void reInitializeExternalContext(jakarta.servlet.ServletContext sc) 
 
-