Search in sources :

Example 1 with ELResolver

use of javax.el.ELResolver in project sling by apache.

the class JspApplicationContextImpl method createELContext.

public ELContextImpl createELContext(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;
}
Also used : ListELResolver(javax.el.ListELResolver) BeanELResolver(javax.el.BeanELResolver) ELResolver(javax.el.ELResolver) ImplicitObjectELResolver(javax.servlet.jsp.el.ImplicitObjectELResolver) ResourceBundleELResolver(javax.el.ResourceBundleELResolver) MapELResolver(javax.el.MapELResolver) ArrayELResolver(javax.el.ArrayELResolver) CompositeELResolver(javax.el.CompositeELResolver) ScopedAttributeELResolver(javax.servlet.jsp.el.ScopedAttributeELResolver) ELContextImpl(org.apache.sling.scripting.jsp.jasper.el.ELContextImpl) ELContextEvent(javax.el.ELContextEvent)

Example 2 with ELResolver

use of javax.el.ELResolver in project camel by apache.

the class JuelExpression method createContext.

/**
     * Factory method to create the EL context
     */
protected ELContext createContext() {
    ELResolver resolver = new CompositeELResolver() {

        {
            add(new ArrayELResolver(false));
            add(new ListELResolver(false));
            add(new MapELResolver(false));
            add(new ResourceBundleELResolver());
            add(new BeanAndMethodELResolver());
        }
    };
    return new SimpleContext(resolver);
}
Also used : ListELResolver(javax.el.ListELResolver) ELResolver(javax.el.ELResolver) ResourceBundleELResolver(javax.el.ResourceBundleELResolver) MapELResolver(javax.el.MapELResolver) ArrayELResolver(javax.el.ArrayELResolver) CompositeELResolver(javax.el.CompositeELResolver) CompositeELResolver(javax.el.CompositeELResolver) SimpleContext(de.odysseus.el.util.SimpleContext) ListELResolver(javax.el.ListELResolver) ResourceBundleELResolver(javax.el.ResourceBundleELResolver) MapELResolver(javax.el.MapELResolver) ArrayELResolver(javax.el.ArrayELResolver)

Example 3 with ELResolver

use of javax.el.ELResolver in project core by weld.

the class WeldTestPhaseListener method testELResolver.

private void testELResolver(String name) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ELResolver resolver = facesContext.getApplication().getELResolver();
    ELContext elContext = facesContext.getELContext();
    Object object = resolver.getValue(elContext, null, name);
    if (object == null)
        throw new NullPointerException("ELResolver returned null");
}
Also used : FacesContext(javax.faces.context.FacesContext) ELResolver(javax.el.ELResolver) ELContext(javax.el.ELContext)

Example 4 with ELResolver

use of javax.el.ELResolver in project core by weld.

the class ELImpl method createELContext.

private ELContext createELContext(BeanManagerImpl beanManagerImpl) {
    final ELResolver resolver = createELResolver(beanManagerImpl);
    ELContext context = new ELContext() {

        @Override
        public ELResolver getELResolver() {
            return resolver;
        }

        @Override
        public FunctionMapper getFunctionMapper() {
            return null;
        }

        @Override
        public VariableMapper getVariableMapper() {
            return null;
        }
    };
    callELContextListeners(context);
    return context;
}
Also used : ListELResolver(javax.el.ListELResolver) BeanELResolver(javax.el.BeanELResolver) ELResolver(javax.el.ELResolver) ResourceBundleELResolver(javax.el.ResourceBundleELResolver) MapELResolver(javax.el.MapELResolver) ArrayELResolver(javax.el.ArrayELResolver) CompositeELResolver(javax.el.CompositeELResolver) ELContext(javax.el.ELContext)

Example 5 with ELResolver

use of javax.el.ELResolver in project tomcat70 by apache.

the class AstValue method getValue.

@Override
public Object getValue(EvaluationContext ctx) throws ELException {
    Object base = this.children[0].getValue(ctx);
    int propCount = this.jjtGetNumChildren();
    int i = 1;
    Object suffix = null;
    ELResolver resolver = ctx.getELResolver();
    while (base != null && i < propCount) {
        suffix = this.children[i].getValue(ctx);
        if (i + 1 < propCount && (this.children[i + 1] instanceof AstMethodParameters)) {
            AstMethodParameters mps = (AstMethodParameters) this.children[i + 1];
            // This is a method
            Object[] paramValues = mps.getParameters(ctx);
            base = resolver.invoke(ctx, base, suffix, getTypesFromValues(paramValues), paramValues);
            i += 2;
        } else {
            // This is a property
            if (suffix == null) {
                return null;
            }
            ctx.setPropertyResolved(false);
            base = resolver.getValue(ctx, base, suffix);
            i++;
        }
    }
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled", base, suffix));
    }
    return base;
}
Also used : ELResolver(javax.el.ELResolver) PropertyNotFoundException(javax.el.PropertyNotFoundException)

Aggregations

ELResolver (javax.el.ELResolver)15 CompositeELResolver (javax.el.CompositeELResolver)5 ArrayELResolver (javax.el.ArrayELResolver)4 ELContext (javax.el.ELContext)4 ListELResolver (javax.el.ListELResolver)4 MapELResolver (javax.el.MapELResolver)4 ResourceBundleELResolver (javax.el.ResourceBundleELResolver)4 BeanELResolver (javax.el.BeanELResolver)3 PropertyNotFoundException (javax.el.PropertyNotFoundException)3 BeanManager (javax.enterprise.inject.spi.BeanManager)3 Test (org.junit.Test)3 ELContextEvent (javax.el.ELContextEvent)2 FunctionMapper (javax.el.FunctionMapper)2 VariableMapper (javax.el.VariableMapper)2 ImplicitObjectELResolver (javax.servlet.jsp.el.ImplicitObjectELResolver)2 SimpleContext (de.odysseus.el.util.SimpleContext)1 PrivilegedAction (java.security.PrivilegedAction)1 ArrayList (java.util.ArrayList)1 Arrays.stream (java.util.Arrays.stream)1 Map (java.util.Map)1