本文整理匯總了Java中org.thymeleaf.templateresolver.TemplateResolver.setSuffix方法的典型用法代碼示例。如果您正苦於以下問題:Java TemplateResolver.setSuffix方法的具體用法?Java TemplateResolver.setSuffix怎麽用?Java TemplateResolver.setSuffix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.thymeleaf.templateresolver.TemplateResolver
的用法示例。
在下文中一共展示了TemplateResolver.setSuffix方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildIndex
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
/**
* Builds index.html file. This file contains table with links to validation
* results.
*/
private static void buildIndex() {
try {
Collections.sort(results);
FileWriter writer = new FileWriter(new File("out", "index.html"));
TemplateEngine templateEngine = new TemplateEngine();
TemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setPrefix("resources/");
templateResolver.setSuffix(".html");
templateEngine.setTemplateResolver(templateResolver);
Context ctx = new Context();
ctx.setVariable("results", results);
templateEngine.process("index-template", ctx, writer);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
示例2: init
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
/**
* Configures engine and template resolving.
*/
@Override
public void init(@SuppressWarnings("rawtypes") NamedList args) {
checkNotNull(args);
this.configuration = SolrParams.toSolrParams(args);
// configure template resolver
templateResolver = new TemplateResolver();
templateResolver.setResourceResolver(resourceResolver);
templateResolver.setCharacterEncoding("utf-8");
templateResolver.setTemplateMode(configuration.get("tl.templateMode", "XHTML"));
templateResolver.setSuffix(configuration.get("tl.suffix", ".html"));
if (configuration.get("tl.cacheTtlMs") != null) {
templateResolver.setCacheTTLMs(Long.parseLong(configuration.get("tl.cacheTTLMs")));
} else {
templateResolver.setCacheTTLMs(TimeUnit.HOURS.toMillis(1l));
}
if (configuration.get("tl.locale") != null) {
locale = Locale.forLanguageTag(configuration.get("tl.locale"));
}
layoutDialect = new LayoutDialect();
}
示例3: createDefaultTemplateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
private static TemplateResolver createDefaultTemplateResolver(String prefix, String suffix) {
TemplateResolver defaultTemplateResolver = new TemplateResolver();
defaultTemplateResolver.setTemplateMode(DEFAULT_TEMPLATE_MODE);
defaultTemplateResolver.setPrefix(
prefix != null ? prefix : DEFAULT_PREFIX
);
defaultTemplateResolver.setSuffix(
suffix != null ? suffix : DEFAULT_SUFFIX
);
//defaultTemplateResolver.setCacheable(false);
defaultTemplateResolver.setCacheTTLMs(DEFAULT_CACHE_TTL_MS);
defaultTemplateResolver.setResourceResolver(new FileResourceResolver());
return defaultTemplateResolver;
}
示例4: defaultTemplateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver defaultTemplateResolver() {
TemplateResolver resolver = new TemplateResolver();
resolver.setResourceResolver(thymeleafResourceResolver());
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;
}
示例5: createThymeleaf
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
@Bean
public ThymeleafTemplateEngine createThymeleaf() {
boolean cachingEnabled = env.getProperty("jbakery.thymeleaf.cachingEnabled", Boolean.class, false);
TemplateResolver templateResolver = new TemplateResolver();
templateResolver.setResourceResolver(new FileResourceResolver());
templateResolver.setPrefix("templates/");
templateResolver.setTemplateMode("HTML5");
templateResolver.setSuffix(".html");
templateResolver.setCacheable(cachingEnabled);
templateResolver.addTemplateAlias("", "/index");
templateResolver.addTemplateAlias("/", "/index");
ThymeleafTemplateEngine engine = ThymeleafTemplateEngine.create()
.setMode(StandardTemplateModeHandlers.HTML5.getTemplateModeName());
// enable layout
engine.getThymeleafTemplateEngine().addDialect(new LayoutDialect());
engine.getThymeleafTemplateEngine().setTemplateResolver(templateResolver);
return engine;
}
示例6: defaultTemplateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
@Bean
public ITemplateResolver defaultTemplateResolver() {
final TemplateResolver resolver = new TemplateResolver();
resolver.setResourceResolver(thymeleafResourceResolver());
resolver.setPrefix(this.environment.getProperty("prefix", DEFAULT_PREFIX));
resolver.setSuffix(this.environment.getProperty("suffix", DEFAULT_SUFFIX));
resolver.setTemplateMode(this.environment.getProperty("mode", "HTML5"));
resolver.setCharacterEncoding(this.environment.getProperty("encoding", "UTF-8"));
final Boolean cache = this.environment.getProperty("cache", Boolean.class, true);
resolver.setCacheable(cache);
if (!cache) {
resolver.setCacheTTLMs(0L);
}
return resolver;
}
示例7: getFileSystemResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver getFileSystemResolver() {
TemplateResolver resolver = new TemplateResolver();
resolver.setPrefix("");
resolver.setSuffix("");
resolver.setCacheable(false);
resolver.setOrder(1);
resolver.setResourceResolver(new FileResourceResolver());
return resolver;
}
示例8: defaultTemplateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
@Bean
public ITemplateResolver defaultTemplateResolver() {
TemplateResolver resolver = new FileTemplateResolver();
resolver.setSuffix(".html");
resolver.setPrefix("src/main/resources/templates/");
resolver.setTemplateMode("HTML5");
resolver.setCharacterEncoding("UTF-8");
resolver.setCacheable(false);
return resolver;
}
示例9: defaultTemplateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver defaultTemplateResolver() {
TemplateResolver resolver = new TemplateResolver();
resolver.setResourceResolver(thymeleafResourceResolver(rl));
resolver.setPrefix("classpath:/META-INF/resources/WEB-INF/templates/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setCharacterEncoding("UTF-8");
resolver.setCacheable(false);
return resolver;
}
示例10: emailTemplateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
private static TemplateResolver emailTemplateResolver() {
TemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setPrefix("email/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("HTML5");
templateResolver.setCharacterEncoding("UTF-8");
templateResolver.setOrder(1);
templateResolver.setCacheable(false);
return templateResolver;
}
示例11: createDefaultTemplateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
private static TemplateResolver createDefaultTemplateResolver(String prefix, String suffix) {
TemplateResolver defaultTemplateResolver = new TemplateResolver();
defaultTemplateResolver.setTemplateMode(DEFAULT_TEMPLATE_MODE);
defaultTemplateResolver.setPrefix(prefix != null ? prefix : DEFAULT_PREFIX);
defaultTemplateResolver.setSuffix(suffix != null ? suffix : DEFAULT_SUFFIX);
defaultTemplateResolver.setCacheTTLMs(DEFAULT_CACHE_TTL_MS);
defaultTemplateResolver.setResourceResolver(new ClassLoaderResourceResolver());
return defaultTemplateResolver;
}
示例12: webTemplateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver webTemplateResolver() {
TemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix(TEMPLATE_RESOLVER_PREFIX);
templateResolver.setSuffix(TEMPLATE_RESOLVER_SUFFIX);
templateResolver.setTemplateMode(TEMPLATE_RESOLVER_TEMPLATE_MODE);
templateResolver.setCharacterEncoding(TEMPLATE_RESOLVER_CHAR_ENCODING);
templateResolver.setCacheable(false);
return templateResolver;
}
示例13: init
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
private void init() {
siteFolder = new File(BuilderFolders.SITE);
siteFolder.mkdirs();
TemplateResolver templateResolver = new TemplateResolver();
templateResolver.setResourceResolver(new ProjectResourceResolver());
templateResolver.setSuffix(".html");
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
templateEngine.initialize();
}
示例14: getMailTemplateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver getMailTemplateResolver() {
TemplateResolver resolver = new ClassLoaderTemplateResolver();
resolver.setPrefix("addon-administration/templates/mail/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setCharacterEncoding("UTF-8");
return resolver;
}
示例15: templateResolver
import org.thymeleaf.templateresolver.TemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver templateResolver() {
final TemplateResolver resolver = new ServletContextTemplateResolver();
resolver.setPrefix("/WEB-INF/templates/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
return resolver;
}