当前位置: 首页>>代码示例>>Java>>正文


Java SpringResourceTemplateResolver.setSuffix方法代码示例

本文整理汇总了Java中org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver.setSuffix方法的典型用法代码示例。如果您正苦于以下问题:Java SpringResourceTemplateResolver.setSuffix方法的具体用法?Java SpringResourceTemplateResolver.setSuffix怎么用?Java SpringResourceTemplateResolver.setSuffix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver的用法示例。


在下文中一共展示了SpringResourceTemplateResolver.setSuffix方法的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;
	}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:28,代码来源:YadaWebConfig.java

示例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;
	}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:20,代码来源:YadaWebConfig.java

示例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;
	}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:20,代码来源:YadaWebConfig.java

示例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;
}
 
开发者ID:scrumtracker,项目名称:scrumtracker2017,代码行数:12,代码来源:ThymeleafConfig.java

示例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;
}
 
开发者ID:ArturWisniewski,项目名称:ToDoApp-Spring,代码行数:9,代码来源:ThymeleafConfig.java

示例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;
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:14,代码来源:WebConfig.java

示例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;
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:11,代码来源:WebConfig.java

示例9: 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;
}
 
开发者ID:Ulyssesss,项目名称:java-demo,代码行数:10,代码来源:WebConfig.java

示例10: 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;
}
 
开发者ID:bobxwang,项目名称:springboot-scala-withswagger,代码行数:13,代码来源:Thymeleaf3Config.java

示例11: 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;
}
 
开发者ID:bobxwang,项目名称:springboot-scala-withswagger,代码行数:13,代码来源:Thymeleaf3Config.java

示例12: 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;
}
 
开发者ID:tkaczmarzyk,项目名称:th-db-view,代码行数:9,代码来源:Application.java

示例13: 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;
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:12,代码来源:ThymeleafConfig.java

示例14: 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;
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:12,代码来源:ThymeleafConfig.java

示例15: templateResolver

import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; //导入方法依赖的package包/类
private ITemplateResolver templateResolver() {
    SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
    resolver.setApplicationContext(applicationContext);
    resolver.setPrefix("classpath:/templates/");
    resolver.setSuffix(".html");
    resolver.setTemplateMode(TemplateMode.HTML);
    return resolver;
}
 
开发者ID:grassrootza,项目名称:grassroot-platform,代码行数:9,代码来源:GrassrootWebApplicationConfig.java


注:本文中的org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver.setSuffix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。