Class JspApplicationContextImpl
- java.lang.Object
-
- org.apache.jasper.runtime.JspApplicationContextImpl
-
- All Implemented Interfaces:
JspApplicationContext
public class JspApplicationContextImpl extends java.lang.Object implements JspApplicationContext
-
-
Field Summary
Fields Modifier and Type Field Description private javax.servlet.ServletContextcontextprivate java.util.ArrayList<javax.el.ELResolver>elResolversprivate javax.el.ExpressionFactoryexpressionFactoryprivate java.util.ArrayList<javax.el.ELContextListener>listenersprivate static java.util.Map<javax.servlet.ServletContext,JspApplicationContextImpl>map
-
Constructor Summary
Constructors Constructor Description JspApplicationContextImpl(javax.servlet.ServletContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddELContextListener(javax.el.ELContextListener listener)Registers aELContextListeners so that context objects can be added whenever a newELContextis created.voidaddELResolver(javax.el.ELResolver resolver)Adds anELResolverto affect the way EL variables and properties are resolved for EL expressions appearing in JSP pages and tag files.protected javax.el.ELContextcreateELContext(javax.el.ELResolver resolver)protected static JspApplicationContextImplfindJspApplicationContext(javax.servlet.ServletContext context)protected java.util.Iterator<javax.el.ELResolver>getELResolvers()javax.el.ExpressionFactorygetExpressionFactory()Returns a factory used to createValueExpressions andMethodExpressions so that EL expressions can be parsed and evaluated.static voidremoveJspApplicationContext(javax.servlet.ServletContext context)voidsetExpressionFactory(javax.el.ExpressionFactory expressionFactory)
-
-
-
Field Detail
-
map
private static java.util.Map<javax.servlet.ServletContext,JspApplicationContextImpl> map
-
elResolvers
private java.util.ArrayList<javax.el.ELResolver> elResolvers
-
listeners
private java.util.ArrayList<javax.el.ELContextListener> listeners
-
context
private javax.servlet.ServletContext context
-
expressionFactory
private javax.el.ExpressionFactory expressionFactory
-
-
Method Detail
-
addELResolver
public void addELResolver(javax.el.ELResolver resolver)
Description copied from interface:JspApplicationContextAdds anELResolverto affect the way EL variables and properties are resolved for EL expressions appearing in JSP pages and tag files.For example, in the EL expression ${employee.lastName}, an
ELResolverdetermines what object "employee" references and how to find its "lastName" property.When evaluating an expression, the JSP container will consult a set of standard resolvers as well as any resolvers registered via this method. The set of resolvers are consulted in the following order:
ImplicitObjectELResolverELResolvers registered via this method, in the order in which they are registered.MapELResolverListELResolverArrayELResolverBeanELResolverScopedAttributeELResolver
It is illegal to register an
ELResolverafter the application has received any request from the client. If an attempt is made to register anELResolverafter that time, anIllegalStateExceptionis thrown.This restriction is in place to allow the JSP container to optimize for the common case where no additional
ELResolvers are in the chain, aside from the standard ones. It is permissible to addELResolvers before or after initialization to aCompositeELResolverthat is already in the chain.It is not possible to remove an
ELResolverregistered with this method, once it has been registered.- Specified by:
addELResolverin interfaceJspApplicationContext- Parameters:
resolver- The newELResolver
-
getExpressionFactory
public javax.el.ExpressionFactory getExpressionFactory()
Description copied from interface:JspApplicationContextReturns a factory used to createValueExpressions andMethodExpressions so that EL expressions can be parsed and evaluated.- Specified by:
getExpressionFactoryin interfaceJspApplicationContext- Returns:
- A concrete implementation of the an
ExpressionFactory.
-
setExpressionFactory
public void setExpressionFactory(javax.el.ExpressionFactory expressionFactory)
-
addELContextListener
public void addELContextListener(javax.el.ELContextListener listener)
Description copied from interface:JspApplicationContextRegisters aELContextListeners so that context objects can be added whenever a newELContextis created.At a minimum, the
ELContextobjects created will contain a reference to theJspContextfor this request, which is added by the JSP container. This is sufficient for all the defaultELResolvers listed inJspApplicationContext.addELResolver(javax.el.ELResolver). Note thatJspContext.classis used as the key to ELContext.putContext() for theJspContextobject reference.This method is generally used by frameworks and applications that register their own
ELResolverthat needs context other thanJspContext. The listener will typically add the necessary context to theELContextprovided in the event object. Registering a listener that adds context allows theELResolvers in the stack to access the context they need when they do a resolution.- Specified by:
addELContextListenerin interfaceJspApplicationContext- Parameters:
listener- The listener to be notified when a newELContextis created.
-
createELContext
protected javax.el.ELContext createELContext(javax.el.ELResolver resolver)
-
findJspApplicationContext
protected static JspApplicationContextImpl findJspApplicationContext(javax.servlet.ServletContext context)
-
removeJspApplicationContext
public static void removeJspApplicationContext(javax.servlet.ServletContext context)
-
getELResolvers
protected java.util.Iterator<javax.el.ELResolver> getELResolvers()
-
-