- 41521: Support * for servlet-name, submitted by Paul McMahan.
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 7 Feb 2007 22:53:07 +0000 (22:53 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 7 Feb 2007 22:53:07 +0000 (22:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@504726 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/ApplicationFilterFactory.java
java/org/apache/catalina/deploy/FilterMap.java

index d64688e..cb41188 100644 (file)
@@ -234,7 +234,7 @@ public final class ApplicationFilterFactory {
 
         // Check the specific "*" special URL pattern, which also matches
         // named dispatches
-        if (filterMap.getAllMatch())
+        if (filterMap.getMatchAllUrlPatterns())
             return (true);
         
         if (requestPath == null)
@@ -319,6 +319,10 @@ public final class ApplicationFilterFactory {
 
         if (servletName == null) {
             return (false);
+        }
+        // Check the specific "*" special servlet name
+        else if (filterMap.getMatchAllServletNames()) {
+            return (true);
         } else {
             String[] servletNames = filterMap.getServletNames();
             for (int i = 0; i < servletNames.length; i++) {
index 3df2a86..2f493d4 100644 (file)
@@ -87,24 +87,38 @@ public class FilterMap implements Serializable {
     }
 
     public void addServletName(String servletName) {
-        String[] results = new String[servletNames.length + 1];
-        System.arraycopy(servletNames, 0, results, 0, servletNames.length);
-        results[servletNames.length] = servletName;
-        servletNames = results;
+        if ("*".equals(servletName)) {
+            this.matchAllServletNames = true;
+        } else {
+            String[] results = new String[servletNames.length + 1];
+            System.arraycopy(servletNames, 0, results, 0, servletNames.length);
+            results[servletNames.length] = servletName;
+            servletNames = results;
+        }
     }
 
     
     /**
-     * The flag that indicates this mapping will match all.
+     * The flag that indicates this mapping will match all url-patterns
      */
-    private boolean allMatch = false;
+    private boolean matchAllUrlPatterns = false;
     
-    public boolean getAllMatch() {
-        return allMatch;
+    public boolean getMatchAllUrlPatterns() {
+        return matchAllUrlPatterns;
     }
     
 
     /**
+     * The flag that indicates this mapping will match all servlet-names
+     */
+    private boolean matchAllServletNames = false;
+    
+    public boolean getMatchAllServletNames() {
+        return matchAllServletNames;
+    }
+
+    
+    /**
      * The URL pattern this mapping matches.
      */
     private String[] urlPatterns = new String[0];
@@ -115,7 +129,7 @@ public class FilterMap implements Serializable {
 
     public void addURLPattern(String urlPattern) {
         if ("*".equals(urlPattern)) {
-            this.allMatch = true;
+            this.matchAllUrlPatterns = true;
         } else {
             String[] results = new String[urlPatterns.length + 1];
             System.arraycopy(urlPatterns, 0, results, 0, urlPatterns.length);