當前位置: 首頁>>代碼示例>>Java>>正文


Java ServletContextTemplateResolver.setCacheable方法代碼示例

本文整理匯總了Java中org.thymeleaf.templateresolver.ServletContextTemplateResolver.setCacheable方法的典型用法代碼示例。如果您正苦於以下問題:Java ServletContextTemplateResolver.setCacheable方法的具體用法?Java ServletContextTemplateResolver.setCacheable怎麽用?Java ServletContextTemplateResolver.setCacheable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.thymeleaf.templateresolver.ServletContextTemplateResolver的用法示例。


在下文中一共展示了ServletContextTemplateResolver.setCacheable方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@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);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:java-docs-samples,代碼行數:18,代碼來源:GaeInfoServlet.java

示例2: init

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
/**
 * Initialize the Thymeleaf template engine.
 */
@Override
public void init() {
	ServletConfig config = this.getServletConfig();

	ServletContextTemplateResolver templateresolver = new ServletContextTemplateResolver();
	templateresolver.setPrefix(config.getInitParameter(INIT_PARAM_PREFIX));
	templateresolver.setSuffix(config.getInitParameter(INIT_PARAM_SUFFIX));
	templateresolver.setTemplateMode(config.getInitParameter(INIT_PARAM_TEMPLATEMODE));
	templateresolver.setCacheable(false);
	templateresolver.setCharacterEncoding(CHARACTER_ENCODING);

	templateengine = new TemplateEngine();
	templateengine.setTemplateResolver(templateresolver);
       Set<IDialect> dialects = new HashSet<IDialect>();
	dialects.add(new SpringStandardDialect());
	dialects.add(new SqlDialect());
       templateengine.setDialects(dialects);
       templateengine.initialize();
}
 
開發者ID:jmiguelsamper,項目名稱:thymeleaf-extras-sqldialect,代碼行數:23,代碼來源:StandaloneThymeleafServlet.java

示例3: get

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@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;
}
 
開發者ID:petergeneric,項目名稱:stdlib,代碼行數:26,代碼來源:TemplateResolverProvider.java

示例4: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@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;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:11,代碼來源:ThymeleafConfig.java

示例5: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@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;
    }
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:11,代碼來源:ThymeleafConfig.java

示例6: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver() {
    ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
    resolver.setPrefix(PREFIX);
    resolver.setSuffix(SUFFIX);
    resolver.setTemplateMode(TEMPLATE_MODE);
    resolver.setOrder(1);
    resolver.setCacheable(false);
    return resolver;
}
 
開發者ID:macielbombonato,項目名稱:apolo,代碼行數:11,代碼來源:ThymeleafConfig.java

示例7: defaultTemplateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver defaultTemplateResolver() {
    ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
    templateResolver.setPrefix("/WEB-INF/views/thymeleaf/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode("HTML5");
    templateResolver.setCacheable(false); // for development mode.

    return templateResolver;
}
 
開發者ID:gustavoorsi,項目名稱:searchahouse.com,代碼行數:11,代碼來源:ThymeleafConfiguration.java

示例8: thymeleafViewResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ThymeleafViewResolver thymeleafViewResolver(WebApplicationContext wac) {
    ThymeleafViewResolver resolver = new ThymeleafViewResolver();
    SpringTemplateEngine templateEngine = new SpringTemplateEngine();
    ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
    templateResolver.setPrefix("/WEB-INF/templates/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode("HTML5");
    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;
}
 
開發者ID:acesinc,項目名稱:convergent-ui,代碼行數:29,代碼來源:MVCConfig.java

示例9: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver() {
    ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".html");
    resolver.setTemplateMode("HTML5");
    resolver.setCacheable(false);
    return resolver;

}
 
開發者ID:shivam091,項目名稱:Spring-Security-Thymeleaf-Integration,代碼行數:11,代碼來源:WebMvcConfig.java

示例10: servletContextTemplateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
private ServletContextTemplateResolver servletContextTemplateResolver() {
	ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
	resolver.setCharacterEncoding(characterEncoding);
	resolver.setTemplateMode(templateMode);
	resolver.setCacheable(templateCacheEnabled);
	resolver.setOrder(1);
	return resolver;
}
 
開發者ID:connect-group,項目名稱:thymeleaf-tdd,代碼行數:9,代碼來源:ThymesheetConfig.java

示例11: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver() {
  ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
  resolver.setPrefix("/WEB-INF/view/");
  resolver.setSuffix(".html");
  //NB, selecting HTML5 as the template mode.
  resolver.setTemplateMode("HTML5");
  resolver.setCacheable(false);
  return resolver;

}
 
開發者ID:jkardynia,項目名稱:mvc-spring-hibernate,代碼行數:12,代碼來源:WebConfig.java

示例12: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver()
{
    ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".html");
    // NB, selecting HTML5 as the template mode.
    resolver.setTemplateMode("HTML5");
    resolver.setCacheable(false);
    return resolver;

}
 
開發者ID:huangye177,項目名稱:spring4probe,代碼行數:13,代碼來源:WebConfig.java

示例13: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver templateResolver() {
    ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
    resolver.setPrefix("/WEB-INF/thymeleaf/");
    resolver.setSuffix(".xhtml");
    resolver.setTemplateMode("HTML5");
    resolver.setCacheable(false);
    return resolver;
}
 
開發者ID:mikehartley,項目名稱:yottr,代碼行數:10,代碼來源:AppConfig.java

示例14: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver() {
    ServletContextTemplateResolver resolver =
            new ServletContextTemplateResolver();
    resolver.setPrefix("/views/");
    resolver.setSuffix(".html");
    resolver.setTemplateMode("HTML5");
    resolver.setOrder(1);
    resolver.setCacheable(false);
    resolver.setCharacterEncoding(DEFAULT_CHARSET.name());
    return resolver;
}
 
開發者ID:moss0801,項目名稱:apidoc,代碼行數:13,代碼來源:ServletConfig.java

示例15: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
private ServletContextTemplateResolver templateResolver() {
	ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
    resolver.setPrefix("/WEB-INF/templates/");
    resolver.setSuffix(".html");	
    resolver.setTemplateMode("HTML5");
    resolver.setCacheable(false);
    return resolver;
}
 
開發者ID:hantsy,項目名稱:spring4-sandbox,代碼行數:9,代碼來源:WebConfig.java


注:本文中的org.thymeleaf.templateresolver.ServletContextTemplateResolver.setCacheable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。