tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r831764 - in /tomcat/trunk/java/org/apache/catalina: deploy/FilterMap.java startup/WebXml.java
Date Sun, 01 Nov 2009 21:46:09 GMT
Author: markt
Date: Sun Nov  1 21:46:09 2009
New Revision: 831764

URL: http://svn.apache.org/viewvc?rev=831764&view=rev
Log:
Trying to merge filter maps is a bad idea.

Modified:
    tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java
    tomcat/trunk/java/org/apache/catalina/startup/WebXml.java

Modified: tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java?rev=831764&r1=831763&r2=831764&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/FilterMap.java Sun Nov  1 21:46:09 2009
@@ -37,11 +37,12 @@
 
 public class FilterMap implements Serializable {
 
-    private static final long serialVersionUID = 1L;
-    
+
     // ------------------------------------------------------------- Properties
 
 
+    private static final long serialVersionUID = 1L;
+    
     /**
      * The name of this filter to be executed when this mapping matches
      * a particular request.
@@ -100,15 +101,6 @@
         }
     }
 
-    public void addServletNames(String[] servletNames) {
-        if (servletNames != null) {
-            for (int i = 0; i < servletNames.length; i++) {
-                addServletName(servletNames[i]);
-            }
-        }
-    }
-
-
     
     /**
      * The flag that indicates this mapping will match all url-patterns
@@ -150,14 +142,6 @@
         }
     }
     
-    public void addUrlPatterns(String[] urlPatterns) {
-        if (urlPatterns != null) {
-            for (int i = 0; i < urlPatterns.length; i++) {
-                addURLPattern(urlPatterns[i]);
-            }
-        }
-    }
-
     /**
      *
      * This method will be used to set the current state of the FilterMap
@@ -240,10 +224,6 @@
         else return dispatcherMapping; 
     }
 
-    public void addDispatcherMapping(int dispatcherMapping) {
-        // Merge the supplied mapping with the current mapping
-        this.dispatcherMapping =  getDispatcherMapping() | dispatcherMapping;
-    }
 
     // --------------------------------------------------------- Public Methods
 

Modified: tomcat/trunk/java/org/apache/catalina/startup/WebXml.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/WebXml.java?rev=831764&r1=831763&r2=831764&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/WebXml.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/WebXml.java Sun Nov  1 21:46:09 2009
@@ -184,11 +184,11 @@
     public Map<String,FilterDef> getFilters() { return filters; }
     
     // filter-mapping
-    private Map<String,FilterMap> filterMaps = new HashMap<String,FilterMap>();
+    private Set<FilterMap> filterMaps = new LinkedHashSet<FilterMap>();
     public void addFilterMapping(FilterMap filterMap) {
-        filterMaps.put(filterMap.getFilterName(),filterMap);
+        filterMaps.add(filterMap);
     }
-    public Map<String,FilterMap> getFilterMappings() { return filterMaps; }
+    public Set<FilterMap> getFilterMappings() { return filterMaps; }
     
     // listener
     // TODO: description (multiple with language) is ignored
@@ -470,7 +470,7 @@
         for (FilterDef filter : filters.values()) {
             context.addFilterDef(filter);
         }
-        for (FilterMap filterMap : filterMaps.values()) {
+        for (FilterMap filterMap : filterMaps) {
             context.addFilterMap(filterMap);
         }
         // jsp-property-group needs to be after servlet configuration
@@ -774,20 +774,9 @@
         errorPages.putAll(temp.getErrorPages());
 
         for (WebXml fragment : fragments) {
-            for (String filterName : fragment.getFilterMappings().keySet()) {
-                FilterMap filterMap =
-                    fragment.getFilterMappings().get(filterName);
+            for (FilterMap filterMap : fragment.getFilterMappings()) {
                 // Always additive
-                if (filterMaps.containsKey(filterName)) {
-                    FilterMap appFilterMap = filterMaps.get(filterName);
-                    
-                    appFilterMap.addDispatcherMapping(
-                            filterMap.getDispatcherMapping());
-                    appFilterMap.addServletNames(filterMap.getServletNames());
-                    appFilterMap.addUrlPatterns(filterMap.getURLPatterns());
-                } else {
-                    addFilterMapping(filterMap);
-                }
+                addFilterMapping(filterMap);
             }
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message