From: remm Date: Tue, 4 Apr 2006 00:03:14 +0000 (+0000) Subject: - Add support for the new "*" special URL pattern for filters. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2da480aab28aa006fc83bf24a854dac4542cc0cd;p=tomcat7.0 - Add support for the new "*" special URL pattern for filters. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@391184 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/ApplicationFilterFactory.java b/java/org/apache/catalina/core/ApplicationFilterFactory.java index d178c46fd..0ff2ca992 100644 --- a/java/org/apache/catalina/core/ApplicationFilterFactory.java +++ b/java/org/apache/catalina/core/ApplicationFilterFactory.java @@ -196,13 +196,18 @@ public final class ApplicationFilterFactory { /** * Return true if the context-relative request path * matches the requirements of the specified filter mapping; - * otherwise, return null. + * otherwise, return false. * * @param filterMap Filter mapping being checked * @param requestPath Context-relative request path of this request */ private boolean matchFiltersURL(FilterMap filterMap, String requestPath) { + // Check the specific "*" special URL pattern, which also matches + // named dispatches + if (filterMap.getAllMatch()) + return (true); + if (requestPath == null) return (false); diff --git a/java/org/apache/catalina/deploy/FilterMap.java b/java/org/apache/catalina/deploy/FilterMap.java index 2c59e4ef6..c4d2cd7fe 100644 --- a/java/org/apache/catalina/deploy/FilterMap.java +++ b/java/org/apache/catalina/deploy/FilterMap.java @@ -89,6 +89,16 @@ public class FilterMap implements Serializable { this.servletName = servletName; } + + /** + * The flag that indicates this mapping will match all. + */ + private boolean allMatch = false; + + public boolean getAllMatch() { + return allMatch; + } + /** * The URL pattern this mapping matches. @@ -100,7 +110,11 @@ public class FilterMap implements Serializable { } public void setURLPattern(String urlPattern) { - this.urlPattern = RequestUtil.URLDecode(urlPattern); + if ("*".equals(urlPattern)) { + this.allMatch = true; + } else { + this.urlPattern = RequestUtil.URLDecode(urlPattern); + } } /**