You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2017/03/16 10:09:45 UTC

[11/12] struts git commit: Decouples LocaleProvider instance from long living interceptor state

Decouples LocaleProvider instance from long living interceptor state


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/4eb22020
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/4eb22020
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/4eb22020

Branch: refs/heads/master
Commit: 4eb22020a474ffaa69484c8e3dd0711dc517d6e8
Parents: 8298371
Author: Lukasz Lenart <lu...@apache.org>
Authored: Thu Mar 16 08:15:04 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Thu Mar 16 08:15:04 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/struts2/interceptor/I18nInterceptor.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/4eb22020/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java
index f97176f..722beb0 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java
@@ -59,7 +59,7 @@ public class I18nInterceptor extends AbstractInterceptor {
     protected String requestCookieParameterName = DEFAULT_COOKIE_PARAMETER;
     protected Storage storage = Storage.SESSION;
 
-    protected LocaleProvider localeProvider;
+    protected LocaleProviderFactory localeProviderFactory;
 
     // Request-Only = None
     protected enum Storage { COOKIE, SESSION, NONE }
@@ -95,7 +95,7 @@ public class I18nInterceptor extends AbstractInterceptor {
 
     @Inject
     public void setLocaleProviderFactory(LocaleProviderFactory localeProviderFactory) {
-        this.localeProvider = localeProviderFactory.createLocaleProvider();
+        this.localeProviderFactory = localeProviderFactory;
     }
 
     @Override
@@ -157,6 +157,8 @@ public class I18nInterceptor extends AbstractInterceptor {
      * @return the Locale
      */
     protected Locale getLocaleFromParam(Object requestedLocale) {
+        LocaleProvider localeProvider = localeProviderFactory.createLocaleProvider();
+
         Locale locale = null;
         if (requestedLocale != null) {
             if (requestedLocale instanceof Locale) {