diff --git a/web/src/main/java/org/springframework/security/web/servlet/util/matcher/PathPatternRequestMatcher.java b/web/src/main/java/org/springframework/security/web/servlet/util/matcher/PathPatternRequestMatcher.java index 1abe7d94c9..81ee5976b2 100644 --- a/web/src/main/java/org/springframework/security/web/servlet/util/matcher/PathPatternRequestMatcher.java +++ b/web/src/main/java/org/springframework/security/web/servlet/util/matcher/PathPatternRequestMatcher.java @@ -38,8 +38,8 @@ import org.springframework.web.util.pattern.PathPatternParser; * (that is, it should exclude any context path). * *
- * You can provide the servlet path in {@link PathPatternRequestMatcher#servletPath} and - * reuse for multiple matchers. + * You can provide the servlet path in {@link PathPatternRequestMatcher.Builder#basePath} + * and reuse for multiple matchers. * *
* Note that the {@link org.springframework.web.servlet.HandlerMapping} that contains the @@ -55,14 +55,12 @@ public final class PathPatternRequestMatcher implements RequestMatcher { private final PathPattern pattern; - private RequestMatcher servletPath = AnyRequestMatcher.INSTANCE; - private RequestMatcher method = AnyRequestMatcher.INSTANCE; /** * Creates a {@link PathPatternRequestMatcher} that uses the provided {@code pattern}. *
- * The {@code pattern} should be relative to the servlet path + * The {@code pattern} should be relative to the context path *
* @param pattern the pattern used to match */ @@ -102,9 +100,6 @@ public final class PathPatternRequestMatcher implements RequestMatcher { */ @Override public MatchResult matcher(HttpServletRequest request) { - if (!this.servletPath.matches(request)) { - return MatchResult.notMatch(); - } if (!this.method.matches(request)) { return MatchResult.notMatch(); } @@ -232,8 +227,9 @@ public final class PathPatternRequestMatcher implements RequestMatcher { * also be followed by {@code /**} to signify all URIs under a given path. * *- * These must be specified relative to any servlet path prefix (meaning you should - * exclude the context path and any servlet path prefix in stating your pattern). + * These must be specified relative to any context path prefix. A + * {@link #basePath} may be specified to reuse a common prefix, for example a + * servlet path. * *
* The following are valid patterns and their meaning @@ -266,8 +262,9 @@ public final class PathPatternRequestMatcher implements RequestMatcher { * also be followed by {@code /**} to signify all URIs under a given path. * *
- * These must be specified relative to any servlet path prefix (meaning you should - * exclude the context path and any servlet path prefix in stating your pattern). + * These must be specified relative to any context path prefix. A + * {@link #basePath} may be specified to reuse a common prefix, for example a + * servlet path. * *
* The following are valid patterns and their meaning