-
Constructor Summary
Constructors -
Method Summary
Modifier 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.Return theExceptionHandlerfor this request.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.NoOpFacesContext
addMessage, 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.FacesContext
getCurrentInstance, getCurrentPhaseId, getNamingContainerSeparatorChar, getPartialViewContext, getResourceLibraryContracts, isPostback, isProcessingEvents, isReleased, setCurrentInstance, setCurrentPhaseId, setExceptionHandler, setProcessingEvents, setResourceLibraryContracts
-
Constructor Details
-
InitFacesContext
public InitFacesContext(jakarta.servlet.ServletContext servletContext)
-
-
Method Details
-
getAttributes
Description 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 classFacesContext- Returns:
- mutable
Maprepresenting the attributes associated wth thisFacesContextinstance.
-
getExternalContext
Description 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 classFacesContext- Returns:
- instance of
ExternalContext
-
getViewRoot
Description 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 classFacesContext- Returns:
UIViewRootinstance.
-
getELContext
public 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 classFacesContext- Returns:
- instance of
ELContext.
-
-
setELContext
public void setELContext(jakarta.el.ELContext elContext) -
getApplication
Description 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 classFacesContext- Returns:
- the
Applicationinstance associated with this web application.
-
getExceptionHandler
Description copied from class:FacesContextReturn the
ExceptionHandlerfor this request.- Overrides:
getExceptionHandlerin classFacesContext- Returns:
- instance of
ExceptionHandler.
-
isProjectStage
Description copied from class:FacesContextReturn
trueif the currentProjectStageas returned by theApplicationinstance is equal tostage, otherwise returnfalse- Overrides:
isProjectStagein classFacesContext- Parameters:
stage- theProjectStageto check- Returns:
- boolean indicating whether the application has the same stage.
-
release
public 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 classFacesContext
-
releaseCurrentInstance
public void releaseCurrentInstance() -
addInitContextEntryForCurrentThread
public void addInitContextEntryForCurrentThread() -
removeInitContextEntryForCurrentThread
public void removeInitContextEntryForCurrentThread() -
addServletContextEntryForInitContext
public void addServletContextEntryForInitContext(jakarta.servlet.ServletContext servletContext) -
removeServletContextEntryForInitContext
public void removeServletContextEntryForInitContext() -
cleanupInitMaps
public 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
-
reInitializeExternalContext
public void reInitializeExternalContext(jakarta.servlet.ServletContext sc)
-