FileDocCategorySizeDatePackage
JspApplicationContextImpl.javaAPI DocApache Tomcat 6.0.144466Fri Jul 20 04:20:32 BST 2007org.apache.jasper.runtime

JspApplicationContextImpl

public class JspApplicationContextImpl extends Object implements javax.servlet.jsp.JspApplicationContext
Implementation of JspApplicationContext
author
Jacob Hookom

Fields Summary
private static final String
KEY
private static final ExpressionFactory
expressionFactory
private final List
contextListeners
private final List
resolvers
private boolean
instantiated
private ELResolver
resolver
Constructors Summary
public JspApplicationContextImpl()


	  

	
Methods Summary
public voidaddELContextListener(javax.el.ELContextListener listener)

		if (listener == null) {
			throw new IllegalArgumentException("ELConextListener was null");
		}
		this.contextListeners.add(listener);
	
public voidaddELResolver(javax.el.ELResolver resolver)

		if (resolver == null) {
			throw new IllegalArgumentException("ELResolver was null");
		}
		if (this.instantiated) {
			throw new IllegalStateException(
					"cannot call addELResolver after the first request has been made");
		}
		this.resolvers.add(resolver);
	
public org.apache.jasper.el.ELContextImplcreateELContext(javax.servlet.jsp.JspContext context)

		if (context == null) {
			throw new IllegalArgumentException("JspContext was null");
		}

		// create ELContext for JspContext
		ELResolver r = this.createELResolver();
		ELContextImpl ctx = new ELContextImpl(r);
		ctx.putContext(JspContext.class, context);

		// alert all ELContextListeners
		ELContextEvent event = new ELContextEvent(ctx);
		for (int i = 0; i < this.contextListeners.size(); i++) {
			this.contextListeners.get(i).contextCreated(event);
		}

		return ctx;
	
private javax.el.ELResolvercreateELResolver()

		this.instantiated = true;
		if (this.resolver == null) {
			CompositeELResolver r = new CompositeELResolver();
			r.add(new ImplicitObjectELResolver());
			for (Iterator itr = this.resolvers.iterator(); itr.hasNext();) {
				r.add((ELResolver) itr.next());
			}
			r.add(new MapELResolver());
			r.add(new ResourceBundleELResolver());
			r.add(new ListELResolver());
			r.add(new ArrayELResolver());	
			r.add(new BeanELResolver());
			r.add(new ScopedAttributeELResolver());
			this.resolver = r;
		}
		return this.resolver;
	
public javax.el.ExpressionFactorygetExpressionFactory()

		return expressionFactory;
	
public static org.apache.jasper.runtime.JspApplicationContextImplgetInstance(javax.servlet.ServletContext context)

		if (context == null) {
			throw new IllegalArgumentException("ServletContext was null");
		}
		JspApplicationContextImpl impl = (JspApplicationContextImpl) context
				.getAttribute(KEY);
		if (impl == null) {
			impl = new JspApplicationContextImpl();
			context.setAttribute(KEY, impl);
		}
		return impl;