diff options
Diffstat (limited to 'juick-spring-www/src/main/java/com/juick/www/configuration')
-rw-r--r-- | juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java | 7 | ||||
-rw-r--r-- | juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java | 3 |
2 files changed, 4 insertions, 6 deletions
diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java index d5a3bbef..e62b1042 100644 --- a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java +++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java @@ -39,13 +39,8 @@ public class WwwInitializer extends AbstractAnnotationConfigDispatcherServletIni public void onStartup(ServletContext servletContext) throws ServletException { super.onStartup(servletContext); - CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter(); - - encodingFilter.setEncoding("UTF-8"); - encodingFilter.setForceEncoding(true); - FilterRegistration.Dynamic registration = servletContext.addFilter( - "encodingFilter", new CharacterEncodingFilter()); + "encodingFilter", new CharacterEncodingFilter("UTF-8", true)); registration.addMappingForUrlPatterns(null, true, "/*"); } diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java index 5c17897c..9a2bb1d4 100644 --- a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java +++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java @@ -45,6 +45,8 @@ public class WwwServletConfiguration extends WebMvcConfigurationSupport { // Template cache is true by default. Set to false if you want // templates to be automatically updated when modified. templateResolver.setCacheable(true); + + templateResolver.setCharacterEncoding("UTF-8"); return templateResolver; } @@ -72,6 +74,7 @@ public class WwwServletConfiguration extends WebMvcConfigurationSupport { public ThymeleafViewResolver viewResolver() { ThymeleafViewResolver viewResolver = new ThymeleafViewResolver(); viewResolver.setTemplateEngine(templateEngine()); + viewResolver.setCharacterEncoding("UTF-8"); return viewResolver; } |