use of org.thymeleaf.templateresolver.ServletContextTemplateResolver in project java-docs-samples by GoogleCloudPlatform.
the class GaeInfoServlet method init.
@Override
public void init() {
// Setup ThymeLeaf
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(this.getServletContext());
templateResolver.setPrefix("/WEB-INF/templates/");
templateResolver.setSuffix(".html");
// TTL=20m
templateResolver.setCacheTTLMs(Long.valueOf(1200000L));
// Cache is set to true by default. Set to false if you want templates to
// be automatically updated when modified.
templateResolver.setCacheable(true);
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
}
use of org.thymeleaf.templateresolver.ServletContextTemplateResolver in project java-docs-samples by GoogleCloudPlatform.
the class GaeInfoServlet method init.
@Override
public void init() {
// Setup ThymeLeaf
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(this.getServletContext());
templateResolver.setPrefix("/WEB-INF/templates/");
templateResolver.setSuffix(".html");
// TTL=20m
templateResolver.setCacheTTLMs(Long.valueOf(1200000L));
// Cache is set to true by default. Set to false if you want templates to
// be automatically updated when modified.
templateResolver.setCacheable(true);
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
}
use of org.thymeleaf.templateresolver.ServletContextTemplateResolver in project stdlib by petergeneric.
the class TemplateResolverProvider method get.
@Override
public ITemplateResolver get() {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
resolver.setTemplateMode("HTML5");
// Load templates from WEB-INF/templates/{name}.html
resolver.setPrefix("/WEB-INF/template/");
resolver.setSuffix(".html");
if (cacheTTL.getMilliseconds() > 0) {
// cache templates for an hour
resolver.setCacheTTLMs(cacheTTL.getMilliseconds());
resolver.setCacheable(true);
} else {
// Don't cache
resolver.setCacheable(false);
}
return resolver;
}
use of org.thymeleaf.templateresolver.ServletContextTemplateResolver in project tutorials by eugenp.
the class ClientWebConfig method templateResolver.
@Bean
@Description("Thymeleaf template resolver serving HTML 5")
public ServletContextTemplateResolver templateResolver() {
final ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("/WEB-INF/templates/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("HTML5");
return templateResolver;
}
Aggregations