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
*/
@@ -102,9 +100,6 @@ public boolean matches(HttpServletRequest request) {
102
100
*/
103
101
@ Override
104
102
public MatchResult matcher (HttpServletRequest request ) {
105
- if (!this .servletPath .matches (request )) {
106
- return MatchResult .notMatch ();
107
- }
108
103
if (!this .method .matches (request )) {
109
104
return MatchResult .notMatch ();
110
105
}
@@ -232,8 +227,9 @@ public Builder basePath(String basePath) {
232
227
* also be followed by {@code /**} to signify all URIs under a given path.
233
228
*
234
229
* <p>
235
- * These must be specified relative to any servlet path prefix (meaning you should
236
- * exclude the context path and any servlet path prefix in stating your pattern).
230
+ * These must be specified relative to any context path prefix. A
231
+ * {@link #basePath} may be specified to reuse a common prefix, for example a
232
+ * servlet path.
237
233
*
238
234
* <p>
239
235
* The following are valid patterns and their meaning
@@ -266,8 +262,9 @@ public PathPatternRequestMatcher matcher(String path) {
266
262
* also be followed by {@code /**} to signify all URIs under a given path.
267
263
*
268
264
* <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).
265
+ * These must be specified relative to any context path prefix. A
266
+ * {@link #basePath} may be specified to reuse a common prefix, for example a
267
+ * servlet path.
271
268
*
272
269
* <p>
273
270
* The following are valid patterns and their meaning
0 commit comments