use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project zhcet-web by zhcet-amu.
the class TemplateConfig method jsTemplateResolver.
private ITemplateResolver jsTemplateResolver() {
final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setOrder(3);
templateResolver.setResolvablePatterns(Collections.singleton("js/*"));
templateResolver.setPrefix(TEMPLATE_PREFIX);
templateResolver.setSuffix(".js");
templateResolver.setTemplateMode(TemplateMode.JAVASCRIPT);
templateResolver.setCharacterEncoding(TEMPLATE_ENCODING);
templateResolver.setCacheable(thymeleafProperties.isCache());
return templateResolver;
}
use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project zhcet-web by zhcet-amu.
the class TemplateConfig method textTemplateResolver.
private ITemplateResolver textTemplateResolver() {
final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setOrder(1);
templateResolver.setResolvablePatterns(Collections.singleton("text/*"));
templateResolver.setPrefix(TEMPLATE_PREFIX);
templateResolver.setSuffix(".txt");
templateResolver.setTemplateMode(TemplateMode.TEXT);
templateResolver.setCharacterEncoding(TEMPLATE_ENCODING);
templateResolver.setCacheable(thymeleafProperties.isCache());
return templateResolver;
}
use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project stdlib by petergeneric.
the class GuiceCoreTemplater method createEngine.
private static TemplateEngine createEngine() {
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
resolver.setTemplateMode("HTML5");
resolver.setCacheTTLMs(60 * 1000L);
resolver.setCacheable(true);
TemplateEngine engine = new TemplateEngine();
engine.setTemplateResolver(resolver);
return engine;
}
use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project nutzboot by nutzam.
the class ThymeleafView method initializeTemplateResolver.
private ITemplateResolver initializeTemplateResolver(ClassLoader classLoader, NutMap prop) {
ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver(classLoader);
templateResolver.setTemplateMode(prop.getString("mode", "HTML"));
templateResolver.setPrefix(prop.getString("prefix", "template/"));
templateResolver.setSuffix(prop.getString("suffix", ".html"));
templateResolver.setCharacterEncoding(prop.getString("encoding", "UTF-8"));
templateResolver.setCacheable(prop.getBoolean("cache", true));
templateResolver.setCacheTTLMs(prop.getLong("cacheTTLMs", 3600000L));
return templateResolver;
}
use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project ff4j by ff4j.
the class FF4jServlet method initializeTemplateEngine.
/**
* Initialize Thymeleaf.
*/
private void initializeTemplateEngine() {
ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setTemplateMode("XHTML");
templateResolver.setPrefix("views/view-");
templateResolver.setSuffix(".html");
templateResolver.setCacheTTLMs(3600000L);
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
templateEngine.addMessageResolver(new CustomMessageResolver());
LOGGER.info("Thymeleaf has been initialized");
}
Aggregations