diff options
author | Alexander Alexeev | 2016-11-24 02:28:39 +0700 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-24 12:05:11 +0300 |
commit | 71cc00a9592dde870e239785036a526e054af026 (patch) | |
tree | e828162f55036008c3eed4c8c5b034cdcdf25d45 | |
parent | c207b80dd642dd8d5c18340fa5982a3c61ead460 (diff) |
set encoding to UTF-8
-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; } |