Package org.apache.myfaces.webapp
Class AbstractFacesInitializer
- java.lang.Object
-
- org.apache.myfaces.webapp.AbstractFacesInitializer
-
- All Implemented Interfaces:
FacesInitializer
- Direct Known Subclasses:
FaceletsInitilializer,JspFacesInitializer
public abstract class AbstractFacesInitializer extends Object implements FacesInitializer
Performs common initialization tasks.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCDI_BEAN_MANAGER_INSTANCEstatic StringINJECTED_BEAN_STORAGE_KEY
-
Constructor Summary
Constructors Constructor Description AbstractFacesInitializer()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void_callPreDestroyOnInjectedJSFArtifacts(FacesContext facesContext)protected RuntimeConfigbuildConfiguration(javax.servlet.ServletContext servletContext, ExternalContext externalContext, javax.el.ExpressionFactory expressionFactory)Configures this JSF application.protected voidcleanupAfterStartup(FacesContext facesContext)voiddestroyFaces(javax.servlet.ServletContext servletContext)Cleans up all remaining resources (well, theoretically).voiddestroyShutdownFacesContext(FacesContext facesContext)voiddestroyStartupFacesContext(FacesContext facesContext)protected static javax.el.ExpressionFactorygetUserDefinedExpressionFactory(ExternalContext externalContext)Try to load user-definied ExpressionFactory.protected voidinitAutomaticExtensionlessMapping(FacesContext facesContext, javax.servlet.ServletContext servletContext)protected voidinitCDIIntegration(javax.servlet.ServletContext servletContext, ExternalContext externalContext)The intention of this method is provide a point where CDI integration is done.protected abstract voidinitContainerIntegration(javax.servlet.ServletContext servletContext, ExternalContext externalContext)Performs initialization tasks depending on the current environment.voidinitFaces(javax.servlet.ServletContext servletContext)Performs all necessary initialization tasks like configuring this JSF application.FacesContextinitShutdownFacesContext(javax.servlet.ServletContext servletContext)FacesContextinitStartupFacesContext(javax.servlet.ServletContext servletContext)protected voidinitWebsocketIntegration(javax.servlet.ServletContext servletContext, ExternalContext externalContext)protected static javax.el.ExpressionFactoryloadExpressionFactory(String expressionFactoryClassName)Loads and instantiates the given ExpressionFactory implementation.protected static javax.el.ExpressionFactoryloadExpressionFactory(String expressionFactoryClassName, boolean logMissing)protected voidvalidateFacesConfig(javax.servlet.ServletContext servletContext, ExternalContext externalContext)
-
-
-
Field Detail
-
CDI_BEAN_MANAGER_INSTANCE
public static final String CDI_BEAN_MANAGER_INSTANCE
- See Also:
- Constant Field Values
-
INJECTED_BEAN_STORAGE_KEY
public static final String INJECTED_BEAN_STORAGE_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
initFaces
public void initFaces(javax.servlet.ServletContext servletContext)
Performs all necessary initialization tasks like configuring this JSF application.- Specified by:
initFacesin interfaceFacesInitializer- Parameters:
servletContext- The currentServletContext
-
cleanupAfterStartup
protected void cleanupAfterStartup(FacesContext facesContext)
-
destroyFaces
public void destroyFaces(javax.servlet.ServletContext servletContext)
Cleans up all remaining resources (well, theoretically).- Specified by:
destroyFacesin interfaceFacesInitializer- Parameters:
servletContext- The currentServletContext
-
buildConfiguration
protected RuntimeConfig buildConfiguration(javax.servlet.ServletContext servletContext, ExternalContext externalContext, javax.el.ExpressionFactory expressionFactory)
Configures this JSF application. It's required that every FacesInitializer (i.e. every subclass) calls this method during initialization.- Parameters:
servletContext- the current ServletContextexternalContext- the current ExternalContextexpressionFactory- the ExpressionFactory to use- Returns:
- the current runtime configuration
-
validateFacesConfig
protected void validateFacesConfig(javax.servlet.ServletContext servletContext, ExternalContext externalContext)
-
getUserDefinedExpressionFactory
protected static javax.el.ExpressionFactory getUserDefinedExpressionFactory(ExternalContext externalContext)
Try to load user-definied ExpressionFactory. Returnsnull, if no custom ExpressionFactory was specified.- Parameters:
externalContext- the current ExternalContext- Returns:
- User-specified ExpressionFactory, or
null, if no no custom implementation was specified
-
loadExpressionFactory
protected static javax.el.ExpressionFactory loadExpressionFactory(String expressionFactoryClassName)
Loads and instantiates the given ExpressionFactory implementation.- Parameters:
expressionFactoryClassName- the class name of the ExpressionFactory implementation- Returns:
- the newly created ExpressionFactory implementation, or
null, if an error occurred
-
loadExpressionFactory
protected static javax.el.ExpressionFactory loadExpressionFactory(String expressionFactoryClassName, boolean logMissing)
-
initStartupFacesContext
public FacesContext initStartupFacesContext(javax.servlet.ServletContext servletContext)
- Specified by:
initStartupFacesContextin interfaceFacesInitializer
-
destroyStartupFacesContext
public void destroyStartupFacesContext(FacesContext facesContext)
- Specified by:
destroyStartupFacesContextin interfaceFacesInitializer
-
initShutdownFacesContext
public FacesContext initShutdownFacesContext(javax.servlet.ServletContext servletContext)
- Specified by:
initShutdownFacesContextin interfaceFacesInitializer
-
destroyShutdownFacesContext
public void destroyShutdownFacesContext(FacesContext facesContext)
- Specified by:
destroyShutdownFacesContextin interfaceFacesInitializer
-
initContainerIntegration
protected abstract void initContainerIntegration(javax.servlet.ServletContext servletContext, ExternalContext externalContext)Performs initialization tasks depending on the current environment.- Parameters:
servletContext- the current ServletContextexternalContext- the current ExternalContext
-
initCDIIntegration
protected void initCDIIntegration(javax.servlet.ServletContext servletContext, ExternalContext externalContext)The intention of this method is provide a point where CDI integration is done.FlowScopedandViewScopedrequires CDI in order to work, so this method should set a BeanManager instance on application map under the key "oam.cdi.BEAN_MANAGER_INSTANCE". The default implementation look on ServletContext first and then use JNDI.- Parameters:
servletContext-externalContext-
-
_callPreDestroyOnInjectedJSFArtifacts
public void _callPreDestroyOnInjectedJSFArtifacts(FacesContext facesContext)
-
initWebsocketIntegration
protected void initWebsocketIntegration(javax.servlet.ServletContext servletContext, ExternalContext externalContext)
-
initAutomaticExtensionlessMapping
protected void initAutomaticExtensionlessMapping(FacesContext facesContext, javax.servlet.ServletContext servletContext)
- Parameters:
facesContext-servletContext-- Since:
- 2.3
-
-