Top Description Fields Constructors Methods
com.sun.faces.config

public Class InitFacesContext

extends NoOpFacesContext
Class Inheritance
Static Imports
com.sun.faces.RIConstants.FACES_PREFIX

A special, minimal implementation of FacesContext used at application initialization time. The ExternalContext returned by this FacesContext only exposes the ApplicationMap.

Field Summary

Modifier and TypeField and Description
private Map<Object, Object>
private ELContext
private static final String
private static final Logger
private ServletContextAdapter
private UIViewRoot

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
public static void
cleanupInitMaps(ServletContext
the involved servlet context
servletContext
)

Clean up entries from the threadInitContext and initContextServletContext maps using a ServletContext.

public Application
getApplication()

Implements abstract jakarta.faces.context.FacesContext.getApplication.

Return the Application instance associated with this web application.

public Map<Object, Object>
getAttributes()

Overrides jakarta.faces.context.FacesContext.getAttributes.

Return a mutable Map representing the attributes associated wth this FacesContext instance.

public ELContext
getELContext()

Overrides jakarta.faces.context.FacesContext.getELContext.

Return the ELContext instance for this FacesContext instance.

public ExceptionHandler
public ExternalContext
getExternalContext()

Implements abstract jakarta.faces.context.FacesContext.getExternalContext.

Return the ExternalContext instance for this FacesContext instance.

pack-priv static Map<InitFacesContext, ServletContext>
public static InitFacesContext
getInstance(ServletContext servletContext)

pack-priv static Map<Thread, InitFacesContext>
public UIViewRoot
getViewRoot()

Implements abstract jakarta.faces.context.FacesContext.getViewRoot.

Return the root component that is associated with the this request.

public boolean
isProjectStage(ProjectStage
the ProjectStage to check
stage
)

Overrides jakarta.faces.context.FacesContext.isProjectStage.

Return true if the current ProjectStage as returned by the Application instance is equal to stage, otherwise return false

public void
public void
release()

Implements abstract jakarta.faces.context.FacesContext.release.

Release any resources associated with this FacesContext instance.

public void
public void
public void
public void
Inherited from com.sun.faces.config.initfacescontext.NoOpFacesContext:
addMessagegetClientIdsWithMessagesgetLifecyclegetMaximumSeveritygetMessageListgetMessageListgetMessagesgetMessagesgetRenderKitgetRenderResponsegetResponseCompletegetResponseStreamgetResponseWriterisValidationFailedrenderResponseresponseCompletesetResponseStreamsetResponseWritersetViewRootvalidationFailed

Field Detail

attributesback to summary
private Map<Object, Object> attributes
elContextback to summary
private ELContext elContext
INIT_FACES_CONTEXT_ATTR_NAMEback to summary
private static final String INIT_FACES_CONTEXT_ATTR_NAME
LOGGERback to summary
private static final Logger LOGGER
servletContextAdapterback to summary
private ServletContextAdapter servletContextAdapter
viewRootback to summary
private UIViewRoot viewRoot

Constructor Detail

InitFacesContextback to summary
public InitFacesContext(ServletContext servletContext)

Method Detail

addInitContextEntryForCurrentThreadback to summary
public void addInitContextEntryForCurrentThread()
addServletContextEntryForInitContextback to summary
public void addServletContextEntryForInitContext(ServletContext servletContext)
cleanupInitMapsback to summary
public static void cleanupInitMaps(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:ServletContext

the involved servlet context

getApplicationback to summary
public Application getApplication()

Implements abstract jakarta.faces.context.FacesContext.getApplication.

Doc from jakarta.faces.context.FacesContext.getApplication.

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 jakarta.faces.application.Application instance.

Returns:Application

the Application instance associated with this web application.

Annotations
@Override
getAttributesback to summary
public Map<Object, Object> getAttributes()

Overrides jakarta.faces.context.FacesContext.getAttributes.

Doc from jakarta.faces.context.FacesContext.getAttributes.

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 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.

Returns:Map<Object, Object>

mutable Map representing the attributes associated wth this FacesContext instance.

Annotations
@Override
getELContextback to summary
public ELContext getELContext()

Overrides jakarta.faces.context.FacesContext.getELContext.

Doc from jakarta.faces.context.FacesContext.getELContext.

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:

Returns:ELContext

instance of ELContext.

Annotations
@Override
getExceptionHandlerback to summary
public ExceptionHandler getExceptionHandler()

Overrides jakarta.faces.context.FacesContext.getExceptionHandler.

Doc from jakarta.faces.context.FacesContext.getExceptionHandler.

Return the ExceptionHandler for this request.

Returns:ExceptionHandler

instance of ExceptionHandler.

Annotations
@Override
getExternalContextback to summary
public ExternalContext getExternalContext()

Implements abstract jakarta.faces.context.FacesContext.getExternalContext.

Doc from jakarta.faces.context.FacesContext.getExternalContext.

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.

Returns:ExternalContext

instance of ExternalContext

Annotations
@Override
getInitContextServletContextMapback to summary
pack-priv static Map<InitFacesContext, ServletContext> getInitContextServletContextMap()
Annotations
@SuppressWarnings:unchecked
getInstanceback to summary
public static InitFacesContext getInstance(ServletContext servletContext)
getThreadInitContextMapback to summary
pack-priv static Map<Thread, InitFacesContext> getThreadInitContextMap()
Annotations
@SuppressWarnings:unchecked
getViewRootback to summary
public UIViewRoot getViewRoot()

Implements abstract jakarta.faces.context.FacesContext.getViewRoot.

Doc from jakarta.faces.context.FacesContext.getViewRoot.

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().

Returns:UIViewRoot

UIViewRoot instance.

Annotations
@Override
isProjectStageback to summary
public boolean isProjectStage(ProjectStage stage)

Overrides jakarta.faces.context.FacesContext.isProjectStage.

Doc from jakarta.faces.context.FacesContext.isProjectStage.

Return true if the current ProjectStage as returned by the Application instance is equal to stage, otherwise return false

Parameters
stage:ProjectStage

the ProjectStage to check

Returns:boolean

boolean indicating whether the application has the same stage.

Annotations
@Override
reInitializeExternalContextback to summary
public void reInitializeExternalContext(ServletContext sc)
releaseback to summary
public void release()

Implements abstract jakarta.faces.context.FacesContext.release.

Doc from jakarta.faces.context.FacesContext.release.

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 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 setCurrentInstance passing null to remove the association between this thread and this dead FacesContext instance.

Annotations
@Override
releaseCurrentInstanceback to summary
public void releaseCurrentInstance()
removeInitContextEntryForCurrentThreadback to summary
public void removeInitContextEntryForCurrentThread()
removeServletContextEntryForInitContextback to summary
public void removeServletContextEntryForInitContext()
setELContextback to summary
public void setELContext(ELContext elContext)