cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r264801 - in /cocoon/trunk: src/java/org/apache/cocoon/matching/LocaleMatcher.java status.xml
Date Tue, 30 Aug 2005 15:57:55 GMT
Author: vgritsenko
Date: Tue Aug 30 08:57:49 2005
New Revision: 264801

URL: http://svn.apache.org/viewcvs?rev=264801&view=rev
Log:
    <action dev="VG" type="update">
      LocaleMatcher can save resulting locale into request, session or cookie
      (if configured).
    </action>


Modified:
    cocoon/trunk/src/java/org/apache/cocoon/matching/LocaleMatcher.java
    cocoon/trunk/status.xml

Modified: cocoon/trunk/src/java/org/apache/cocoon/matching/LocaleMatcher.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/matching/LocaleMatcher.java?rev=264801&r1=264800&r2=264801&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/matching/LocaleMatcher.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/matching/LocaleMatcher.java Tue Aug 30 08:57:49
2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.matching;
 
+import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
@@ -148,7 +149,7 @@
  * @version CVS $Id$
  */
 public class LocaleMatcher extends AbstractLogEnabled
-                         implements Matcher, ThreadSafe, Serviceable, Configurable {
+                           implements Matcher, ThreadSafe, Serviceable, Configurable, Disposable
{
 
     private static final String DEFAULT_LOCALE_ATTRIBUTE = "locale";
     private static final String DEFAULT_DEFAULT_LANG = "en";
@@ -235,6 +236,13 @@
         }
     }
 
+    public void dispose() {
+        this.manager.release(this.resolver);
+        this.resolver = null;
+        this.manager = null;
+    }
+
+
     public Map match(final String pattern, Map objectModel, Parameters parameters)
     throws PatternException {
         final Map map = new HashMap();
@@ -257,17 +265,27 @@
                                              useBlankLocale,
                                              validator);
 
-        if (locale != null) {
+        if (locale == null) {
             if (getLogger().isDebugEnabled()) {
-                getLogger().debug("Locale " + locale + " found for resource: " + pattern);
+                getLogger().debug("No locale found for resource: " + pattern);
             }
-            return map;
+            return null;
         }
 
+        String localeStr = locale.toString();
         if (getLogger().isDebugEnabled()) {
-            getLogger().debug("No locale found for resource: " + pattern);
+            getLogger().debug("Locale " + localeStr + " found for resource: " + pattern);
         }
-        return null;
+
+        I18nUtils.storeLocale(objectModel,
+                              localeAttribute,
+                              localeStr,
+                              storeInRequest,
+                              storeInSession,
+                              storeInCookie,
+                              createSession);
+
+        return map;
     }
 
     private boolean isValidResource(String pattern, Locale locale, Map map) {

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?rev=264801&r1=264800&r2=264801&view=diff
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Tue Aug 30 08:57:49 2005
@@ -530,6 +530,10 @@
    </action>
   </release>
   <release version="2.1.8" date="TBD">
+    <action dev="VG" type="update">
+      LocaleMatcher can save resulting locale into request, session or cookie
+      (if configured).
+    </action>
     <action dev="CZ" type="add">
       Portal block: Add WSRP consumer support (through WSRP4J).
     </action>



Mime
View raw message