Top Description Fields Constructors Methods
jakarta.faces.context

public abstract Class FacesContextFactory

extends Object
implements FacesWrapper<FacesContextFactory>
Class Inheritance
All Implemented Interfaces
jakarta.faces.FacesWrapper
Known Direct Subclasses
com.sun.faces.context.FacesContextFactoryImpl, com.sun.faces.context.InjectionFacesContextFactory, jakarta.faces.ServletContextFacesContextFactory
Imports
jakarta.faces.FacesException, .FacesWrapper, jakarta.faces.lifecycle.Lifecycle

FacesContextFactory is a factory object that creates (if needed) and returns new FacesContext instances, initialized for the processing of the specified request and response objects. Implementations may take advantage of the calls to the release() method of the allocated FacesContext instances to pool and recycle them, rather than creating a new instance every time.

There must be one FacesContextFactory instance per web application that is utilizing Jakarta Server Faces. This instance can be acquired, in a portable manner, by calling:

FacesContextFactory factory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);

Usage: extend this class and push the implementation being wrapped to the constructor and use getWrapped to access the instance being wrapped.

Field Summary

Modifier and TypeField and Description
private FacesContextFactory

Constructor Summary

AccessConstructor and Description
public
FacesContextFactory()
Deprecated Use the other constructor taking the implementation being wrapped.

public
FacesContextFactory(FacesContextFactory
The implementation being wrapped.
wrapped
)

If this factory has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor.

Method Summary

Modifier and TypeMethod and Description
public abstract FacesContext

Returns:

the instance of FacesContext.
getFacesContext
(Object
In Jakarta Servlet environments, the ServletContext that is associated with this web application
context
,
Object
In Jakarta Servlet environments, the ServletRequest that is to be processed
request
,
Object
In Jakarta Servlet environments, the ServletResponse that is to be processed
response
,
Lifecycle
The Lifecycle instance being used to process this request
lifecycle
)

Create (if needed) and return a FacesContext instance that is initialized for the processing of the specified request and response objects, utilizing the specified Lifecycle instance, for this web application.

public FacesContextFactory
getWrapped()

Implements jakarta.faces.FacesWrapper.getWrapped.

If this factory has been decorated, the implementation doing the decorating may override this method to provide access to the implementation being wrapped.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

wrappedback to summary
private FacesContextFactory wrapped

Constructor Detail

FacesContextFactoryback to summary
public FacesContextFactory()

Deprecated

Use the other constructor taking the implementation being wrapped.

Annotations
@Deprecated
FacesContextFactoryback to summary
public FacesContextFactory(FacesContextFactory wrapped)

If this factory has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor. The getWrapped() will then return the implementation being wrapped.

Parameters
wrapped:FacesContextFactory

The implementation being wrapped.

Method Detail

getFacesContextback to summary
public abstract FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle) throws FacesException

Create (if needed) and return a FacesContext instance that is initialized for the processing of the specified request and response objects, utilizing the specified Lifecycle instance, for this web application.

The implementation of this method must ensure that calls to the getCurrentInstance() method of FacesContext, from the same thread that called this method, will return the same FacesContext instance until the release() method is called on that instance.

The implementation must call ExternalContextFactory#getExternalContext to produce the ExternalContext for the FacesContext instance.

The default implementation must call ExceptionHandlerFactory#getExceptionHandler and make it so the return from that method is what gets returned from a call to FacesContext#getExceptionHandler on the returned FacesContext instance.

The default implementation must call jakarta.faces.lifecycle.ClientWindowFactory#getClientWindow and make it so the return from that method is what gets returned from a call to ExternalContext#getClientWindow() on the returned ExternalContext instance.

Parameters
context:Object

In Jakarta Servlet environments, the ServletContext that is associated with this web application

request:Object

In Jakarta Servlet environments, the ServletRequest that is to be processed

response:Object

In Jakarta Servlet environments, the ServletResponse that is to be processed

lifecycle:Lifecycle

The Lifecycle instance being used to process this request

Returns:FacesContext

the instance of FacesContext.

Exceptions
FacesException:
if a FacesContext cannot be constructed for the specified parameters
NullPointerException:
if any of the parameters are null
getWrappedback to summary
public FacesContextFactory getWrapped()

Implements jakarta.faces.FacesWrapper.getWrapped.

If this factory has been decorated, the implementation doing the decorating may override this method to provide access to the implementation being wrapped.

Returns:FacesContextFactory

Doc from jakarta.faces.FacesWrapper.getWrapped.

the wrapped instance.

Annotations
@Override
Since
2.0