Package org.thymeleaf.standard.expression

Examples of org.thymeleaf.standard.expression.IStandardExpressionParser


        }
       
        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);
View Full Code Here


    // Use the Thymeleaf Standard expression processor on the expression
    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_EXPRESSION.equals(expression) || ALL_EXPRESSION.equals(expression) || ALL_FIELDS.equals(expression)) {
            // 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

        additionalLocalVariables.putAll(previousAdditionalLocalVariables);

        final String attributeValue = element.getAttributeValue(attributeName);

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

        final VariableExpression varExpression =
            (VariableExpression) expressionParser.parseExpression(arguments.getConfiguration(), arguments, attributeValue);

        additionalLocalVariables.put(SpringContextVariableNames.SPRING_BOUND_OBJECT_EXPRESSION, varExpression);
        // Added also with the deprecated name, for backwards compatibility
        additionalLocalVariables.put(SpringContextVariableNames.SPRING_FORM_COMMAND_VALUE, varExpression);
View Full Code Here

        if (GLOBAL_EXPRESSION.equals(expression) || ALL_EXPRESSION.equals(expression) || ALL_FIELDS.equals(expression)) {
            // 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

        additionalLocalVariables.putAll(previousAdditionalLocalVariables);

        final String attributeValue = element.getAttributeValue(attributeName);

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

        final VariableExpression varExpression =
            (VariableExpression) expressionParser.parseExpression(arguments.getConfiguration(), arguments, attributeValue);

        additionalLocalVariables.put(SpringContextVariableNames.SPRING_BOUND_OBJECT_EXPRESSION, varExpression);
        // Added also with the deprecated name, for backwards compatibility
        additionalLocalVariables.put(SpringContextVariableNames.SPRING_FORM_COMMAND_VALUE, varExpression);
View Full Code Here

        final Matcher matcher = TEXT_INLINE_EVAL_PATTERN.matcher(input);
       
        if (matcher.find()) {

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

            final StringBuilder strBuilder = new StringBuilder();
            int curr = 0;
           
            do {
               
                strBuilder.append(input.substring(curr,matcher.start(0)));
               
                final String match = HtmlEscape.unescapeHtml(matcher.group(1));
               
                if (logger.isTraceEnabled()) {
                    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

        final Matcher matcher = SCRIPT_INLINE_EVAL_PATTERN.matcher(input);
       
        if (matcher.find()) {

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

            final StringBuilder strBuilder = new StringBuilder();
            int curr = 0;
           
            do {
               
                strBuilder.append(input.substring(curr,matcher.start(0)));
               
                final String match = matcher.group(1);
               
                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);
                }
View Full Code Here

      logger.error("layout:title-pattern attribute should only appear in a <title> element");
      throw new IllegalArgumentException("layout:title-pattern attribute should only appear in a <title> element");
    }

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

    // Process the decorator and content title parts
    String decoratortitle = processTitle((String)element.getNodeProperty(DECORATOR_TITLE),
        arguments, configuration, parser);
    String contenttitle = processTitle((String)element.getNodeProperty(CONTENT_TITLE),
View Full Code Here

            final Arguments arguments, final Element element, final String attributeName) {

        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.IStandardExpressionParser

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.