Search in sources :

Example 1 with ServletContextTemplateResolver

use of org.thymeleaf.templateresolver.ServletContextTemplateResolver in project nutzboot by nutzam.

the class MainLauncher method init.

public void init() {
    engine = new TemplateEngine();
    ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(Mvcs.getServletContext());
    templateResolver.setTemplateMode(TemplateMode.TEXT);
    engine.setTemplateResolver(templateResolver);
    tmpDir = new File(conf.get("nutz.maker.tmpdir", "/tmp/maker")).getAbsoluteFile();
}
Also used : TemplateEngine(org.thymeleaf.TemplateEngine) ServletContextTemplateResolver(org.thymeleaf.templateresolver.ServletContextTemplateResolver) File(java.io.File)

Example 2 with ServletContextTemplateResolver

use of org.thymeleaf.templateresolver.ServletContextTemplateResolver in project tutorials by eugenp.

the class TestConfig method templateResolver.

@Bean
public ServletContextTemplateResolver templateResolver() {
    final ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
    templateResolver.setPrefix("/WEB-INF/templates/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode("HTML5");
    return templateResolver;
}
Also used : ServletContextTemplateResolver(org.thymeleaf.templateresolver.ServletContextTemplateResolver) Bean(org.springframework.context.annotation.Bean)

Example 3 with ServletContextTemplateResolver

use of org.thymeleaf.templateresolver.ServletContextTemplateResolver in project irida by phac-nml.

the class MvcConfiguration method templateResolver.

/**
 * Create a new {@link ServletContextTemplateResolver} and set defaults.
 *
 * @return {@link ServletContextTemplateResolver}
 */
@Bean
public ServletContextTemplateResolver templateResolver() {
    ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
    resolver.setPrefix(TEMPLATE_PREFIX);
    resolver.setSuffix(TEMPLATE_SUFFIX);
    resolver.setTemplateMode(TEMPLATE_MODE);
    resolver.setOrder(TEMPLATE_ORDER);
    resolver.setCacheable(false);
    return resolver;
}
Also used : ServletContextTemplateResolver(org.thymeleaf.templateresolver.ServletContextTemplateResolver) Bean(org.springframework.context.annotation.Bean)

Example 4 with ServletContextTemplateResolver

use of org.thymeleaf.templateresolver.ServletContextTemplateResolver in project java-docs-samples by GoogleCloudPlatform.

the class MetadataServlet 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);
}
Also used : TemplateEngine(org.thymeleaf.TemplateEngine) ServletContextTemplateResolver(org.thymeleaf.templateresolver.ServletContextTemplateResolver)

Example 5 with ServletContextTemplateResolver

use of org.thymeleaf.templateresolver.ServletContextTemplateResolver 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;
}
Also used : ServletContextTemplateResolver(org.thymeleaf.templateresolver.ServletContextTemplateResolver) TemplateResolver(org.thymeleaf.templateresolver.TemplateResolver) ServletContextTemplateResolver(org.thymeleaf.templateresolver.ServletContextTemplateResolver) Bean(org.springframework.context.annotation.Bean)

Aggregations

ServletContextTemplateResolver (org.thymeleaf.templateresolver.ServletContextTemplateResolver)9 Bean (org.springframework.context.annotation.Bean)4 TemplateEngine (org.thymeleaf.TemplateEngine)4 File (java.io.File)1 Description (org.springframework.context.annotation.Description)1 TemplateResolver (org.thymeleaf.templateresolver.TemplateResolver)1