WebApplicationContextFacesELResolver
@Deprecated public class WebApplicationContextVariableResolver extends javax.faces.el.VariableResolver
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>
DelegatingVariableResolver
,
FacesContextUtils.getWebApplicationContext(javax.faces.context.FacesContext)
Modifier and Type | Field and Description |
---|---|
protected javax.faces.el.VariableResolver |
originalVariableResolver
Deprecated.
|
static String |
WEB_APPLICATION_CONTEXT_VARIABLE_NAME
Deprecated.
Name of the exposed WebApplicationContext variable: "webApplicationContext".
|
Constructor and Description |
---|
WebApplicationContextVariableResolver(javax.faces.el.VariableResolver originalVariableResolver)
Deprecated.
Create a new WebApplicationContextVariableResolver, using the given
original VariableResolver.
|
Modifier and Type | Method and Description |
---|---|
protected javax.faces.el.VariableResolver |
getOriginalVariableResolver()
Deprecated.
Return the original JSF VariableResolver that this resolver delegates to.
|
protected WebApplicationContext |
getWebApplicationContext(javax.faces.context.FacesContext facesContext)
Deprecated.
Retrieve the WebApplicationContext reference to expose.
|
Object |
resolveVariable(javax.faces.context.FacesContext context,
String name)
Deprecated.
Check for the special "webApplicationContext" variable first,
then delegate to the original VariableResolver.
|
public static final String WEB_APPLICATION_CONTEXT_VARIABLE_NAME
protected final javax.faces.el.VariableResolver originalVariableResolver
public WebApplicationContextVariableResolver(javax.faces.el.VariableResolver originalVariableResolver)
A JSF implementation will automatically pass its original resolver into the constructor of a configured resolver, provided that there is a corresponding constructor argument.
originalVariableResolver
- the original VariableResolverprotected final javax.faces.el.VariableResolver getOriginalVariableResolver()
public Object resolveVariable(javax.faces.context.FacesContext context, String name) throws javax.faces.el.EvaluationException
If no WebApplicationContext is available, all requests will be delegated to the original VariableResolver.
resolveVariable
in class javax.faces.el.VariableResolver
javax.faces.el.EvaluationException
protected WebApplicationContext getWebApplicationContext(javax.faces.context.FacesContext facesContext)
The default implementation delegates to FacesContextUtils,
returning null
if no WebApplicationContext found.
facesContext
- the current JSF contextFacesContextUtils.getWebApplicationContext(javax.faces.context.FacesContext)
Copyright © 2015. All rights reserved.