本文整理匯總了Java中org.thymeleaf.templateresolver.ServletContextTemplateResolver.setSuffix方法的典型用法代碼示例。如果您正苦於以下問題:Java ServletContextTemplateResolver.setSuffix方法的具體用法?Java ServletContextTemplateResolver.setSuffix怎麽用?Java ServletContextTemplateResolver.setSuffix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.thymeleaf.templateresolver.ServletContextTemplateResolver
的用法示例。
在下文中一共展示了ServletContextTemplateResolver.setSuffix方法的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);
}
示例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();
}
示例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;
}
示例4: getTemplateResolver
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
/**
* Bean to get the template resolver
*
* @return the template resolver
*/
@Bean(name = "templateResolver")
public ServletContextTemplateResolver getTemplateResolver() {
final ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("/WEB-INF/templates/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("XHTML");
return templateResolver;
}
示例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;
}
示例6: 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;
}
示例7: 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;
}
示例8: templateResolver
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver(ServletContext servletContext) {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(servletContext);
resolver.setPrefix(VIEWS);
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML");
resolver.setCharacterEncoding("UTF-8");
resolver.setOrder(1);
return resolver;
}
示例9: 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;
}
示例10: 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;
}
示例11: init
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@PostConstruct
public void init() {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
resolver.setTemplateMode("HTML5");
resolver.setSuffix(".html");
resolver.setPrefix("/WEB-INF/templates");
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(resolver);
}
示例12: 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;
}
示例13: 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;
}
示例14: 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;
}
示例15: defaultTemplateResolver
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver defaultTemplateResolver() {
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("/WEB-INF/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("HTML5");
templateResolver.setCharacterEncoding("UTF-8");
return templateResolver;
}