WebApplicationContextVariableResolver (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.web.jsf

## Class WebApplicationContextVariableResolver

- java.lang.Object
- - javax.faces.el.VariableResolver
  - - org.springframework.web.jsf.WebApplicationContextVariableResolver

- Deprecated.
  as of Spring 3.2, in favor of the JSF 1.2 based `WebApplicationContextFacesELResolver`

      @Deprecated
      public class WebApplicationContextVariableResolver
      extends VariableResolver

  Special JSF 1.1 `VariableResolver` that exposes the Spring `WebApplicationContext` instance under a variable named "webApplicationContext".

  In contrast to `DelegatingVariableResolver`, this VariableResolver does not resolve JSF variable names as Spring bean names. It rather exposes Spring's root WebApplicationContext itself under a special name. JSF-managed beans can then use Spring's WebApplicationContext API to retrieve Spring-managed beans, access resources, etc.

  Configure this resolver in your `faces-config.xml` file as follows:

       <application>
         ...
         <variable-resolver>org.springframework.web.jsf.WebApplicationContextVariableResolver</variable-resolver>
       </application>

  Since:
    1.2.5
  Author:
    Colin Sampaleanu, Juergen Hoeller
  See Also:
    `DelegatingVariableResolver`, `FacesContextUtils.getWebApplicationContext(javax.faces.context.FacesContext)`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected VariableResolver` | `originalVariableResolver` Deprecated.
    `static String` | `WEB_APPLICATION_CONTEXT_VARIABLE_NAME` Deprecated. Name of the exposed WebApplicationContext variable: "webApplicationContext".

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebApplicationContextVariableResolver(VariableResolver originalVariableResolver)` Deprecated. Create a new WebApplicationContextVariableResolver, using the given original VariableResolver.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected VariableResolver` | `getOriginalVariableResolver()` Deprecated. Return the original JSF VariableResolver that this resolver delegates to.
    `protected WebApplicationContext` | `getWebApplicationContext(FacesContext facesContext)` Deprecated. Retrieve the WebApplicationContext reference to expose.
    `Object` | `resolveVariable(FacesContext context, String name)` Deprecated. Check for the special "webApplicationContext" variable first, then delegate to the original VariableResolver.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### WEB_APPLICATION_CONTEXT_VARIABLE_NAME

          public static final String WEB_APPLICATION_CONTEXT_VARIABLE_NAME

      Deprecated.
      Name of the exposed WebApplicationContext variable: "webApplicationContext".
      See Also:
        Constant Field Values

    - #### originalVariableResolver

          protected final VariableResolver originalVariableResolver

      Deprecated.

  - ### Constructor Detail

    - #### WebApplicationContextVariableResolver

          public WebApplicationContextVariableResolver(VariableResolver originalVariableResolver)

      Deprecated.
      Create a new WebApplicationContextVariableResolver, using the given original VariableResolver.

      A JSF implementation will automatically pass its original resolver into the constructor of a configured resolver, provided that there is a corresponding constructor argument.

      Parameters:
        `originalVariableResolver` - the original VariableResolver

  - ### Method Detail

    - #### getOriginalVariableResolver

          protected final VariableResolver getOriginalVariableResolver()

      Deprecated.
      Return the original JSF VariableResolver that this resolver delegates to. Used to resolve standard JSF-managed beans.

    - #### resolveVariable

          public Object resolveVariable(FacesContext context,
                               String name)
                                 throws EvaluationException

      Deprecated.
      Check for the special "webApplicationContext" variable first, then delegate to the original VariableResolver.

      If no WebApplicationContext is available, all requests will be delegated to the original VariableResolver.

      Specified by:
        `resolveVariable` in class `VariableResolver`
      Throws:
        `EvaluationException`

    - #### getWebApplicationContext

          protected WebApplicationContext getWebApplicationContext(FacesContext facesContext)

      Deprecated.
      Retrieve the WebApplicationContext reference to expose.

      The default implementation delegates to FacesContextUtils, returning `null` if no WebApplicationContext found.

      Parameters:
        `facesContext` - the current JSF context
      Returns:
        the Spring web application context
      See Also:
        `FacesContextUtils.getWebApplicationContext(javax.faces.context.FacesContext)`