title: change locale in filter class in Spring MVC
body: <p>how to change locale in filter class in springMVC.</p>
  
  <p>in my filter class I'm using below code:</p>
  
  <pre><code>LocaleContextHolder.setLocale(new Locale(lang));
  </code></pre>
  
  <p>I'm passing <strong>lang</strong> value is <strong>"ms"</strong>.</p>
  
  <p>when I change locale from UI it is working fine. i want change in filter calss, it is not working.</p>
  
  <p>in my <strong>spring-servlet.xml</strong> below things i configured.</p>
  
  <pre><code>&lt;bean id="localeResolver"
      class="org.springframework.web.servlet.i18n.SessionLocaleResolver"&gt;
      &lt;property name="defaultLocale" value="en" /&gt;    
  &lt;/bean&gt;
  &lt;mvc:interceptors&gt;
      &lt;bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt;
          &lt;property name="paramName"&gt;
              &lt;value&gt;locale&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/mvc:interceptors&gt;
  </code></pre>
  
  <p><strong>Web.xml</strong>
  
          org.springframework.web.context.ContextLoaderListener
      </p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
      classpath:/conf/context/spring-platform.xml 
      classpath:/conf/context/spring-beans.xml 
      classpath:/conf/context/spring-security.xml 
      &lt;/param-value&gt;
  &lt;/context-param&gt;
  
  
  &lt;filter&gt;
      &lt;filter-name&gt;accessFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;accessFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;spring&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;session-config&gt;
      &lt;session-timeout&gt;30&lt;/session-timeout&gt;
  &lt;/session-config&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;jersy&lt;/servlet-name&gt;
      &lt;!-- &lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;/servlet-class&gt; --&gt;
      &lt;servlet-class&gt;com.sun.jersey.spi.spring.container.servlet.SpringServlet&lt;/servlet-class&gt;
      &lt;!-- &lt;init-param&gt; &lt;param-name&gt;com.sun.jersey.config.property.packages&lt;/param-name&gt; 
          &lt;param-value&gt;org.managers&lt;/param-value&gt; &lt;/init-param&gt; --&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;com.sun.jersey.api.json.POJOMappingFeature&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
          &lt;!-- &lt;param-name&gt;com.sun.jersey.spi.container.ContainerRequestFilters&lt;/param-name&gt;
          &lt;param-value&gt;org.filter.ServiceRequestFilter&lt;/param-value&gt;   --&gt;    
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;jersy&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/services/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;jsp-config&gt;
      &lt;taglib&gt;
          &lt;taglib-uri&gt;http://www.springframework.org/tags&lt;/taglib-uri&gt;
          &lt;taglib-location&gt;/resources/tlds/spring.tld&lt;/taglib-location&gt;
      &lt;/taglib&gt;
  &lt;/jsp-config&gt;
  </code></pre>
  
  <p>Noting is happening(Locale is not changing). No Exception in logs or console.</p>