- Add support for the new "*" special URL pattern for filters.
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 4 Apr 2006 00:03:14 +0000 (00:03 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 4 Apr 2006 00:03:14 +0000 (00:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@391184 13f79535-47bb-0310-9956-ffa450edef68

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

index d178c46..0ff2ca9 100644 (file)
@@ -196,13 +196,18 @@ public final class ApplicationFilterFactory {
     /**\r
      * Return <code>true</code> if the context-relative request path\r
      * matches the requirements of the specified filter mapping;\r
-     * otherwise, return <code>null</code>.\r
+     * otherwise, return <code>false</code>.\r
      *\r
      * @param filterMap Filter mapping being checked\r
      * @param requestPath Context-relative request path of this request\r
      */\r
     private boolean matchFiltersURL(FilterMap filterMap, String requestPath) {\r
 \r
+        // Check the specific "*" special URL pattern, which also matches\r
+        // named dispatches\r
+        if (filterMap.getAllMatch())\r
+            return (true);\r
+        \r
         if (requestPath == null)\r
             return (false);\r
 \r
index 2c59e4e..c4d2cd7 100644 (file)
@@ -89,6 +89,16 @@ public class FilterMap implements Serializable {
         this.servletName = servletName;\r
     }\r
 \r
+    \r
+    /**\r
+     * The flag that indicates this mapping will match all.\r
+     */\r
+    private boolean allMatch = false;\r
+    \r
+    public boolean getAllMatch() {\r
+        return allMatch;\r
+    }\r
+    \r
 \r
     /**\r
      * The URL pattern this mapping matches.\r
@@ -100,7 +110,11 @@ public class FilterMap implements Serializable {
     }\r
 \r
     public void setURLPattern(String urlPattern) {\r
-        this.urlPattern = RequestUtil.URLDecode(urlPattern);\r
+        if ("*".equals(urlPattern)) {\r
+            this.allMatch = true;\r
+        } else {\r
+            this.urlPattern = RequestUtil.URLDecode(urlPattern);\r
+        }\r
     }\r
     \r
     /**\r