38
38
* (that is, it should exclude any context path).
39
39
*
40
40
* <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.
43
43
*
44
44
* <p>
45
45
* Note that the {@link org.springframework.web.servlet.HandlerMapping} that contains the
@@ -55,14 +55,12 @@ public final class PathPatternRequestMatcher implements RequestMatcher {
55
55
56
56
private final PathPattern pattern ;
57
57
58
- private RequestMatcher servletPath = AnyRequestMatcher .INSTANCE ;
59
-
60
58
private RequestMatcher method = AnyRequestMatcher .INSTANCE ;
61
59
62
60
/**
63
61
* Creates a {@link PathPatternRequestMatcher} that uses the provided {@code pattern}.
64
62
* <p>
65
- * The {@code pattern} should be relative to the servlet path
63
+ * The {@code pattern} should be relative to the context path
66
64
* </p>
67
65
* @param pattern the pattern used to match
68
66
*/
@@ -136,9 +134,6 @@ public boolean matches(HttpServletRequest request) {
136
134
*/
137
135
@ Override
138
136
public MatchResult matcher (HttpServletRequest request ) {
139
- if (!this .servletPath .matches (request )) {
140
- return MatchResult .notMatch ();
141
- }
142
137
if (!this .method .matches (request )) {
143
138
return MatchResult .notMatch ();
144
139
}
@@ -266,8 +261,9 @@ public Builder basePath(String basePath) {
266
261
* also be followed by {@code /**} to signify all URIs under a given path.
267
262
*
268
263
* <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.
271
267
*
272
268
* <p>
273
269
* The following are valid patterns and their meaning
@@ -300,8 +296,9 @@ public PathPatternRequestMatcher matcher(String path) {
300
296
* also be followed by {@code /**} to signify all URIs under a given path.
301
297
*
302
298
* <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.
305
302
*
306
303
* <p>
307
304
* The following are valid patterns and their meaning
0 commit comments