SourceForge.net Logo

org.springframework.web.jsf
Class VariableResolverImpl

java.lang.Object
  extended byjavax.faces.el.VariableResolver
      extended byorg.springframework.web.jsf.VariableResolverImpl

public class VariableResolverImpl
extends VariableResolver

VariableResolver implementation that builds up a WebApplicationContext using the inner class VariableResolverImpl.FacesWebApplicationContext based on the typical faces configuration files:

This implementation trys to load a parent Spring context for the FacesWebApplicationContext in such a manner described in ContextLoader.

The FacesWebApplicationContext supports all the features described in WebApplicationContext, e.g.:

Note:
Example for integrating this VariableResolver:
WEB-INF/faces-config.xml
<application>
  <variable-resolver>org.springframework.web.jsf.VariableResolverImpl</variable-resolver>
</application>

Author:
Andreas Kuhrwahl, Thomas Jachmann, Mike Youngstrom
See Also:
WebApplicationContext

Nested Class Summary
protected  class VariableResolverImpl.FacesListableBeanFactory
           ConfigurableListableBeanFactory implementation used as internal bean factory for the VariableResolverImpl.FacesWebApplicationContext.
protected  class VariableResolverImpl.FacesWebApplicationContext
          WebApplicationContext implementation that takes configuration from a faces configuration XML document.
 
Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
VariableResolverImpl()
          Default constructor.
 
Method Summary
protected  java.util.List configLocations(javax.servlet.ServletContext servletContext)
          Returns a list with Strings identifying the faces configuration files resources
protected  VariableResolverImpl.FacesWebApplicationContext createFacesWebApplicationContext(javax.servlet.ServletContext servletContext, ApplicationContext parent)
          Creates and return a VariableResolverImpl.FacesWebApplicationContext.
protected  void finalize()
          Closes the faces WebApplicationContext.
protected  VariableResolverImpl.FacesWebApplicationContext getFacesApplicationContext(FacesContext context)
           
protected  ApplicationContext loadParentContext(javax.servlet.ServletContext context)
          Loads and returns a root parent application context for the VariableResolverImpl.FacesWebApplicationContext (usually a xml context based on the "spring-beans" DTD).
 java.lang.Object resolveVariable(FacesContext context, java.lang.String name)
          Checks wether there is a bean with name name in the VariableResolverImpl.FacesWebApplicationContext and returns it.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

VariableResolverImpl

public VariableResolverImpl()
Default constructor.

Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Closes the faces WebApplicationContext.

Throws:
ApplicationContextException - if there were fatal errors closing the ApplicationContext
java.lang.Throwable

resolveVariable

public java.lang.Object resolveVariable(FacesContext context,
                                        java.lang.String name)
                                 throws EvaluationException
Checks wether there is a bean with name name in the VariableResolverImpl.FacesWebApplicationContext and returns it. Otherwise delegates to the encapsulated original VariableResolver.

Parameters:
context - context against which to resolve the bean name
name - name of the bean to be resolved
Throws:
EvaluationException - if an exception is thrown while resolving the variable name
java.lang.NullPointerException - if context or name is null
See Also:
VariableResolver.resolveVariable(javax.faces.context.FacesContext, java.lang.String), VariableResolverImpl.FacesWebApplicationContext

createFacesWebApplicationContext

protected VariableResolverImpl.FacesWebApplicationContext createFacesWebApplicationContext(javax.servlet.ServletContext servletContext,
                                                                                           ApplicationContext parent)
                                                                                    throws BeansException
Creates and return a VariableResolverImpl.FacesWebApplicationContext.

Parameters:
servletContext -
parent - parent application context
Returns:
FacesWebApplicationContext
Throws:
BeansException

configLocations

protected java.util.List configLocations(javax.servlet.ServletContext servletContext)
                                  throws BeansException
Returns a list with Strings identifying the faces configuration files resources

Throws:
BeansException

loadParentContext

protected ApplicationContext loadParentContext(javax.servlet.ServletContext context)
                                        throws BeansException
Loads and returns a root parent application context for the VariableResolverImpl.FacesWebApplicationContext (usually a xml context based on the "spring-beans" DTD).

Throws:
BeansException
See Also:
ContextLoader

getFacesApplicationContext

protected final VariableResolverImpl.FacesWebApplicationContext getFacesApplicationContext(FacesContext context)
Returns:
the VariableResolverImpl.FacesWebApplicationContext

SourceForge.net Logo