Java Code Examples for org.thymeleaf.templateresolver.ServletContextTemplateResolver#setCacheable()
The following examples show how to use
org.thymeleaf.templateresolver.ServletContextTemplateResolver#setCacheable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GaeInfoServlet.java From java-docs-samples with Apache License 2.0 | 6 votes |
@Override public void init() { // Setup ThymeLeaf ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(this.getServletContext()); templateResolver.setPrefix("/WEB-INF/templates/"); templateResolver.setSuffix(".html"); templateResolver.setCacheTTLMs(Long.valueOf(1200000L)); // TTL=20m // 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); }
Example 2
Source File: GaeInfoServlet.java From java-docs-samples with Apache License 2.0 | 6 votes |
@Override public void init() { // Setup ThymeLeaf ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(this.getServletContext()); templateResolver.setPrefix("/WEB-INF/templates/"); templateResolver.setSuffix(".html"); templateResolver.setCacheTTLMs(1200000L); // TTL=20m // 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); }
Example 3
Source File: GaeInfoServlet.java From java-docs-samples with Apache License 2.0 | 6 votes |
@Override public void init() { // Setup ThymeLeaf ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(this.getServletContext()); templateResolver.setPrefix("/WEB-INF/templates/"); templateResolver.setSuffix(".html"); templateResolver.setCacheTTLMs(Long.valueOf(1200000L)); // TTL=20m // 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); }
Example 4
Source File: MetadataServlet.java From java-docs-samples with Apache License 2.0 | 6 votes |
@Override public void init() { // Setup ThymeLeaf ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(this.getServletContext()); templateResolver.setPrefix("/WEB-INF/templates/"); templateResolver.setSuffix(".html"); templateResolver.setCacheTTLMs(Long.valueOf(1200000L)); // TTL=20m // 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); }
Example 5
Source File: ThymeleafViewEngine.java From generator-jvm with MIT License | 5 votes |
@PostConstruct public void postConstruct() { final ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(servletContext); resolver.setPrefix("/WEB-INF/layouts/"); resolver.setSuffix(".html"); resolver.setTemplateMode(TemplateMode.HTML); resolver.setCacheable(false); engine = new TemplateEngine(); engine.setTemplateResolver(resolver); }
Example 6
Source File: ThymeleafConfig.java From Spring-Security-Third-Edition with MIT License | 5 votes |
@Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCacheable(false); resolver.setOrder(1); return resolver; }
Example 7
Source File: ThymeleafConfig.java From Spring-Security-Third-Edition with MIT License | 5 votes |
@Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCacheable(false); resolver.setOrder(1); return resolver; }
Example 8
Source File: ThymeleafConfig.java From Spring-Security-Third-Edition with MIT License | 5 votes |
@Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/templates/"); resolver.setSuffix(".html"); // resolver.setTemplateMode("HTML5"); resolver.setCacheable(false); resolver.setOrder(1); return resolver; }
Example 9
Source File: ThymeleafConfig.java From Spring-Security-Third-Edition with MIT License | 5 votes |
@Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCacheable(false); resolver.setOrder(1); return resolver; }
Example 10
Source File: ThymeleafConfig.java From Spring-Security-Third-Edition with MIT License | 5 votes |
@Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCacheable(false); resolver.setOrder(1); return resolver; }
Example 11
Source File: ThymeleafConfig.java From Spring-Security-Third-Edition with MIT License | 5 votes |
@Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCacheable(false); resolver.setOrder(1); return resolver; }
Example 12
Source File: ThymeleafConfig.java From Spring-Security-Third-Edition with MIT License | 5 votes |
@Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCacheable(false); resolver.setOrder(1); return resolver; }
Example 13
Source File: ThymeleafConfig.java From Spring-Security-Third-Edition with MIT License | 5 votes |
@Bean public ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCacheable(false); resolver.setOrder(1); return resolver; }
Example 14
Source File: MVCConfig.java From convergent-ui with Apache License 2.0 | 5 votes |
@Bean public ThymeleafViewResolver thymeleafViewResolver(WebApplicationContext wac) { ThymeleafViewResolver resolver = new ThymeleafViewResolver(); SpringTemplateEngine templateEngine = new SpringTemplateEngine(); ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(wac.getServletContext()); templateResolver.setPrefix("/WEB-INF/templates/"); templateResolver.setSuffix(".html"); templateResolver.setTemplateMode("HTML"); templateResolver.setCharacterEncoding("UTF-8"); templateEngine.setTemplateResolver(templateResolver); resolver.setTemplateEngine(templateEngine); resolver.setOrder(2); resolver.setApplicationContext(wac); resolver.setCharacterEncoding("UTF-8"); //Enable the Spring Security Thymeleaf integration templateEngine.addDialect(new LayoutDialect()); // caching String[] activeProfiles = env.getActiveProfiles(); if (Arrays.asList(activeProfiles).contains("dev")) { log.info("DEV Profile is active. Disabling template caching."); templateResolver.setCacheable(false); templateEngine.setCacheManager(null); resolver.setCache(false); } return resolver; }
Example 15
Source File: MVCConfig.java From convergent-ui with Apache License 2.0 | 5 votes |
@Bean public ThymeleafViewResolver thymeleafViewResolver(WebApplicationContext wac) { ThymeleafViewResolver resolver = new ThymeleafViewResolver(); SpringTemplateEngine templateEngine = new SpringTemplateEngine(); ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver(wac.getServletContext()); templateResolver.setPrefix("/WEB-INF/templates/"); templateResolver.setSuffix(".html"); templateResolver.setTemplateMode("HTML"); templateResolver.setCharacterEncoding("UTF-8"); templateEngine.setTemplateResolver(templateResolver); resolver.setTemplateEngine(templateEngine); resolver.setOrder(2); resolver.setApplicationContext(wac); resolver.setCharacterEncoding("UTF-8"); //Enable the Spring Security Thymeleaf integration templateEngine.addDialect(new LayoutDialect()); // caching String[] activeProfiles = env.getActiveProfiles(); if (Arrays.asList(activeProfiles).contains("dev")) { log.info("DEV Profile is active. Disabling template caching."); templateResolver.setCacheable(false); templateEngine.setCacheManager(null); resolver.setCache(false); } return resolver; }
Example 16
Source File: WebConfig.java From spring4-sandbox with Apache License 2.0 | 5 votes |
private ServletContextTemplateResolver templateResolver() { ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/WEB-INF/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCacheable(false); return resolver; }