You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by pb...@apache.org on 2007/11/07 07:04:22 UTC

svn commit: r592622 - in /struts/struts1/trunk/core/src/main/java/org/apache/struts: Constants.java config/impl/ModuleConfigImpl.java

Author: pbenedict
Date: Tue Nov  6 22:04:21 2007
New Revision: 592622

URL: http://svn.apache.org/viewvc?rev=592622&view=rev
Log:
STR-3107: Add case-insensitive action matching option

Added:
    struts/struts1/trunk/core/src/main/java/org/apache/struts/Constants.java   (with props)
Modified:
    struts/struts1/trunk/core/src/main/java/org/apache/struts/config/impl/ModuleConfigImpl.java

Added: struts/struts1/trunk/core/src/main/java/org/apache/struts/Constants.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/Constants.java?rev=592622&view=auto
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/Constants.java (added)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/Constants.java Tue Nov  6 22:04:21 2007
@@ -0,0 +1,35 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts;
+
+/**
+ * This class provides a central location for framework configuration keys
+ * used to retrieve and store Struts configuration settings.
+ * 
+ * @version $Rev$
+ * @since Struts 1.4
+ */
+public class Constants {
+
+    /** Determines whether action mappings have case-sensitive names */
+    public static final String STRUTS_URL_CASESENSITIVE = "struts.url.caseSensitive";
+    
+}

Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/Constants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/struts1/trunk/core/src/main/java/org/apache/struts/Constants.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/config/impl/ModuleConfigImpl.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/config/impl/ModuleConfigImpl.java?rev=592622&r1=592621&r2=592622&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/config/impl/ModuleConfigImpl.java (original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/config/impl/ModuleConfigImpl.java Tue Nov  6 22:04:21 2007
@@ -22,6 +22,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.struts.Constants;
 import org.apache.struts.config.ActionConfig;
 import org.apache.struts.config.ActionConfigMatcher;
 import org.apache.struts.config.BaseConfig;
@@ -37,7 +38,9 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.List;
+import java.util.TreeMap;
 
 /**
  * <p>The collection of static configuration information that describes a
@@ -66,7 +69,7 @@
      * <p>The set of action configurations for this module, if any, keyed by
      * the <code>path</code> property.</p>
      */
-    protected HashMap actionConfigs = null;
+    protected Map actionConfigs = null;
 
     /**
      * <p>The set of action configuration for this module, if any, keyed by
@@ -712,4 +715,20 @@
         throwIfConfigured();
         messageResources.remove(config.getKey());
     }
+    
+    public void setProperty(String key, String value) {
+        super.setProperty(key, value);
+        
+        if (Constants.STRUTS_URL_CASESENSITIVE.equals(key)) {
+            Map actionConfigs2;
+            if (!Boolean.parseBoolean(value)) {
+                actionConfigs2 = new TreeMap(String.CASE_INSENSITIVE_ORDER);
+            } else {
+                actionConfigs2 = new HashMap();
+            }
+            actionConfigs2.putAll(actionConfigs);
+            actionConfigs = actionConfigs2;
+        }
+    }
+
 }