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


Java ClassLoaderTemplateResolver.setResolvablePatterns方法代码示例

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


在下文中一共展示了ClassLoaderTemplateResolver.setResolvablePatterns方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: yadaTemplateResolver

import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //导入方法依赖的package包/类
@Bean
	public ClassLoaderTemplateResolver yadaTemplateResolver() {
		ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
		// Relative paths never work, with or without trailing slash, so better to be consistent without and always use "absolute" paths [xtian]
		resolver.setPrefix(YadaConstants.YADA_VIEW_PREFIX); // Attenzione allo slash finale!
//		resolver.setPrefix(YadaConstants.YADA_VIEW_PREFIX + "/"); // Attenzione allo slash finale!
		/* 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("/yada/*"); // Start with "yada"
		resolver.setResolvablePatterns(patterns);
		resolver.setSuffix(".html");
		resolver.setCharacterEncoding("UTF-8");
		resolver.setTemplateMode(TemplateMode.HTML);
		resolver.setCacheable(config.isProductionEnvironment());
		resolver.setOrder(10); 
		return resolver;
	}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:23,代码来源:YadaWebConfig.java

示例2: templateEngine

import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //导入方法依赖的package包/类
@Bean
  public SpringTemplateEngine templateEngine() {
  	SpringTemplateEngine mock = spy(SpringTemplateEngine.class);
  	
  	final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setOrder(2);
templateResolver.setResolvablePatterns(Collections.singleton("html/*"));
templateResolver.setPrefix("/mail/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode(TemplateMode.HTML);
templateResolver.setCharacterEncoding("UTF-8");
templateResolver.setCacheable(false);
  	mock.addTemplateResolver(templateResolver);
  	
  	final ClassLoaderTemplateResolver templateResolverTxt = new ClassLoaderTemplateResolver();
templateResolverTxt.setOrder(1);
templateResolverTxt.setResolvablePatterns(Collections.singleton("text/*"));
templateResolverTxt.setPrefix("/mail/");
templateResolverTxt.setSuffix(".txt");
templateResolverTxt.setTemplateMode(TemplateMode.TEXT);
templateResolverTxt.setCharacterEncoding("UTF-8");
templateResolverTxt.setCacheable(false);
mock.addTemplateResolver(templateResolverTxt);
  	
return mock;
  }
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:27,代码来源:SpringMailTestConfiguration.java

示例3: emailTemplateResolver

import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //导入方法依赖的package包/类
public ClassLoaderTemplateResolver emailTemplateResolver() {
		ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
		// Relative paths never work, with or without trailing slash, so better to be consistent without and always use "absolute" paths [xtian]
		resolver.setPrefix(YadaConstants.EMAIL_TEMPLATES_PREFIX); // Attenzione allo slash finale!
//		resolver.setPrefix(YadaConstants.EMAIL_TEMPLATES_PREFIX + "/"); // Attenzione allo slash finale!
		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(40); // Order not needed because resolver on different SpringTemplateEngine
		return resolver;
	}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:16,代码来源:YadaAppConfig.java

示例4: textTemplateResolver

import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //导入方法依赖的package包/类
private ITemplateResolver textTemplateResolver() {
	final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
	templateResolver.setOrder(1);
	templateResolver.setResolvablePatterns(Collections.singleton("text/*"));
	templateResolver.setPrefix("/mail/");
	templateResolver.setSuffix(".txt");
	templateResolver.setTemplateMode(TemplateMode.TEXT);
	templateResolver.setCharacterEncoding("UTF-8");
	templateResolver.setCacheable(false);
	return templateResolver;
}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:12,代码来源:SpringMailConfig.java

示例5: htmlTemplateResolver

import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //导入方法依赖的package包/类
private ITemplateResolver htmlTemplateResolver() {
	final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
	templateResolver.setOrder(2);
	templateResolver.setResolvablePatterns(Collections.singleton("html/*"));
	templateResolver.setPrefix("/mail/");
	templateResolver.setSuffix(".html");
	templateResolver.setTemplateMode(TemplateMode.HTML);
	templateResolver.setCharacterEncoding("UTF-8");
	templateResolver.setCacheable(false);
	return templateResolver;
}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:12,代码来源:SpringMailConfig.java


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