use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project xm-ms-entity by xm-online.
the class ThymeleafConfiguration method emailTemplateResolver.
@Bean
@Description("Thymeleaf template resolver serving HTML 5 emails")
public ClassLoaderTemplateResolver emailTemplateResolver() {
ClassLoaderTemplateResolver emailTemplateResolver = new ClassLoaderTemplateResolver();
emailTemplateResolver.setPrefix("mails/");
emailTemplateResolver.setSuffix(".html");
emailTemplateResolver.setTemplateMode("HTML5");
emailTemplateResolver.setCharacterEncoding(CharEncoding.UTF_8);
emailTemplateResolver.setOrder(1);
return emailTemplateResolver;
}
use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project irida by phac-nml.
the class IridaApiServicesConfig method exportUploadTemplateEngine.
/*
* Template engine for constructing ncbi export submissions
*/
@Bean(name = "exportUploadTemplateEngine")
public SpringTemplateEngine exportUploadTemplateEngine() {
SpringTemplateEngine exportUploadTemplateEngine = new SpringTemplateEngine();
ClassLoaderTemplateResolver classLoaderTemplateResolver = new ClassLoaderTemplateResolver();
classLoaderTemplateResolver.setPrefix("/ca/corefacility/bioinformatics/irida/export/");
classLoaderTemplateResolver.setSuffix(".xml");
classLoaderTemplateResolver.setTemplateMode(TemplateMode.XML);
classLoaderTemplateResolver.setCharacterEncoding("UTF-8");
exportUploadTemplateEngine.addTemplateResolver(classLoaderTemplateResolver);
return exportUploadTemplateEngine;
}
use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project irida by phac-nml.
the class WebEmailConfig method classLoaderTemplateResolver.
/**
* Configure the template resolver
* @return A ClassLoaderTemplateResolver
*/
public ClassLoaderTemplateResolver classLoaderTemplateResolver() {
ClassLoaderTemplateResolver classLoaderTemplateResolver = new ClassLoaderTemplateResolver();
classLoaderTemplateResolver.setPrefix(MAIL_TEMPLATE_PREFIX);
classLoaderTemplateResolver.setSuffix(TEMPLATE_SUFFIX);
classLoaderTemplateResolver.setTemplateMode(TemplateMode.HTML);
classLoaderTemplateResolver.setCharacterEncoding(CHARACER_ENCODING);
return classLoaderTemplateResolver;
}
use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project contribution by checkstyle.
the class TemplateProcessor method generateWithThymeleaf.
/**
* Generates output file with release notes using Thymeleaf.
* @param variables the map which represents template variables.
* @param outputFile output file.
* @param templateFilename template name.
* @throws IOException if I/O error occurs.
*/
public static void generateWithThymeleaf(Map<String, Object> variables, String outputFile, String templateFilename) throws IOException {
final TemplateEngine engine = new TemplateEngine();
final AbstractConfigurableTemplateResolver resolver = new ClassLoaderTemplateResolver();
resolver.setPrefix(TEMPLATE_FOLDER_PATH);
engine.setTemplateResolver(resolver);
final IContext ctx = new Context(Locale.US, variables);
try (Writer fileWriter = new OutputStreamWriter(new FileOutputStream(outputFile), StandardCharsets.UTF_8)) {
engine.process(templateFilename, ctx, fileWriter);
}
}
use of org.thymeleaf.templateresolver.ClassLoaderTemplateResolver in project contribution by checkstyle.
the class SiteGenerator method getTemplateEngine.
/**
* Creates thymeleaf template engine.
*
* @return template engine.
*/
private static TemplateEngine getTemplateEngine() {
final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setTemplateMode("HTML");
templateResolver.setPrefix("/");
templateResolver.setSuffix(".template");
final TemplateEngine tplEngine = new TemplateEngine();
tplEngine.setTemplateResolver(templateResolver);
return tplEngine;
}
Aggregations