Examples of ELContextImpl


Examples of org.apache.jasper.el.ELContextImpl

      try {
        retValue = AccessController
            .doPrivileged(new PrivilegedExceptionAction() {

              public Object run() throws Exception {
                                ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
                                ctx.setFunctionMapper(new FunctionMapperImpl(functionMap));
                ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
                                return ve.getValue(ctx);
              }
            });
      } catch (PrivilegedActionException ex) {
        Exception realEx = ex.getException();
        if (realEx instanceof ELException) {
          throw (ELException) realEx;
        } else {
          throw new ELException(realEx);
        }
      }
    } else {
            ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
            ctx.setFunctionMapper(new FunctionMapperImpl(functionMap));
            ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
            retValue = ve.getValue(ctx);
    }
    if (escape && retValue != null) {
      retValue = XmlEscape(retValue.toString());
View Full Code Here

Examples of org.apache.jasper.el.ELContextImpl

            try {
                retValue = AccessController
                        .doPrivileged(new PrivilegedExceptionAction() {

                            public Object run() throws Exception {
                                ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
                                ctx.setFunctionMapper(new FunctionMapperImpl(functionMap));
                                ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
                                return ve.getValue(ctx);
                            }
                        });
            } catch (PrivilegedActionException ex) {
                Exception realEx = ex.getException();
                if (realEx instanceof ELException) {
                    throw (ELException) realEx;
                } else {
                    throw new ELException(realEx);
                }
            }
        } else {
            ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
            ctx.setFunctionMapper(new FunctionMapperImpl(functionMap));
            ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
            retValue = ve.getValue(ctx);
        }
        if (escape && retValue != null) {
            retValue = XmlEscape(retValue.toString());
View Full Code Here

Examples of org.apache.jasper.el.ELContextImpl

                                        validateFunctions(el, n);
                                        jspAttrs[i] = new Node.JspAttribute(tldAttrs[j],
                                                attrs.getQName(i), attrs.getURI(i),
                                                attrs.getLocalName(i),
                                                attrs.getValue(i), false, el, false);
                                        ELContextImpl ctx = new ELContextImpl();
                                        ctx.setFunctionMapper(getFunctionMapper(el));
                                        try {
                                            jspAttrs[i].validateEL(this.pageInfo.getExpressionFactory(), ctx);
                                        } catch (ELException e) {
                                            this.err.jspError(n.getStart(),
                                                    "jsp.error.invalid.expression",
View Full Code Here

Examples of org.apache.jasper.el.ELContextImpl

                        validateFunctions(el, n);

                        result = new Node.JspAttribute(tai, qName, uri,
                                localName, value, false, el, dynamic);

                        ELContextImpl ctx = new ELContextImpl();
                        ctx.setFunctionMapper(getFunctionMapper(el));

                        try {
                            result.validateEL(this.pageInfo
                                    .getExpressionFactory(), ctx);
                        } catch (ELException e) {
View Full Code Here

Examples of org.apache.jasper.el.ELContextImpl

        private void prepareExpression(ELNode.Nodes el, Node n, String expr)
                throws JasperException {
            validateFunctions(el, n);

            // test it out
            ELContextImpl ctx = new ELContextImpl();
            ctx.setFunctionMapper(this.getFunctionMapper(el));
            ExpressionFactory ef = this.pageInfo.getExpressionFactory();
            try {
                ef.createValueExpression(ctx, expr, Object.class);
            } catch (ELException e) {
View Full Code Here

Examples of org.apache.jasper.el.ELContextImpl

      throw new IllegalArgumentException("JspContext was null");
    }

    // create ELContext for JspContext
        final ELResolver r = this.createELResolver();
        ELContextImpl ctx;
        if (Constants.IS_SECURITY_ENABLED) {
            ctx = AccessController.doPrivileged(
                    new PrivilegedAction<ELContextImpl>() {
                        public ELContextImpl run() {
                            return new ELContextImpl(r);
                        }
                    });
        } else {
            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);
View Full Code Here

Examples of org.apache.jasper.el.ELContextImpl

                                        validateFunctions(el, n);
                                        jspAttrs[i] = new Node.JspAttribute(tldAttr,
                                                attrs.getQName(i), attrs.getURI(i),
                                                attrs.getLocalName(i),
                                                attrs.getValue(i), false, el, false);
                                        ELContextImpl ctx = new ELContextImpl();
                                        ctx.setFunctionMapper(getFunctionMapper(el));
                                        try {
                                            jspAttrs[i].validateEL(this.pageInfo.getExpressionFactory(), ctx);
                                        } catch (ELException e) {
                                            this.err.jspError(n.getStart(),
                                                    "jsp.error.invalid.expression",
View Full Code Here

Examples of org.apache.jasper.el.ELContextImpl

                        validateFunctions(el, n);

                        result = new Node.JspAttribute(tai, qName, uri,
                                localName, value, false, el, dynamic);

                        ELContextImpl ctx = new ELContextImpl();
                        ctx.setFunctionMapper(getFunctionMapper(el));

                        try {
                            result.validateEL(this.pageInfo
                                    .getExpressionFactory(), ctx);
                        } catch (ELException e) {
View Full Code Here

Examples of org.apache.jasper.el.ELContextImpl

        private void prepareExpression(ELNode.Nodes el, Node n, String expr)
                throws JasperException {
            validateFunctions(el, n);

            // test it out
            ELContextImpl ctx = new ELContextImpl();
            ctx.setFunctionMapper(this.getFunctionMapper(el));
            ExpressionFactory ef = this.pageInfo.getExpressionFactory();
            try {
                ef.createValueExpression(ctx, expr, Object.class);
            } catch (ELException e) {
View Full Code Here

Examples of org.apache.jasper.el.ELContextImpl

public class TestValueExpressionImpl {

    @Test
    public void testGetValueReference() {
        ExpressionFactory factory = ExpressionFactory.newInstance();
        ELContext context = new ELContextImpl();
       
        TesterBeanB beanB = new TesterBeanB();
        beanB.setName("Tomcat");
        ValueExpression var =
            factory.createValueExpression(beanB, TesterBeanB.class);
        context.getVariableMapper().setVariable("beanB", var);

        ValueExpression ve = factory.createValueExpression(
                context, "${beanB.name}", String.class);

        // First check the basics work
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.