Package org.thymeleaf.exceptions

Examples of org.thymeleaf.exceptions.TemplateProcessingException


        if (spring4Delegate != null) {
            return spring4Delegate.processUrl(
                    requestContext, ((IWebContext)context).getHttpServletRequest(), url);
        }

        throw new TemplateProcessingException(
                "According to the detected Spring version info, a RequestDataValueProcessor delegate should be available, " +
                "but none seem applicable");

    }
View Full Code Here


     * @return The value of the code in the current theme properties file, or an
     *        empty string if the code could not be resolved.
     */
    public String code(final String code) {
        if (this.theme == null) {
            throw new TemplateProcessingException("Theme cannot be resolved because RequestContext was not found. "
                + "Are you using a Context object without a RequestContext variable?");
        }
        return this.theme.getMessageSource().getMessage(code, null, "", this.locale);
    }
View Full Code Here

                       
                        final String selectAttrInChildValue = childTag.getAttributeValue(selectAttrName);
                       
                        if (selectAttrInChildValue != null) {
                            if (!selectAttrValue.equals(selectAttrInChildValue)) {
                                throw new TemplateProcessingException(
                                        "If specified (which is not required), attribute " +
                                        "\"" + selectAttrName + "\" in \"option\" tag must have " +
                                        "exactly the same value as in its containing \"select\" " +
                                        "tag");
                            }
View Full Code Here

    protected void validateSelectionValue(final Arguments arguments, final Element element,
            final String attributeName, final String attributeValue, final IStandardExpression expression) {

        if (expression == null || !(expression instanceof VariableExpression)) {

            throw new TemplateProcessingException(
                    "The expression used for object selection is " + expression + ", which is not valid: " +
                    "only variable expressions (${...}) are allowed in '" +  attributeName + "' attributes in " +
                    "Spring-enabled environments.");

        }
View Full Code Here

           
        } else {
           
            value = element.getAttributeValue("value");
            if (value == null) {
                throw new TemplateProcessingException(
                        "Attribute \"value\" is required in \"input(checkbox)\" tags " +
                        "when binding to non-boolean values");
            }
           
            checked = SelectedValueComparatorWrapper.isSelected(bindStatus, value);
View Full Code Here


        } catch (final TemplateProcessingException e) {
            throw e;
        } catch(final Exception e) {
            throw new TemplateProcessingException(
                    "Exception evaluating SpringEL expression: \"" + spelExpression + "\"", e);
        }
       
    }
View Full Code Here

        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");
        }

        if (expressionObj instanceof SelectionVariableExpression) {
            final String bindExpression = ((SelectionVariableExpression)expressionObj).getExpression();
            return getBindStatusFromParsedExpression(configuration, processingContext, optional, true, bindExpression);
        }

        if (expressionObj instanceof VariableExpression) {
            final String bindExpression = ((VariableExpression)expressionObj).getExpression();
            return getBindStatusFromParsedExpression(configuration, processingContext, optional, false, bindExpression);
        }

        throw new TemplateProcessingException(
                "Expression \"" + expression + "\" is not valid: only variable expressions ${...} or " +
                "selection expressions *{...} are allowed in Spring field bindings");

    }
View Full Code Here

     * @return The value of the code in the current theme properties file, or an
     *        empty string if the code could not be resolved.
     */
    public String code(final String code) {
        if (this.theme == null) {
            throw new TemplateProcessingException("Theme cannot be resolved because RequestContext was not found. "
                + "Are you using a Context object without a RequestContext variable?");
        }
        return this.theme.getMessageSource().getMessage(code, null, "", this.locale);
    }
View Full Code Here

        final String fieldName = element.getAttributeValueFromNormalizedName("name");
        if (StringUtils.isEmptyOrWhitespace(fieldName)) {
            final String[] fieldProcessorNames =
                    Attribute.applyPrefixToAttributeName(
                            AbstractSpringFieldAttrProcessor.ATTR_NAME, Attribute.getPrefixFromAttributeName(attributeName));
            throw new TemplateProcessingException(
                    "Cannot apply \"" + attributeName + "\": this attribute requires the existence of " +
                    "a \"name\" (or " + Arrays.asList(fieldProcessorNames) + ") attribute with non-empty " +
                    "value in the same host tag.");
        }
View Full Code Here

                       
                        final String selectAttrInChildValue = childTag.getAttributeValue(selectAttrName);
                       
                        if (selectAttrInChildValue != null) {
                            if (!selectAttrValue.equals(selectAttrInChildValue)) {
                                throw new TemplateProcessingException(
                                        "If specified (which is not required), attribute " +
                                        "\"" + selectAttrName + "\" in \"option\" tag must have " +
                                        "exactly the same value as in its containing \"select\" " +
                                        "tag");
                            }
View Full Code Here

TOP

Related Classes of org.thymeleaf.exceptions.TemplateProcessingException

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.