use of com.tvd12.ezyhttp.server.thymeleaf.ThymeleafMessageResolver in project ezyhttp by youngmonkeys.
the class ThymeleafViewContext method createTemplateEngine.
private TemplateEngine createTemplateEngine() {
ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
TemplateMode templateMode = TemplateMode.valueOf(metadata.getTemplateMode());
templateResolver.setTemplateMode(templateMode);
templateResolver.setPrefix(metadata.getPrefix());
templateResolver.setSuffix(metadata.getSuffix());
templateResolver.setCacheTTLMs((long) metadata.getCacheTTLMs());
templateResolver.setCacheable(metadata.isCacheable());
ThymeleafMessageResolver messageResolver = ThymeleafMessageResolver.builder().messageLocation(metadata.getMessagesLocation()).messageProviders(messageProviders).absentMessageResolver(absentMessageResolver).build();
TemplateEngine templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
templateEngine.setMessageResolver(messageResolver);
templateEngine.addDialect(new LayoutDialect());
for (ViewDialect dialect : viewDialects) {
if (dialect instanceof IDialect) {
templateEngine.addDialect((IDialect) dialect);
}
}
return templateEngine;
}
Aggregations