本文整理汇总了Java中org.thymeleaf.exceptions.TemplateProcessingException类的典型用法代码示例。如果您正苦于以下问题:Java TemplateProcessingException类的具体用法?Java TemplateProcessingException怎么用?Java TemplateProcessingException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TemplateProcessingException类属于org.thymeleaf.exceptions包,在下文中一共展示了TemplateProcessingException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseExpression
import org.thymeleaf.exceptions.TemplateProcessingException; //导入依赖的package包/类
private Object parseExpression(IStandardExpressionParser expressionParser, ITemplateContext context, String attributeValue) {
if (attributeValue == null) {
return null;
}
Object result = null;
try {
IStandardExpression expression = expressionParser.parseExpression(context, attributeValue);
result = expression.execute(context);
} catch (TemplateProcessingException e) {
result = attributeValue;
}
return result;
}
示例2: handleError
import org.thymeleaf.exceptions.TemplateProcessingException; //导入依赖的package包/类
static RuntimeException handleError( final RuntimeException e )
{
if ( e instanceof TemplateProcessingException )
{
return handleError( (TemplateProcessingException) e );
}
return e;
}
示例3: computeFragment
import org.thymeleaf.exceptions.TemplateProcessingException; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected List<Node> computeFragment(final Arguments arguments, final Element element) {
// The pageTitle attribute could be an expression that needs to be evaluated. Try to evaluate, but fall back
// to its text value if the expression wasn't able to be processed. This will allow things like
// pageTitle="Hello this is a string"
// as well as expressions like
// pageTitle="${'Hello this is a ' + product.name}"
String pageTitle = element.getAttributeValue("pageTitle");
try {
Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
.parseExpression(arguments.getConfiguration(), arguments, pageTitle);
pageTitle = (String) expression.execute(arguments.getConfiguration(), arguments);
} catch (TemplateProcessingException e) {
// Do nothing.
}
((Map<String, Object>) arguments.getExpressionEvaluationRoot()).put("pageTitle", pageTitle);
((Map<String, Object>) arguments.getExpressionEvaluationRoot()).put("additionalCss", element.getAttributeValue("additionalCss"));
extensionManager.processAttributeValues(arguments, element);
//the commit at https://github.com/thymeleaf/thymeleaf/commit/b214d9b5660369c41538e023d4b8d7223ebcbc22 along with
//the referenced issue at https://github.com/thymeleaf/thymeleaf/issues/205
// return new FragmentAndTarget(HEAD_PARTIAL_PATH, WholeFragmentSpec.INSTANCE);
return new ArrayList<Node>();
}
示例4: format
import org.thymeleaf.exceptions.TemplateProcessingException; //导入依赖的package包/类
@Override
public String format(final AbstractInstant target, String pattern) {
try {
return DateTimeFormat.forPattern(pattern).withLocale(locale).print(target);
} catch (final Exception e) {
throw new TemplateProcessingException(
"Error formatting Joda DateTime with pattern '" + pattern + "' for locale " + this.locale, e);
}
}
示例5: imagePath
import org.thymeleaf.exceptions.TemplateProcessingException; //导入依赖的package包/类
public String imagePath(String src, boolean base64) {
BinaryResourcesHandler binaryRsHandler = (BinaryResourcesHandler) context.getServletContext().getAttribute(JawrConstant.BINARY_CONTEXT_ATTRIBUTE);
if (binaryRsHandler == null) {
throw new TemplateProcessingException("Handler \"" + JawrConstant.BINARY_CONTEXT_ATTRIBUTE + "\" not present in servlet context. Initialization of Jawr either failed or never occurred.");
}
return ImageTagUtils.getImageUrl(src, base64, binaryRsHandler, context.getRequest(), context.getResponse());
}
示例6: evaluateAsIterable
import org.thymeleaf.exceptions.TemplateProcessingException; //导入依赖的package包/类
public static List<Object> evaluateAsIterable(ITemplateContext arguments, String rawValue) throws TemplateProcessingException {
notNull(arguments, "arguments must not be null");
notEmpty(rawValue, "rawValue must not be empty");
final Object evaluatedExpression = evaluateExpression(arguments, rawValue);
return EvaluationUtils.evaluateAsList(evaluatedExpression);
}
示例7: evaluateAsIterableOrRawValue
import org.thymeleaf.exceptions.TemplateProcessingException; //导入依赖的package包/类
public static List<Object> evaluateAsIterableOrRawValue(ITemplateContext arguments, String rawValue) {
notNull(arguments, "arguments must not be null");
notEmpty(rawValue, "rawValue must not be empty");
final List<Object> result = new ArrayList<Object>();
try {
result.addAll(evaluateAsIterable(arguments, rawValue));
} catch (TemplateProcessingException ex) {
result.add(rawValue);
}
return unmodifiableList(result);
}
示例8: evaluateExpression
import org.thymeleaf.exceptions.TemplateProcessingException; //导入依赖的package包/类
public static Object evaluateExpression(ITemplateContext arguments, String expression) throws TemplateProcessingException {
notNull(arguments, "arguments must not be null");
notEmpty(expression, "expression must not be empty");
final IStandardExpressionParser parser = new StandardExpressionParser();
final IStandardExpression evaluableExpression = parser.parseExpression(arguments, expression);
return evaluableExpression.execute(arguments);
}