|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.mindmatters.faces.spring.context.ContextLoader
Performs the actual initialization work for the faces root application context. Called by ContextLoaderListener and ContextLoaderServlet.
Looks for the context-param faces.spring.factoryClass
to
determine the internal bean factory class type, falling back to the default
implementation of
ManagedBeanFactory
if not
found. With the default ContextLoader implementation, any factory class
specified needs to implement ManagedBeanFactory.
Looks for the context-param faces.spring.contextClass
to
determine the context class type, falling back to the default implementation
of FacesWebApplicationContext
if
not found. With the default ContextLoader implementation, any context class
specified needs to implement FacesWebApplicationContext.
Passes the context-param faces.spring.CONTEXT_FILES
to the
context instance, parsing it into potentially multiple file paths which can
be separated by any number of commas and spaces, like
"applicationContext1.xml, applicationContext2.xml". If not explicitly
specified, the context implementation is supposed to use a default location
("/WEB-INF/faces-spring-context.xml").
Above and beyond loading the faces root application context, this class tries
to obtain and hook up a shared parent context to the faces root application
context. See the loadParentContext(ServletContext)
method for more
information.
ContextLoaderListener
,
ContextLoaderServlet
,
DefaultFacesWebApplicationContext
Field Summary | |
static java.lang.String |
CONFIG_LOCATION_PARAM
Context initialization parameter name for a comma delimited list of context-relative resource paths (which is loaded automatically if it exists) containing faces-spring-context configuration information: faces.spring.CONTEXT_FILES . |
static java.lang.String |
CONTEXT_CLASS_PARAM
Config param for root faces application context implementation class FacesWebApplicationContext to use:
faces.spring.contextClass . |
static java.lang.String |
FACTORY_CLASS_PARAM
Config param for internal bean factory implementation class of the root ManagedBeanFactory to use: faces.spring.factoryClass . |
protected org.apache.commons.logging.Log |
logger
For logging. |
Constructor Summary | |
ContextLoader()
|
Method Summary | |
void |
closeFacesConfigWebApplicationContext(javax.servlet.ServletContext servletContext)
Closes the faces web application context for the given servlet context. |
protected void |
closeParentApplicationContext(javax.servlet.ServletContext servletContext,
ApplicationContext parent)
Closes the parent web application context of faces web application context for the given servlet context. |
protected FacesWebApplicationContext |
createFacesConfigWebApplicationContext(javax.servlet.ServletContext servletContext,
ApplicationContext parent)
Creates and returns a FacesWebApplicationContext . |
protected java.lang.Class |
determineContextClass(javax.servlet.ServletContext servletContext,
java.lang.String initParam,
java.lang.Class strategyClass)
Returns the WebApplicationContext implementation class to use, either the default FacesWebApplicationContext or a custom context class if specified. |
FacesWebApplicationContext |
initFacesConfigWebApplicationContext(javax.servlet.ServletContext servletContext)
Initializes faces' web application context for the given servlet context, regarding the "faces.spring.contextClass", "faces.spring.factoryClass" and "faces.spring.CONTEXT_FILES" context-params. |
protected ApplicationContext |
loadParentContext(javax.servlet.ServletContext servletContext)
Loads and returns a root parent application context for the FacesWebApplicationContext (usually an xml context based on the
"spring-beans" DTD). |
protected java.lang.String[] |
resolveFacesConfigLocations(ResourceLoader resourceLoader,
javax.servlet.ServletContext servletContext)
Returns a list with Strings identifying the faces configuration file resources. |
protected java.lang.String[] |
resolveFacesSpringConfigLocations(ResourceLoader resourceLoader,
javax.servlet.ServletContext servletContext)
Returns a list with Strings identifying the faces-spring configuration file resources. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final org.apache.commons.logging.Log logger
public static final java.lang.String CONTEXT_CLASS_PARAM
FacesWebApplicationContext
to use:
faces.spring.contextClass
.
public static final java.lang.String FACTORY_CLASS_PARAM
ManagedBeanFactory
to use: faces.spring.factoryClass
.
public static final java.lang.String CONFIG_LOCATION_PARAM
faces.spring.CONTEXT_FILES
.
Constructor Detail |
public ContextLoader()
Method Detail |
public final FacesWebApplicationContext initFacesConfigWebApplicationContext(javax.servlet.ServletContext servletContext)
servletContext
- current servlet context
BeansException
- if the context couldn't be initializedCONTEXT_CLASS_PARAM
,
FACTORY_CLASS_PARAM
,
CONFIG_LOCATION_PARAM
protected ApplicationContext loadParentContext(javax.servlet.ServletContext servletContext)
FacesWebApplicationContext
(usually an xml context based on the
"spring-beans" DTD).
servletContext
- the servlet context
BeansException
- in cases of errorsContextLoader
protected final java.lang.Class determineContextClass(javax.servlet.ServletContext servletContext, java.lang.String initParam, java.lang.Class strategyClass)
servletContext
- current servlet contextinitParam
- the ServletContext config param for a potentially defined
custom context classstrategyClass
- the key for the proper default strategy
ApplicationContextException
- if the context class couldn't be loadedCONTEXT_CLASS_PARAM
,
XmlWebApplicationContext
protected FacesWebApplicationContext createFacesConfigWebApplicationContext(javax.servlet.ServletContext servletContext, ApplicationContext parent)
FacesWebApplicationContext
.
servletContext
- the servlet contextparent
- parent application context
BeansException
- in cases of errorsprotected final java.lang.String[] resolveFacesConfigLocations(ResourceLoader resourceLoader, javax.servlet.ServletContext servletContext)
resourceLoader
- the ResourceLoader to use for loading config locationsservletContext
- the servlet context
BeansException
- in cases of errorsFacesServlet.CONFIG_FILES_ATTR
protected final java.lang.String[] resolveFacesSpringConfigLocations(ResourceLoader resourceLoader, javax.servlet.ServletContext servletContext)
resourceLoader
- the ResourceLoader to use for loading config locationsservletContext
- the servlet context
BeansException
- in cases of errorsCONFIG_LOCATION_PARAM
public final void closeFacesConfigWebApplicationContext(javax.servlet.ServletContext servletContext)
servletContext
- the servlet contextprotected void closeParentApplicationContext(javax.servlet.ServletContext servletContext, ApplicationContext parent)
loadParentContext(ServletContext)
, you may have to override
this method as well.
servletContext
- the servlet contextparent
- parent ApplicationContext
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |