Search in sources :

Example 1 with FileSystemBindingThymeleafResourceResolver

use of ratpack.thymeleaf.internal.FileSystemBindingThymeleafResourceResolver 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;
}
Also used : IResourceResolver(org.thymeleaf.resourceresolver.IResourceResolver) FileSystemBindingThymeleafResourceResolver(ratpack.thymeleaf.internal.FileSystemBindingThymeleafResourceResolver) TemplateResolver(org.thymeleaf.templateresolver.TemplateResolver) ITemplateResolver(org.thymeleaf.templateresolver.ITemplateResolver) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Provides (com.google.inject.Provides)1 Singleton (com.google.inject.Singleton)1 IResourceResolver (org.thymeleaf.resourceresolver.IResourceResolver)1 ITemplateResolver (org.thymeleaf.templateresolver.ITemplateResolver)1 TemplateResolver (org.thymeleaf.templateresolver.TemplateResolver)1 FileSystemBindingThymeleafResourceResolver (ratpack.thymeleaf.internal.FileSystemBindingThymeleafResourceResolver)1