From 300a0439b2a6e26d9025247ef780c886616d4ae1 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 16 Dec 2016 15:41:14 +0300 Subject: CharEncoding.UTF_8 --- .../main/java/com/juick/www/configuration/WebAppConfiguration.java | 3 ++- .../src/main/java/com/juick/www/configuration/WwwInitializer.java | 3 ++- .../java/com/juick/www/configuration/WwwServletConfiguration.java | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'juick-spring-www/src/main/java/com/juick/www/configuration') diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WebAppConfiguration.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WebAppConfiguration.java index 28a0f29a..4482dce1 100644 --- a/juick-spring-www/src/main/java/com/juick/www/configuration/WebAppConfiguration.java +++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WebAppConfiguration.java @@ -2,6 +2,7 @@ package com.juick.www.configuration; import com.juick.www.HelpService; import com.juick.www.WebApp; +import org.apache.commons.lang3.CharEncoding; import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.guava.GuavaCacheManager; import org.springframework.cache.interceptor.KeyGenerator; @@ -29,7 +30,7 @@ public class WebAppConfiguration { ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); messageSource.setBasenames("messages", "errors"); - messageSource.setDefaultEncoding("UTF-8"); + messageSource.setDefaultEncoding(CharEncoding.UTF_8); messageSource.setFallbackToSystemLocale(false); messageSource.setUseCodeAsDefaultMessage(true); 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 edb9a9fc..33687983 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 @@ -2,6 +2,7 @@ package com.juick.www.configuration; import com.juick.configuration.DataConfiguration; import com.juick.configuration.SearchConfiguration; +import org.apache.commons.lang3.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; @@ -43,7 +44,7 @@ public class WwwInitializer extends AbstractAnnotationConfigDispatcherServletIni super.onStartup(servletContext); FilterRegistration.Dynamic registration = servletContext.addFilter( - "encodingFilter", new CharacterEncodingFilter("UTF-8", true)); + "encodingFilter", new CharacterEncodingFilter(CharEncoding.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 15f85c9a..5cd251e6 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 @@ -5,6 +5,7 @@ import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.juick.www.formatter.SpringDateFormatter; import nz.net.ultraq.thymeleaf.LayoutDialect; import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.CharEncoding; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -55,7 +56,7 @@ public class WwwServletConfiguration extends WebMvcConfigurationSupport { // templates to be automatically updated when modified. templateResolver.setCacheable(true); - templateResolver.setCharacterEncoding("UTF-8"); + templateResolver.setCharacterEncoding(CharEncoding.UTF_8); return templateResolver; } @@ -83,7 +84,7 @@ public class WwwServletConfiguration extends WebMvcConfigurationSupport { public ThymeleafViewResolver viewResolver() { ThymeleafViewResolver viewResolver = new ThymeleafViewResolver(); viewResolver.setTemplateEngine(templateEngine()); - viewResolver.setCharacterEncoding("UTF-8"); + viewResolver.setCharacterEncoding(CharEncoding.UTF_8); viewResolver.addStaticVariable( "showSape", BooleanUtils.toBoolean(env.getProperty("template.showSape", "true"))); -- cgit v1.2.3