Skip to content

Commit 74771a3

Browse files
committed
Merge branch '6.5.x'
2 parents fdf52f0 + ea3ba62 commit 74771a3

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

web/src/main/java/org/springframework/security/web/servlet/util/matcher/PathPatternRequestMatcher.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
* (that is, it should exclude any context path).
3939
*
4040
* <p>
41-
* You can provide the servlet path in {@link PathPatternRequestMatcher#servletPath} and
42-
* reuse for multiple matchers.
41+
* You can provide the servlet path in {@link PathPatternRequestMatcher.Builder#basePath}
42+
* and reuse for multiple matchers.
4343
*
4444
* <p>
4545
* Note that the {@link org.springframework.web.servlet.HandlerMapping} that contains the
@@ -55,14 +55,12 @@ public final class PathPatternRequestMatcher implements RequestMatcher {
5555

5656
private final PathPattern pattern;
5757

58-
private RequestMatcher servletPath = AnyRequestMatcher.INSTANCE;
59-
6058
private RequestMatcher method = AnyRequestMatcher.INSTANCE;
6159

6260
/**
6361
* Creates a {@link PathPatternRequestMatcher} that uses the provided {@code pattern}.
6462
* <p>
65-
* The {@code pattern} should be relative to the servlet path
63+
* The {@code pattern} should be relative to the context path
6664
* </p>
6765
* @param pattern the pattern used to match
6866
*/
@@ -136,9 +134,6 @@ public boolean matches(HttpServletRequest request) {
136134
*/
137135
@Override
138136
public MatchResult matcher(HttpServletRequest request) {
139-
if (!this.servletPath.matches(request)) {
140-
return MatchResult.notMatch();
141-
}
142137
if (!this.method.matches(request)) {
143138
return MatchResult.notMatch();
144139
}
@@ -266,8 +261,9 @@ public Builder basePath(String basePath) {
266261
* also be followed by {@code /**} to signify all URIs under a given path.
267262
*
268263
* <p>
269-
* These must be specified relative to any servlet path prefix (meaning you should
270-
* exclude the context path and any servlet path prefix in stating your pattern).
264+
* These must be specified relative to any context path prefix. A
265+
* {@link #basePath} may be specified to reuse a common prefix, for example a
266+
* servlet path.
271267
*
272268
* <p>
273269
* The following are valid patterns and their meaning
@@ -300,8 +296,9 @@ public PathPatternRequestMatcher matcher(String path) {
300296
* also be followed by {@code /**} to signify all URIs under a given path.
301297
*
302298
* <p>
303-
* These must be specified relative to any servlet path prefix (meaning you should
304-
* exclude the context path and any servlet path prefix in stating your pattern).
299+
* These must be specified relative to any context path prefix. A
300+
* {@link #basePath} may be specified to reuse a common prefix, for example a
301+
* servlet path.
305302
*
306303
* <p>
307304
* The following are valid patterns and their meaning

0 commit comments

Comments
 (0)