diff options
Diffstat (limited to 'jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java')
-rw-r--r-- | jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java index 4563305659..9f0732e5ef 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/ServletPathSpec.java @@ -54,15 +54,18 @@ public class ServletPathSpec extends PathSpec if ((servletPathSpec.charAt(0) == '/') && (specLength > 1) && (lastChar == '*')) { this.group = PathSpecGroup.PREFIX_GLOB; + this.prefix = servletPathSpec.substring(0,specLength-2); } // suffix based else if (servletPathSpec.charAt(0) == '*') { this.group = PathSpecGroup.SUFFIX_GLOB; + this.suffix = servletPathSpec.substring(2,specLength); } else { this.group = PathSpecGroup.EXACT; + this.prefix = servletPathSpec; } for (int i = 0; i < specLength; i++) @@ -109,6 +112,11 @@ public class ServletPathSpec extends PathSpec { throw new IllegalArgumentException("Servlet Spec 12.2 violation: glob '*' can only exist at end of prefix based matches: bad spec \""+ servletPathSpec +"\""); } + + if (idx<1 || servletPathSpec.charAt(idx-1)!='/') + { + throw new IllegalArgumentException("Servlet Spec 12.2 violation: suffix glob '*' can only exist after '/': bad spec \""+ servletPathSpec +"\""); + } } else if (servletPathSpec.startsWith("*.")) { |