Class ExternalContext

java.lang.Object
jakarta.faces.context.ExternalContext
Direct Known Subclasses:
ExternalContextImpl, ExternalContextWrapper, ServletContextAdapter

public abstract class ExternalContext extends Object

This class allows the Faces API to be unaware of the nature of its containing application environment. In particular, this class allows Jakarta Faces based applications to run in either a Jakarta Servlet or a Portlet environment.

The documentation for this class only specifies the behavior for the Jakarta Servlet implementation of ExternalContext. The Portlet implementation of ExternalContext is specified under the revision of the Portlet Bridge Specification for JavaServer Faces JSR that corresponds to this version of the Jakarta Faces Specification. See the Preface of the Jakarta Faces Specification Document, for a reference.

If a reference to an ExternalContext is obtained during application startup or shutdown time, any method documented as "valid to call this method during application startup or shutdown" must be supported during application startup or shutdown time. The result of calling a method during application startup or shutdown time that does not have this designation is undefined.

An ExternalContext can be injected into a CDI managed bean using @Inject ExternalContext externalContext;