Package org.thymeleaf.standard.expression

Examples of org.thymeleaf.standard.expression.IStandardExpression


        final String domainObjectExpression = attributeValue.substring(0,separatorPos).trim();
        final String permissionsExpression = attributeValue.substring(separatorPos + 2).trim();

        final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);

        final IStandardExpression domainObjectExpr =
                getExpressionDefaultToLiteral(expressionParser, configuration, arguments, domainObjectExpression);
        final IStandardExpression permissionsExpr =
                getExpressionDefaultToLiteral(expressionParser, configuration, arguments, permissionsExpression);

        final Object domainObject = domainObjectExpr.execute(configuration, arguments);
       
        final Object permissionsObject = permissionsExpr.execute(configuration, arguments);
        final String permissionsStr =
                (permissionsObject == null? null : permissionsObject.toString());

        return AclAuthUtils.authorizeUsingAccessControlList(
                domainObject, applicationContext, permissionsStr, authentication, servletContext);
View Full Code Here


   
   
    protected static IStandardExpression getExpressionDefaultToLiteral(final IStandardExpressionParser expressionParser,
            final Configuration configuration, final IProcessingContext processingContext, final String input) {
       
        final IStandardExpression expression =
                expressionParser.parseExpression(configuration, processingContext, input);
        if (expression == null) {
            return new TextLiteralExpression(input);
        }
        return expression;
View Full Code Here

    Object result = null;

    if (value.contains("${") || value.contains("@{") || value.contains("#{")) {
      Configuration configuration = arguments.getConfiguration();
      IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);
      IStandardExpression standardExpression = expressionParser.parseExpression(configuration, arguments, value);
      result = standardExpression.execute(configuration, arguments);
    }
    else {
      result = value;
    }
   
View Full Code Here

            // If "global", "all" or "*" are used without prefix, they must be inside a form, so we add *{...}
            return getBindStatus(configuration, processingContext, "*{" + expression + "}");
        }

        final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);
        final IStandardExpression expressionObj =
                expressionParser.parseExpression(configuration, processingContext, expression);

        if (expressionObj == null) {
            throw new TemplateProcessingException(
                    "Expression \"" + expression + "\" is not valid: cannot perform Spring bind");
View Full Code Here

            // If "global", "all" or "*" are used without prefix, they must be inside a form, so we add *{...}
            return getBindStatus(configuration, processingContext, "*{" + expression + "}");
        }

        final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);
        final IStandardExpression expressionObj =
                expressionParser.parseExpression(configuration, processingContext, expression);

        if (expressionObj == null) {
            throw new TemplateProcessingException(
                    "Expression \"" + expression + "\" is not valid: cannot perform Spring bind");
View Full Code Here

                    logger.trace("[THYMELEAF][{}] Applying text inline evaluation on \"{}\"", TemplateEngine.threadIndex(), match);
                }
               
                try {

                    final IStandardExpression expression =
                            expressionParser.parseExpression(configuration, arguments, match);
                    final Object result = expression.execute(configuration, arguments);

                    strBuilder.append(HtmlEscape.escapeHtml4Xml(String.valueOf(result)));
                   
                } catch (final TemplateProcessingException ignored) {
                   
View Full Code Here

                if (this.logger.isTraceEnabled()) {
                    this.logger.trace("[THYMELEAF][{}] Applying javascript variable inline evaluation on \"{}\"", TemplateEngine.threadIndex(), match);
                }


                IStandardExpression expression = null;
                try {
                    expression = expressionParser.parseExpression(configuration, arguments, match);
                } catch (final TemplateProcessingException ignored) {
                    // If it is not a standard expression, just output it as original
                    strBuilder.append(SCRIPT_INLINE_PREFIX).append(match).append(SCRIPT_INLINE_SUFFIX);
                }

                if (expression != null) {
                    // If an exception raises during execution, we should let it through
                    final Object result = expression.execute(configuration, arguments);
                    strBuilder.append(formatEvaluationResult(result));
                }
               
                curr = matcher.end(0);
               
View Full Code Here

        // Target element and attribute names can be null

        final FragmentSelection fragmentSelection =
                FragmentSelectionUtils.parseFragmentSelection(configuration, processingContext, standardFragmentSpec);

        final IStandardExpression templateNameExpression = fragmentSelection.getTemplateName();
        final String templateName;
        if (templateNameExpression != null) {
            final Object templateNameObject = templateNameExpression.execute(configuration, processingContext);
            if (templateNameObject == null) {
                throw new TemplateProcessingException(
                        "Evaluation of template name from spec \"" + standardFragmentSpec + "\" " +
                                "returned null.");
            }
View Full Code Here

        }

        final Map<String,Object> parameterValues = new HashMap<String, Object>(parameters.size() + 2);
        for (final Assignation assignation : parameters.getAssignations()) {

            final IStandardExpression parameterNameExpr = assignation.getLeft();
            final Object parameterNameValue = parameterNameExpr.execute(configuration, processingContext);

            final String parameterName = (parameterNameValue == null? null : parameterNameValue.toString());

            final IStandardExpression parameterValueExpr = assignation.getRight();
            final Object parameterValueValue = parameterValueExpr.execute(configuration, processingContext);

            parameterValues.put(parameterName, parameterValueValue);

        }
View Full Code Here

        final String attributeValue = element.getAttributeValue(attributeName);

        final Configuration configuration = arguments.getConfiguration();
        final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);

        final IStandardExpression switchExpression = expressionParser.parseExpression(configuration, arguments, attributeValue);

        final Map<String,Object> newVariables = new HashMap<String, Object>(2, 1.0f);
        newVariables.put(SWITCH_VARIABLE_NAME, new SwitchStructure(switchExpression));
       
        return newVariables;
View Full Code Here

TOP

Related Classes of org.thymeleaf.standard.expression.IStandardExpression

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.