use of org.thymeleaf.templateresolver.TemplateResolver in project ratpack by ratpack.
the class ThymeleafModule method provideTemplateResolver.
@Provides
@Singleton
ITemplateResolver provideTemplateResolver(ServerConfig serverConfig, Config config) {
IResourceResolver resourceResolver = new FileSystemBindingThymeleafResourceResolver(serverConfig.getBaseDir());
TemplateResolver templateResolver = new TemplateResolver();
templateResolver.setResourceResolver(resourceResolver);
templateResolver.setTemplateMode(getTemplatesModeSetting(config));
templateResolver.setPrefix(getTemplatesPrefixSetting(config));
templateResolver.setSuffix(getTemplatesSuffixSetting(config));
templateResolver.setCacheable(getCacheSizeSetting(config) > 0);
// Never use TTL expiration
templateResolver.setCacheTTLMs(null);
return templateResolver;
}
use of org.thymeleaf.templateresolver.TemplateResolver in project mxisd by kamax-io.
the class ThymeleafConfig method getFileSystemResolver.
@Bean
public TemplateResolver getFileSystemResolver() {
TemplateResolver resolver = new TemplateResolver();
resolver.setPrefix("");
resolver.setSuffix("");
resolver.setCacheable(false);
resolver.setOrder(1);
resolver.setResourceResolver(new FileResourceResolver());
return resolver;
}
use of org.thymeleaf.templateresolver.TemplateResolver in project yqq by yeycfri.
the class WebConfig method templateResolver.
@Bean
public TemplateResolver templateResolver() {
TemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("classpath:/templates/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("LEGACYHTML5");
return templateResolver;
}
use of org.thymeleaf.templateresolver.TemplateResolver in project thymeleaf-tests by thymeleaf.
the class AbstractDocumentProcessingTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
this.templateEngine = new TemplateEngine();
TemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setSuffix(".html");
this.templateEngine.setTemplateResolver(templateResolver);
this.templateEngine.initialize();
this.context = new Context();
XPathFactory xPathFactory = XPathFactory.newInstance();
this.xPath = xPathFactory.newXPath();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
this.docBuilder = factory.newDocumentBuilder();
this.docBuilder.setEntityResolver(new EntityResolver(this.templateEngine.getConfiguration()));
}
Aggregations