本文整理匯總了Java中org.thymeleaf.templateresolver.ServletContextTemplateResolver.setCharacterEncoding方法的典型用法代碼示例。如果您正苦於以下問題:Java ServletContextTemplateResolver.setCharacterEncoding方法的具體用法?Java ServletContextTemplateResolver.setCharacterEncoding怎麽用?Java ServletContextTemplateResolver.setCharacterEncoding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.thymeleaf.templateresolver.ServletContextTemplateResolver
的用法示例。
在下文中一共展示了ServletContextTemplateResolver.setCharacterEncoding方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
/**
* Initialize the Thymeleaf template engine.
*/
@Override
public void init() {
ServletConfig config = this.getServletConfig();
ServletContextTemplateResolver templateresolver = new ServletContextTemplateResolver();
templateresolver.setPrefix(config.getInitParameter(INIT_PARAM_PREFIX));
templateresolver.setSuffix(config.getInitParameter(INIT_PARAM_SUFFIX));
templateresolver.setTemplateMode(config.getInitParameter(INIT_PARAM_TEMPLATEMODE));
templateresolver.setCacheable(false);
templateresolver.setCharacterEncoding(CHARACTER_ENCODING);
templateengine = new TemplateEngine();
templateengine.setTemplateResolver(templateresolver);
Set<IDialect> dialects = new HashSet<IDialect>();
dialects.add(new SpringStandardDialect());
dialects.add(new SqlDialect());
templateengine.setDialects(dialects);
templateengine.initialize();
}
示例2: templateResolver
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver(ServletContext servletContext) {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(servletContext);
resolver.setPrefix(VIEWS);
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML");
resolver.setCharacterEncoding("UTF-8");
resolver.setOrder(1);
return resolver;
}
示例3: thymeleafViewResolver
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ThymeleafViewResolver thymeleafViewResolver(WebApplicationContext wac) {
ThymeleafViewResolver resolver = new ThymeleafViewResolver();
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("/WEB-INF/templates/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("HTML5");
templateResolver.setCharacterEncoding("UTF-8");
templateEngine.setTemplateResolver(templateResolver);
resolver.setTemplateEngine(templateEngine);
resolver.setOrder(2);
resolver.setApplicationContext(wac);
resolver.setCharacterEncoding("UTF-8");
//Enable the Spring Security Thymeleaf integration
templateEngine.addDialect(new LayoutDialect());
// caching
String[] activeProfiles = env.getActiveProfiles();
if (Arrays.asList(activeProfiles).contains("dev")) {
log.info("DEV Profile is active. Disabling template caching.");
templateResolver.setCacheable(false);
templateEngine.setCacheManager(null);
resolver.setCache(false);
}
return resolver;
}
示例4: servletContextTemplateResolver
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
private ServletContextTemplateResolver servletContextTemplateResolver() {
ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
resolver.setCharacterEncoding(characterEncoding);
resolver.setTemplateMode(templateMode);
resolver.setCacheable(templateCacheEnabled);
resolver.setOrder(1);
return resolver;
}
示例5: defaultTemplateResolver
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver defaultTemplateResolver() {
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("/WEB-INF/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("HTML5");
templateResolver.setCharacterEncoding("UTF-8");
return templateResolver;
}
示例6: templateResolver
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver() {
ServletContextTemplateResolver resolver =
new ServletContextTemplateResolver();
resolver.setPrefix("/views/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setOrder(1);
resolver.setCacheable(false);
resolver.setCharacterEncoding(DEFAULT_CHARSET.name());
return resolver;
}
示例7: configure
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
/**
* Configure settings from the struts.xml or struts.properties, using sensible
* defaults if values are not provided.
*/
public void configure() {
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setTemplateMode(templateMode);
templateResolver.setCharacterEncoding(characterEncoding);
templateResolver.setPrefix(prefix);
templateResolver.setSuffix(suffix);
templateResolver.setCacheable(cacheable);
templateResolver.setCacheTTLMs(cacheTtlMillis);
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
templateEngine.setMessageResolver(new StrutsMessageResolver());
}
示例8: thymeleafTemplateResolver
import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver thymeleafTemplateResolver() {
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("/WEB-INF/views/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("HTML5");
templateResolver.setCharacterEncoding("UTF-8");
// Uncomment these lines in order to use
// cache when resolving templates.
templateResolver.setCacheable(false);
templateResolver.setCacheTTLMs(0L);
// -------------------------------------
return templateResolver;
}