Package org.springframework.expression

Examples of org.springframework.expression.EvaluationContext


        if (weca == null) {
            return ACCESS_ABSTAIN;
        }

        EvaluationContext ctx = expressionHandler.createEvaluationContext(authentication, fi);

        return ExpressionUtils.evaluateAsBoolean(weca.getAuthorizeExpression(), ctx) ?
                ACCESS_GRANTED : ACCESS_DENIED;
    }
View Full Code Here


        SpelExpressionParser parser = new SpelExpressionParser();
        expression = parser.parseExpression(el);
    }

    public boolean matches(HttpServletRequest request) {
        EvaluationContext context = createELContext(request);
        return expression.getValue(context, Boolean.class).booleanValue();
    }
View Full Code Here



    private static TypeConverter getSpringConversionService(final IProcessingContext processingContext) {

        final EvaluationContext evaluationContext =
                (EvaluationContext) processingContext.getContext().getVariables().
                        get(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME);

        if (evaluationContext != null) {
            return evaluationContext.getTypeConverter();
        }

        return null;

    }
View Full Code Here

            }

            final Map<String,Object> contextVariables =
                    computeExpressionObjects(configuration, processingContext);

            EvaluationContext baseEvaluationContext =
                    (EvaluationContext) processingContext.getContext().getVariables().
                            get(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME);

            if (baseEvaluationContext == null) {
                // Using a standard one as base: we are losing bean resolution and conversion service!!
View Full Code Here



    private static TypeConverter getSpringConversionService(final IProcessingContext processingContext) {

        final EvaluationContext evaluationContext =
                (EvaluationContext) processingContext.getContext().getVariables().
                        get(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME);

        if (evaluationContext != null) {
            return evaluationContext.getTypeConverter();
        }

        return null;

    }
View Full Code Here

            }

            final Map<String,Object> contextVariables =
                    computeExpressionObjects(configuration, processingContext);

            EvaluationContext baseEvaluationContext =
                    (EvaluationContext) processingContext.getContext().getVariables().
                            get(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME);

            if (baseEvaluationContext == null) {
                // Using a standard one as base: we are losing bean resolution and conversion service!!
View Full Code Here

   * @throws SpelEvaluationException if there is a problem locating the constructor
   */
  private ConstructorExecutor findExecutorForConstructor(String typename, List<TypeDescriptor> argumentTypes,
      ExpressionState state) throws SpelEvaluationException {

    EvaluationContext eContext = state.getEvaluationContext();
    List<ConstructorResolver> cResolvers = eContext.getConstructorResolvers();
    if (cResolvers != null) {
      for (ConstructorResolver ctorResolver : cResolvers) {
        try {
          ConstructorExecutor cEx = ctorResolver.resolve(state.getEvaluationContext(), typename,
              argumentTypes);
View Full Code Here

    // Try and treat the index value as a property of the context object
    // TODO could call the conversion service to convert the value to a String   
    if (indexValue.getTypeDescriptor().getType()==String.class) {
      Class<?> targetObjectRuntimeClass = getObjectClass(targetObject);
      String name = (String)indexValue.getValue();
      EvaluationContext eContext = state.getEvaluationContext();

      try {
        if (cachedReadName!=null && cachedReadName.equals(name) && cachedReadTargetType!=null && cachedReadTargetType.equals(targetObjectRuntimeClass)) {
          // it is OK to use the cached accessor
          return cachedReadAccessor.read(eContext, targetObject, name);
View Full Code Here

    // Try and treat the index value as a property of the context object   
    // TODO could call the conversion service to convert the value to a String   
    if (index.getTypeDescriptor().getType() == String.class) {
      Class<?> contextObjectClass = getObjectClass(contextObject.getValue());
      String name = (String)index.getValue();
      EvaluationContext eContext = state.getEvaluationContext();
      try {
        if (cachedWriteName!=null && cachedWriteName.equals(name) && cachedWriteTargetType!=null && cachedWriteTargetType.equals(contextObjectClass)) {
          // it is OK to use the cached accessor
          cachedWriteAccessor.write(eContext, targetObject, name,newValue);
          return;
View Full Code Here

      }
    }

    Class<?> contextObjectClass = getObjectClass(contextObject.getValue());
    List<PropertyAccessor> accessorsToTry = getPropertyAccessorsToTry(contextObjectClass, state);
    EvaluationContext eContext = state.getEvaluationContext();

    // Go through the accessors that may be able to resolve it. If they are a cacheable accessor then
    // get the accessor and use it. If they are not cacheable but report they can read the property
    // then ask them to read it
    if (accessorsToTry != null) {
View Full Code Here

TOP

Related Classes of org.springframework.expression.EvaluationContext

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.