From 71cc00a9592dde870e239785036a526e054af026 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Thu, 24 Nov 2016 02:28:39 +0700 Subject: set encoding to UTF-8 --- .../src/main/java/com/juick/www/configuration/WwwInitializer.java | 7 +------ .../java/com/juick/www/configuration/WwwServletConfiguration.java | 3 +++ 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'juick-spring-www/src/main/java/com') 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; } -- cgit v1.2.3