本文整理汇总了Java中org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver类的典型用法代码示例。如果您正苦于以下问题:Java SpringResourceTemplateResolver类的具体用法?Java SpringResourceTemplateResolver怎么用?Java SpringResourceTemplateResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SpringResourceTemplateResolver类属于org.thymeleaf.spring4.templateresolver包,在下文中一共展示了SpringResourceTemplateResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mailPreviewTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
/**
* Template resolver for mail preview pages that include email templates (maybe I could just use emailTemplateResolver())
* @return
*/
public ITemplateResolver mailPreviewTemplateResolver() {
// ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setApplicationContext(applicationContext);
resolver.setPrefix("/WEB-INF/classes/" + YadaConstants.EMAIL_TEMPLATES_PREFIX);
// The final slash is not needed because all email template paths must start with "/email/" as specified in the "patterns.add()" statement below
// resolver.setPrefix("/WEB-INF/classes/" + YadaConstants.EMAIL_TEMPLATES_PREFIX + "/");
/* From the tutorial:
When several template resolvers are applied, it is recommended to specify patterns
for each template resolver so that Thymeleaf can quickly discard those template resolvers
that are not meant to resolve the template, enhancing performance. Doing this is not a
requirement, but a recommendation
*/
Set<String> patterns = new HashSet<>();
patterns.add("/email/*"); // Start with "/email/"
resolver.setResolvablePatterns(patterns);
resolver.setSuffix(".html");
resolver.setCharacterEncoding("UTF-8");
resolver.setTemplateMode(TemplateMode.HTML);
resolver.setCacheable(config.isProductionEnvironment());
resolver.setOrder(20);
return resolver;
}
示例2: webTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public ITemplateResolver webTemplateResolver() {
// ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setApplicationContext(applicationContext);
// Relative paths never work, with or without trailing slash, so better to be consistent without and always use "absolute" paths [xtian]
resolver.setPrefix("/WEB-INF/views");
// resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".html");
// Set<String> patterns = new HashSet<>();
// patterns.add("^(?!/yada/).*"); // Do not start with "yada" - DOES NOT WORK because it doesn't accept a regexp
// resolver.setResolvablePatterns(patterns);
resolver.setCharacterEncoding("UTF-8");
// NB, selecting HTML5 as the template mode.
resolver.setTemplateMode(TemplateMode.HTML);
resolver.setCacheable(config.isProductionEnvironment());
resolver.setOrder(30); // The last one, because it doesn't have any ResolvablePatterns
return resolver;
}
示例3: xmlTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public ITemplateResolver xmlTemplateResolver() {
// ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setApplicationContext(applicationContext);
// Relative paths never work, with or without trailing slash, so better to be consistent without and always use "absolute" paths [xtian]
resolver.setPrefix("/WEB-INF/views");
// resolver.setPrefix("/WEB-INF/views/");
Set<String> patterns = new HashSet<>();
patterns.add("/xml/*"); // Start with "xml"
resolver.setResolvablePatterns(patterns);
resolver.setSuffix(".xml");
resolver.setCharacterEncoding("UTF-8");
// NB, selecting HTML5 as the template mode.
resolver.setTemplateMode("XML");
resolver.setCacheable(config.isProductionEnvironment());
// resolver.setOrder(30); // Order not needed because resolver on different ViewResolver
return resolver;
}
示例4: defaultTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public SpringResourceTemplateResolver defaultTemplateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setApplicationContext(this.applicationContext);
resolver.setPrefix(this.properties.getPrefix());
resolver.setSuffix(this.properties.getSuffix());
resolver.setTemplateMode(this.properties.getMode());
if (this.properties.getEncoding() != null) {
resolver.setCharacterEncoding(this.properties.getEncoding().name());
}
resolver.setCacheable(this.properties.isCache());
Integer order = this.properties.getTemplateResolverOrder();
if (order != null) {
resolver.setOrder(order);
}
return resolver;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:AbstractTemplateResolverConfiguration.java
示例5: templateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
ITemplateResolver templateResolver()
{
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setPrefix("/WEB-INF/templates/");
resolver.setSuffix(".html");
resolver.setTemplateMode(TemplateMode.HTML);
//debug
resolver.setCacheable(false);
return resolver;
}
示例6: templateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
private ITemplateResolver templateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setApplicationContext(applicationContext);
resolver.setSuffix(".html");
resolver.setPrefix("/WEB-INF/templates/");
resolver.setTemplateMode(TemplateMode.HTML);
return resolver;
}
示例7: templateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public ITemplateResolver templateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
if (nixmashModeEnabled)
resolver.setPrefix("classpath:/nixmash/");
else
resolver.setPrefix("classpath:/templates/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setCacheable(false);
resolver.setOrder(0);
return resolver;
}
示例8: adminTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public ITemplateResolver adminTemplateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setPrefix("classpath:/admin/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setCacheable(false);
resolver.setOrder(1);
return resolver;
}
示例9: templateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public ITemplateResolver templateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setApplicationContext(applicationContext);
resolver.setPrefix("classpath:/templates");
resolver.setTemplateMode(TemplateMode.TEXT);
return resolver;
}
示例10: templateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public ITemplateResolver templateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setApplicationContext(applicationContext);
resolver.setPrefix("/WEB-INF/thymeleaf/");
resolver.setSuffix(".html");
resolver.setTemplateMode(TemplateMode.HTML);
return resolver;
}
示例11: springHtmlResourceTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public SpringResourceTemplateResolver springHtmlResourceTemplateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setApplicationContext(this.applicationContext);
resolver.setPrefix(DEFAULT_PREFIX);
resolver.setSuffix(DEFAULT_SUFFIX);
resolver.setTemplateMode(TemplateMode.HTML);
resolver.setCharacterEncoding("UTF-8");
resolver.setCacheable(true);
resolver.setOrder(1);
return resolver;
}
示例12: springTxtResourceTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public SpringResourceTemplateResolver springTxtResourceTemplateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setApplicationContext(this.applicationContext);
resolver.setPrefix("classpath:/templates/text/");
resolver.setSuffix(".txt");
resolver.setTemplateMode(TemplateMode.TEXT);
resolver.setCharacterEncoding("UTF-8");
resolver.setCacheable(true);
resolver.setOrder(2);
return resolver;
}
示例13: springThymeleafTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public TemplateResolver springThymeleafTemplateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setPrefix("classpath:/templates/");
resolver.setSuffix(".html");
resolver.setOrder(1);
return resolver;
}
示例14: defaultTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public SpringResourceTemplateResolver defaultTemplateResolver() {
SpringResourceTemplateResolver resolver = resolver();
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setOrder(0);
resolver.setName("HTML template resolver");
return resolver;
}
示例15: xmlTemplateResolver
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入依赖的package包/类
@Bean
public SpringResourceTemplateResolver xmlTemplateResolver() {
SpringResourceTemplateResolver resolver = resolver();
resolver.setSuffix(".xml");
resolver.setTemplateMode("XML");
resolver.setOrder(1);
resolver.setName("XML template resolver");
return resolver;
}