Java Code Examples for org.apache.jasper.el.ELContextImpl#setFunctionMapper()

The following examples show how to use org.apache.jasper.el.ELContextImpl#setFunctionMapper() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Validator.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private void prepareExpression(ELNode.Nodes el, Node n, String expr)
        throws JasperException {
    validateFunctions(el, n);

    // test it out
    ELContextImpl ctx = new ELContextImpl(expressionFactory);
    ctx.setFunctionMapper(this.getFunctionMapper(el));
    ExpressionFactory ef = this.pageInfo.getExpressionFactory();
    try {
        ef.createValueExpression(ctx, expr, Object.class);
    } catch (ELException e) {
        throw new JasperException(e);
    }
}
 
Example 2
Source File: TestELEvaluation.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private String evaluateExpression(String expression) {
    ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
    ELContextImpl ctx = new ELContextImpl(exprFactory);
    ctx.setFunctionMapper(new TesterFunctions.FMapper());
    ValueExpression ve = exprFactory.createValueExpression(ctx, expression,
            String.class);
    return (String) ve.getValue(ctx);
}
 
Example 3
Source File: TestAttributeParser.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private String evalAttr(String expression, char quote) {

        ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
        ELContextImpl ctx = new ELContextImpl(exprFactory);
        ctx.setFunctionMapper(new TesterFunctions.FMapper());
        ValueExpression ve = exprFactory.createValueExpression(ctx,
                AttributeParser.getUnquoted(expression, quote, false, false,
                        false, false),
                String.class);
        return (String) ve.getValue(ctx);
    }
 
Example 4
Source File: Validator.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
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) {

    }
}
 
Example 5
Source File: TestELEvaluation.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
private String evaluateExpression(String expression) {
    ELContextImpl ctx = new ELContextImpl();
    ctx.setFunctionMapper(new FMapper());
    ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
    ValueExpression ve = exprFactory.createValueExpression(ctx, expression,
            String.class);
    return (String) ve.getValue(ctx);
}
 
Example 6
Source File: TestAttributeParser.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
private String evalAttr(String expression, char quote) {

        ELContextImpl ctx = new ELContextImpl();
        ctx.setFunctionMapper(new FMapper());
        ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
        ValueExpression ve = exprFactory.createValueExpression(ctx,
                AttributeParser.getUnquoted(expression, quote, false, false,
                        false, false),
                String.class);
        return (String) ve.getValue(ctx);
    }
 
Example 7
Source File: Validator.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
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) {

    }
}
 
Example 8
Source File: TestELEvaluation.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
private String evaluateExpression(String expression) {
    ELContextImpl ctx = new ELContextImpl();
    ctx.setFunctionMapper(new FMapper());
    ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
    ValueExpression ve = exprFactory.createValueExpression(ctx, expression,
            String.class);
    return (String) ve.getValue(ctx);
}
 
Example 9
Source File: TestAttributeParser.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
private String evalAttr(String expression, char quote) {

        ELContextImpl ctx = new ELContextImpl();
        ctx.setFunctionMapper(new FMapper());
        ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
        ValueExpression ve = exprFactory.createValueExpression(ctx,
                AttributeParser.getUnquoted(expression, quote, false, false,
                        false, false),
                String.class);
        return (String) ve.getValue(ctx);
    }