Package org.springframework.web.jsf.el
Class WebApplicationContextFacesELResolver
- java.lang.Object
- javax.el.ELResolver
- org.springframework.web.jsf.el.WebApplicationContextFacesELResolver
public class WebApplicationContextFacesELResolver extends ELResolver
Special JSFELResolverthat exposes the SpringWebApplicationContextinstance under a variable named "webApplicationContext".In contrast to
SpringBeanFacesELResolver, this ELResolver variant does not resolve JSF variable names as Spring bean names. It rather exposes Spring's root WebApplicationContext itself under a special name, and is able to resolve "webApplicationContext.mySpringManagedBusinessObject" dereferences to Spring-defined beans in that application context.Configure this resolver in your
faces-config.xmlfile as follows:<application> ... <el-resolver>org.springframework.web.jsf.el.WebApplicationContextFacesELResolver</el-resolver> </application>
- Since:
- 2.5
- Author:
- Juergen Hoeller
- See Also:
SpringBeanFacesELResolver,FacesContextUtils.getWebApplicationContext(javax.faces.context.FacesContext)
Field Summary
Fields Modifier and Type Field Description protected LogloggerLogger available to subclasses.static StringWEB_APPLICATION_CONTEXT_VARIABLE_NAMEName of the exposed WebApplicationContext variable: "webApplicationContext".Fields inherited from class javax.el.ELResolver
RESOLVABLE_AT_DESIGN_TIME, TYPE
Constructor Summary
Constructors Constructor Description WebApplicationContextFacesELResolver()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>getCommonPropertyType(ELContext elContext, Object base)Iterator<FeatureDescriptor>getFeatureDescriptors(ELContext elContext, Object base)Class<?>getType(ELContext elContext, Object base, Object property)ObjectgetValue(ELContext elContext, Object base, Object property)protected WebApplicationContextgetWebApplicationContext(ELContext elContext)Retrieve theWebApplicationContextreference to expose.booleanisReadOnly(ELContext elContext, Object base, Object property)voidsetValue(ELContext elContext, Object base, Object property, Object value)Methods inherited from class javax.el.ELResolver
convertToType, invoke
Field Detail
WEB_APPLICATION_CONTEXT_VARIABLE_NAME
public static final String WEB_APPLICATION_CONTEXT_VARIABLE_NAME
Name of the exposed WebApplicationContext variable: "webApplicationContext".- See Also:
- Constant Field Values
Constructor Detail
WebApplicationContextFacesELResolver
public WebApplicationContextFacesELResolver()
Method Detail
getValue
@Nullable public Object getValue(ELContext elContext, @Nullable Object base, Object property) throws ELException
- Specified by:
getValuein classELResolver- Throws:
ELException
getType
@Nullable public Class<?> getType(ELContext elContext, @Nullable Object base, Object property) throws ELException
- Specified by:
getTypein classELResolver- Throws:
ELException
setValue
public void setValue(ELContext elContext, Object base, Object property, Object value) throws ELException
- Specified by:
setValuein classELResolver- Throws:
ELException
isReadOnly
public boolean isReadOnly(ELContext elContext, Object base, Object property) throws ELException
- Specified by:
isReadOnlyin classELResolver- Throws:
ELException
getFeatureDescriptors
@Nullable public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext elContext, Object base)
- Specified by:
getFeatureDescriptorsin classELResolver
getCommonPropertyType
public Class<?> getCommonPropertyType(ELContext elContext, Object base)
- Specified by:
getCommonPropertyTypein classELResolver
getWebApplicationContext
@Nullable protected WebApplicationContext getWebApplicationContext(ELContext elContext)
Retrieve theWebApplicationContextreference to expose.The default implementation delegates to
FacesContextUtils, returningnullif noWebApplicationContextfound.- Parameters:
elContext- the current JSF ELContext- Returns:
- the Spring web application context
- See Also:
FacesContextUtils.getWebApplicationContext(javax.faces.context.FacesContext)