You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2008/04/08 17:07:04 UTC

svn commit: r645966 - in /turbine/core/trunk: src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java xdocs/changes.xml

Author: tv
Date: Tue Apr  8 08:07:03 2008
New Revision: 645966

URL: http://svn.apache.org/viewvc?rev=645966&view=rev
Log:
Initialize the locale of RunData, the ParameterParser and the CookieParser from the HttpServletRequest. Make RunData.setLocale propagate the locale setting to the parsers.

Modified:
    turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
    turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java
    turbine/core/trunk/xdocs/changes.xml

Modified: turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java?rev=645966&r1=645965&r2=645966&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java Tue Apr  8 08:07:03 2008
@@ -979,6 +979,16 @@
     public void setLocale(Locale locale)
     {
         this.locale = locale;
+        
+        if (parameters != null)
+        {
+            parameters.setLocale(locale);
+        }
+
+        if (cookies != null)
+        {
+            cookies.setLocale(locale);
+        }
     }
 
     /**

Modified: turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java?rev=645966&r1=645965&r2=645966&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java Tue Apr  8 08:07:03 2008
@@ -23,6 +23,7 @@
 
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Map;
 
 import javax.servlet.ServletConfig;
@@ -248,6 +249,17 @@
             // also copy data directly into pipelineData
             pipelineDataMap.put(ParameterParser.class, pp);
             pipelineDataMap.put(CookieParser.class, cp);
+            
+            Locale locale = req.getLocale();
+            
+            if (locale == null)
+            {
+                // get the default from the Turbine configuration
+                locale = data.getLocale();
+            }
+            
+            // set the locale detected and propagate it to the parsers
+            data.setLocale(locale);
         }
         catch (PoolException pe)
         {

Modified: turbine/core/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/turbine/core/trunk/xdocs/changes.xml?rev=645966&r1=645965&r2=645966&view=diff
==============================================================================
--- turbine/core/trunk/xdocs/changes.xml (original)
+++ turbine/core/trunk/xdocs/changes.xml Tue Apr  8 08:07:03 2008
@@ -25,6 +25,11 @@
 
   <body>
     <release version="2.4-M2" date="in Subversion">
+      <action type="update" dev="tv">
+        Initialize the locale of RunData, the ParameterParser and the CookieParser 
+        from the HttpServletRequest. Make RunData.setLocale propagate the locale 
+        setting to the parsers.
+      </action>
       <action type="update" dev="tv" issue="TRB-39">
         Make sure that Turbine uses the ParserService to get 
         correctly initialized parser objects.