Package org.springframework.expression.spel.standard

Examples of org.springframework.expression.spel.standard.SpelExpressionParser


        String expression = (String)bean.get("expression");       
        if(expression==null||expression.equals(""))//表达式为空,默认为denyAll
          expression="denyAll";
       
        //表达式不为空,则由authentication来判断       
        Expression expr = new SpelExpressionParser().parseExpression(expression);
        if(ExpressionUtils.evaluateAsBoolean(expr, ctx))
          UIs.add(path);       
      }
    }
    return UIs;
View Full Code Here


        return true;
    }

    public int vote(Authentication authentication, State object, Collection<ConfigAttribute> attributes) {
        EvaluationContext ctx = expressionHandler.createEvaluationContext(authentication, object);
        ExpressionParser parser = new SpelExpressionParser();
        Expression exp = parser.parseExpression(attributes.iterator().next().getAttribute());
        return ExpressionUtils.evaluateAsBoolean(exp, ctx) ? ACCESS_GRANTED : ACCESS_DENIED;
    }
View Full Code Here

    private final SpelExpressionParser expressionParser;

    public SpelExpression(String expressionString, Class<?> type) {
        this.expressionString = expressionString;
        this.type = type;
        this.expressionParser = new SpelExpressionParser();
    }
View Full Code Here

    private final SpelExpressionParser expressionParser;

    public SpelExpression(String expressionString, Class<?> type) {
        this.expressionString = expressionString;
        this.type = type;
        this.expressionParser = new SpelExpressionParser();
    }
View Full Code Here

  }

  private SpringELExpressionParser createExpressionParser() {
    StringToDate c = new StringToDate();
    c.setPattern("yyyy-MM-dd");
    SpringELExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    GenericConversionService cs = (GenericConversionService) parser.getConversionService();
    cs.addConverter(c);
    return parser;
  }
View Full Code Here

    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = EasyMock.createMock(org.springframework.web.servlet.View.class);
    AbstractMvcView view = new PortletMvcView(mvcView, context);
    view.setExpressionParser(new WebFlowSpringELExpressionParser(new SpelExpressionParser()));
    view.setMessageCodesResolver(new WebFlowMessageCodesResolver());
    view.processUserEvent();
    assertEquals(true, bindBean.getBooleanProperty());
  }
View Full Code Here

    context.getFlowScope().getRequired("var1", ArrayList.class);
  }

  public void testStartWithMapper() {
    DefaultMapper attributeMapper = new DefaultMapper();
    ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    Expression x = parser.parseExpression("attr", new FluentParserContext().evaluate(AttributeMap.class));
    Expression y = parser.parseExpression("flowScope.attr",
        new FluentParserContext().evaluate(RequestContext.class));
    attributeMapper.addMapping(new DefaultMapping(x, y));
    flow.setInputMapper(attributeMapper);
View Full Code Here

    assertEquals("foo", context.getFlowScope().get("attr"));
  }

  public void testStartWithMapperButNoInput() {
    DefaultMapper attributeMapper = new DefaultMapper();
    ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    Expression x = parser.parseExpression("attr", new FluentParserContext().evaluate(AttributeMap.class));
    Expression y = parser.parseExpression("flowScope.attr",
        new FluentParserContext().evaluate(RequestContext.class));
    attributeMapper.addMapping(new DefaultMapping(x, y));
    flow.setInputMapper(attributeMapper);
View Full Code Here

    assertEquals(1, action.getExecutionCount());
  }

  public void testEndWithOutputMapper() {
    DefaultMapper attributeMapper = new DefaultMapper();
    ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    Expression x = parser.parseExpression("flowScope.attr",
        new FluentParserContext().evaluate(RequestContext.class));
    Expression y = parser.parseExpression("attr", new FluentParserContext().evaluate(MutableAttributeMap.class));
    attributeMapper.addMapping(new DefaultMapping(x, y));
    flow.setOutputMapper(attributeMapper);
View Full Code Here

      return getFlowBuilderServicesBuilder().setConversionService(customConversionService()).build();
    }

    @Bean
    public WebFlowSpringELExpressionParser customExpressionParser() {
      return new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    }
View Full Code Here

TOP

Related Classes of org.springframework.expression.spel.standard.SpelExpressionParser

Copyright © 2018 www.massapicom. 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.