• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ELContextImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.jasper.el.ELContextImpl的典型用法代码示例。如果您正苦于以下问题:Java ELContextImpl类的具体用法?Java ELContextImpl怎么用?Java ELContextImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ELContextImpl类属于org.apache.jasper.el包,在下文中一共展示了ELContextImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testJavaKeyWordIdentifier

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
@Test
public void testJavaKeyWordIdentifier() {
    ExpressionFactory factory = ExpressionFactory.newInstance();
    ELContext context = new ELContextImpl();

    TesterBeanA beanA = new TesterBeanA();
    beanA.setInt("five");
    ValueExpression var =
        factory.createValueExpression(beanA, TesterBeanA.class);
    context.getVariableMapper().setVariable("this", var);

    // Should fail
    Exception e = null;
    try {
        factory.createValueExpression(context, "${this}", String.class);
    } catch (ELException ele) {
        e = ele;
    }
    assertNotNull(e);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:TestELParser.java


示例2: testIsReadOnly03

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that if the ListELResolver is constructed with readOnly the method
 * will return always true, otherwise false.
 */
@Test
public void testIsReadOnly03() {
    ListELResolver resolver = new ListELResolver();
    ELContext context = new ELContextImpl();

    List<String> list = new ArrayList<String>();
    list.add("key");
    boolean result = resolver.isReadOnly(context, list, new Integer(0));

    Assert.assertFalse(result);
    Assert.assertTrue(context.isPropertyResolved());

    resolver = new ListELResolver(true);

    result = resolver.isReadOnly(context, list, new Integer(0));

    Assert.assertTrue(result);
    Assert.assertTrue(context.isPropertyResolved());
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:24,代码来源:TestListELResolver.java


示例3: testGetFeatureDescriptors02

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    BeanELResolver resolver = new BeanELResolver();
    ELContext context = new ELContextImpl();

    Iterator<FeatureDescriptor> result = resolver.getFeatureDescriptors(context, new Bean());

    while (result.hasNext()) {
        PropertyDescriptor featureDescriptor = (PropertyDescriptor) result.next();
        Assert.assertEquals(featureDescriptor.getPropertyType(),
                featureDescriptor.getValue(ELResolver.TYPE));
        Assert.assertEquals(Boolean.TRUE,
                featureDescriptor.getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:19,代码来源:TestBeanELResolver.java


示例4: testBug50105

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
@Test
public void testBug50105() {
    ExpressionFactory factory = ExpressionFactory.newInstance();
    ELContext context = new ELContextImpl();

    TesterEnum testEnum = TesterEnum.APPLE;

    ValueExpression var =
        factory.createValueExpression(testEnum, TesterEnum.class);
    context.getVariableMapper().setVariable("testEnum", var);

    // When coercing an Enum to a String, name() should always be used.
    ValueExpression ve1 = factory.createValueExpression(
            context, "${testEnum}", String.class);
    String result1 = (String) ve1.getValue(context);
    assertEquals("APPLE", result1);

    ValueExpression ve2 = factory.createValueExpression(
            context, "foo${testEnum}bar", String.class);
    String result2 = (String) ve2.getValue(context);
    assertEquals("fooAPPLEbar", result2);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:23,代码来源:TestValueExpressionImpl.java


示例5: testBug51177ObjectList

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
@Test
public void testBug51177ObjectList() {
    ExpressionFactory factory = ExpressionFactory.newInstance();
    ELContext context = new ELContextImpl();

    Object o1 = "String value";
    Object o2 = Integer.valueOf(32);

    List<Object> list = new ArrayList<Object>();
    list.add(0, o1);
    list.add(1, o2);

    ValueExpression var =
        factory.createValueExpression(list, List.class);
    context.getVariableMapper().setVariable("list", var);

    ValueExpression ve1 = factory.createValueExpression(
            context, "${list[0]}", Object.class);
    ve1.setValue(context, o2);
    assertEquals(o2, ve1.getValue(context));

    ValueExpression ve2 = factory.createValueExpression(
            context, "${list[1]}", Object.class);
    ve2.setValue(context, o1);
    assertEquals(o1, ve2.getValue(context));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:TestValueExpressionImpl.java


示例6: testBug51544Bean

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Test returning an empty list as a bean property.
 */
@Test
public void testBug51544Bean() throws Exception {
    ExpressionFactory factory = ExpressionFactory.newInstance();
    ELContext context = new ELContextImpl();

    TesterBeanA beanA = new TesterBeanA();
    beanA.setValList(Collections.emptyList());

    ValueExpression var =
        factory.createValueExpression(beanA, TesterBeanA.class);
    context.getVariableMapper().setVariable("beanA", var);

    ValueExpression ve = factory.createValueExpression(
            context, "${beanA.valList.size()}", Integer.class);

    Integer result = (Integer) ve.getValue(context);
    assertEquals(Integer.valueOf(0), result);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:22,代码来源:TestValueExpressionImpl.java


示例7: testSetValue04

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that a valid property is set.
 */
@Test
public void testSetValue04() {
    ArrayELResolver resolver = new ArrayELResolver();
    ELContext context = new ELContextImpl();

    String[] base = new String[] { "element" };
    resolver.setValue(context, base, new Integer(0), "new-element");

    Assert.assertEquals("new-element",
            resolver.getValue(context, base, new Integer(0)));
    Assert.assertTrue(context.isPropertyResolved());

    resolver.setValue(context, base, new Integer(0), null);

    Assert.assertEquals(null,
            resolver.getValue(context, base, new Integer(0)));
    Assert.assertTrue(context.isPropertyResolved());
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:22,代码来源:TestArrayELResolver.java


示例8: testGetValue05

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that the key is out of bounds and null will be returned.
 */
@Test
public void testGetValue05() {
    ArrayELResolver resolver = new ArrayELResolver();
    ELContext context = new ELContextImpl();

    String[] base = new String[] { "element" };
    Object result = resolver.getValue(context, base, new Integer(1));

    Assert.assertNull(result);
    Assert.assertTrue(context.isPropertyResolved());

    result = resolver.getValue(context, base, new Integer(-1));

    Assert.assertNull(result);
    Assert.assertTrue(context.isPropertyResolved());
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:20,代码来源:TestArrayELResolver.java


示例9: doTestBug56179

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
private void doTestBug56179(int parenthesesCount, String innerExpr) {
    ExpressionFactory factory = ExpressionFactory.newInstance();
    ELContext context = new ELContextImpl();

    ValueExpression var =
        factory.createValueExpression(Boolean.TRUE, Boolean.class);
    context.getVariableMapper().setVariable("test", var);

    StringBuilder expr = new StringBuilder();
    expr.append("${");
    for (int i = 0; i < parenthesesCount; i++) {
        expr.append("(");
    }
    expr.append(innerExpr);
    for (int i = 0; i < parenthesesCount; i++) {
        expr.append(")");
    }
    expr.append("}");
    ValueExpression ve = factory.createValueExpression(
            context, expr.toString(), String.class);

    String result = (String) ve.getValue(context);
    assertEquals("true", result);
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:25,代码来源:TestELParser.java


示例10: testIsReadOnly05

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that a result is returned even when a coercion cannot be performed.
 */
@Test
public void testIsReadOnly05() {
    ArrayELResolver resolver = new ArrayELResolver();
    ELContext context = new ELContextImpl();

    String[] base = new String[] { "element" };
    boolean result = resolver.isReadOnly(context, base, "key");

    Assert.assertFalse(result);
    Assert.assertTrue(context.isPropertyResolved());

    resolver = new ArrayELResolver(true);

    result = resolver.isReadOnly(context, base, "key");

    Assert.assertTrue(result);
    Assert.assertTrue(context.isPropertyResolved());
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:22,代码来源:TestArrayELResolver.java


示例11: testGetValueReference

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
@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
    String result = (String) ve.getValue(context);
    assertEquals("Tomcat", result);

    // Now check the value reference
    ValueReference vr = ve.getValueReference(context);
    assertNotNull(vr);

    assertEquals(beanB, vr.getBase());
    assertEquals("name", vr.getProperty());
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:26,代码来源:TestValueExpressionImpl.java


示例12: testIsReadOnly06

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that a result is returned even when a coercion cannot be performed.
 */
@Test
public void testIsReadOnly06() {
    ListELResolver resolver = new ListELResolver();
    ELContext context = new ELContextImpl();

    List<String> list = new ArrayList<String>();
    list.add("key");
    boolean result = resolver.isReadOnly(context, list, "key");

    Assert.assertFalse(result);
    Assert.assertTrue(context.isPropertyResolved());

    resolver = new ListELResolver(true);

    result = resolver.isReadOnly(context, list, "key");

    Assert.assertTrue(result);
    Assert.assertTrue(context.isPropertyResolved());
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:23,代码来源:TestListELResolver.java


示例13: testIsReadOnly03

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that if the ArrayELResolver is constructed with readOnly the method
 * will return always true, otherwise false.
 */
@Test
public void testIsReadOnly03() {
    ArrayELResolver resolver = new ArrayELResolver();
    ELContext context = new ELContextImpl();

    String[] base = new String[] { "element" };
    boolean result = resolver.isReadOnly(context, base, new Integer(0));

    Assert.assertFalse(result);
    Assert.assertTrue(context.isPropertyResolved());

    resolver = new ArrayELResolver(true);

    result = resolver.isReadOnly(context, base, new Integer(0));

    Assert.assertTrue(result);
    Assert.assertTrue(context.isPropertyResolved());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:23,代码来源:TestArrayELResolver.java


示例14: testGetValue05

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that the key is out of bounds and null will be returned.
 */
@Test
public void testGetValue05() {
    ListELResolver resolver = new ListELResolver();
    ELContext context = new ELContextImpl();

    List<String> list = new ArrayList<String>();
    list.add("key");
    Object result = resolver.getValue(context, list, new Integer(1));

    Assert.assertNull(result);
    Assert.assertTrue(context.isPropertyResolved());

    result = resolver.getValue(context, list, new Integer(-1));

    Assert.assertNull(result);
    Assert.assertTrue(context.isPropertyResolved());
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:21,代码来源:TestListELResolver.java


示例15: testIsReadOnly03

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that if the MapELResolver is constructed with readOnly the method
 * will return always true, otherwise false.
 */
@Test
public void testIsReadOnly03() {
    MapELResolver mapELResolver = new MapELResolver();
    ELContext context = new ELContextImpl();

    boolean result = mapELResolver.isReadOnly(context,
            new HashMap<Object, Object>(), new Object());

    Assert.assertFalse(result);
    Assert.assertTrue(context.isPropertyResolved());

    mapELResolver = new MapELResolver(true);

    result = mapELResolver.isReadOnly(context,
            new HashMap<Object, Object>(), new Object());

    Assert.assertTrue(result);
    Assert.assertTrue(context.isPropertyResolved());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:TestMapELResolver.java


示例16: testGetFeatureDescriptors02

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    MapELResolver mapELResolver = new MapELResolver();
    ELContext context = new ELContextImpl();

    Map<String, String> map = new HashMap<String, String>();
    map.put("key", "value");
    Iterator<FeatureDescriptor> result = mapELResolver
            .getFeatureDescriptors(context, map);

    while (result.hasNext()) {
        FeatureDescriptor featureDescriptor = result.next();
        Assert.assertEquals("key", featureDescriptor.getDisplayName());
        Assert.assertEquals("key", featureDescriptor.getName());
        Assert.assertEquals("", featureDescriptor.getShortDescription());
        Assert.assertFalse(featureDescriptor.isExpert());
        Assert.assertFalse(featureDescriptor.isHidden());
        Assert.assertTrue(featureDescriptor.isPreferred());
        Assert.assertEquals("key".getClass(),
                featureDescriptor.getValue(ELResolver.TYPE));
        Assert.assertEquals(Boolean.TRUE, featureDescriptor
                .getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:TestMapELResolver.java


示例17: testGetValue03

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
/**
 * Tests that a valid property is resolved.
 */
@Test
public void testGetValue03() {
    ResourceBundleELResolver resolver = new ResourceBundleELResolver();
    ELContext context = new ELContextImpl();

    ResourceBundle resourceBundle = new TesterResourceBundle();
    Object result = resolver.getValue(context, resourceBundle, "key1");

    Assert.assertEquals("value1", result);
    Assert.assertTrue(context.isPropertyResolved());

    result = resolver.getValue(context, resourceBundle, "unknown-key");

    Assert.assertEquals("???unknown-key???", result);
    Assert.assertTrue(context.isPropertyResolved());

    result = resolver.getValue(context, resourceBundle, null);

    Assert.assertNull(result);
    Assert.assertTrue(context.isPropertyResolved());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:25,代码来源:TestResourceBundleELResolver.java


示例18: testJavaKeyWordSuffix

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
@Test
public void testJavaKeyWordSuffix() {
    ExpressionFactory factory = ExpressionFactory.newInstance();
    ELContext context = new ELContextImpl();

    TesterBeanA beanA = new TesterBeanA();
    beanA.setInt("five");
    ValueExpression var =
        factory.createValueExpression(beanA, TesterBeanA.class);
    context.getVariableMapper().setVariable("beanA", var);

    // Should fail
    Exception e = null;
    try {
        factory.createValueExpression(context, "${beanA.int}",
                String.class);
    } catch (ELException ele) {
        e = ele;
    }
    assertNotNull(e);
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:22,代码来源:TestELParser.java


示例19: evalAttr

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
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);
    }
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:12,代码来源:TestAttributeParser.java


示例20: doNegativeTest

import org.apache.jasper.el.ELContextImpl; //导入依赖的package包/类
private void doNegativeTest(Object base, Object trigger,
        MethodUnderTest method, boolean checkResult) {
    ResourceBundleELResolver resolver = new ResourceBundleELResolver();
    ELContext context = new ELContextImpl();

    Object result = null;
    switch (method) {
    case GET_VALUE: {
        result = resolver.getValue(context, base, trigger);
        break;
    }
    case SET_VALUE: {
        resolver.setValue(context, base, trigger, new Object());
        break;
    }
    case GET_TYPE: {
        result = resolver.getType(context, base, trigger);
        break;
    }
    default: {
        // Should never happen
        Assert.fail("Missing case for method");
    }
    }

    if (checkResult) {
        Assert.assertNull(result);
    }
    Assert.assertFalse(context.isPropertyResolved());
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:31,代码来源:TestResourceBundleELResolver.java



注:本文中的org.apache.jasper.el.ELContextImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ViewAndroidDelegate类代码示例发布时间:2022-05-22
下一篇:
Java Collection类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap