From ded0613d496c158a3d349d9729f1e16f51a89934 Mon Sep 17 00:00:00 2001 From: remm Date: Wed, 7 Feb 2007 22:53:07 +0000 Subject: [PATCH] - 41521: Support * for servlet-name, submitted by Paul McMahan. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@504726 13f79535-47bb-0310-9956-ffa450edef68 --- .../catalina/core/ApplicationFilterFactory.java | 6 +++- java/org/apache/catalina/deploy/FilterMap.java | 32 ++++++++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/java/org/apache/catalina/core/ApplicationFilterFactory.java b/java/org/apache/catalina/core/ApplicationFilterFactory.java index d64688e3c..cb41188be 100644 --- a/java/org/apache/catalina/core/ApplicationFilterFactory.java +++ b/java/org/apache/catalina/core/ApplicationFilterFactory.java @@ -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++) { diff --git a/java/org/apache/catalina/deploy/FilterMap.java b/java/org/apache/catalina/deploy/FilterMap.java index 3df2a86d2..2f493d4a9 100644 --- a/java/org/apache/catalina/deploy/FilterMap.java +++ b/java/org/apache/catalina/deploy/FilterMap.java @@ -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); -- 2.11.0