Merge branch '6.5.x'

This commit is contained in:
Josh Cummings 2025-07-07 11:43:25 -06:00
commit 74771a3d42
No known key found for this signature in database
GPG Key ID: 869B37A20E876129

View File

@ -38,8 +38,8 @@ import org.springframework.web.util.pattern.PathPatternParser;
* (that is, it should exclude any context path). * (that is, it should exclude any context path).
* *
* <p> * <p>
* You can provide the servlet path in {@link PathPatternRequestMatcher#servletPath} and * You can provide the servlet path in {@link PathPatternRequestMatcher.Builder#basePath}
* reuse for multiple matchers. * and reuse for multiple matchers.
* *
* <p> * <p>
* Note that the {@link org.springframework.web.servlet.HandlerMapping} that contains the * 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 final PathPattern pattern;
private RequestMatcher servletPath = AnyRequestMatcher.INSTANCE;
private RequestMatcher method = AnyRequestMatcher.INSTANCE; private RequestMatcher method = AnyRequestMatcher.INSTANCE;
/** /**
* Creates a {@link PathPatternRequestMatcher} that uses the provided {@code pattern}. * Creates a {@link PathPatternRequestMatcher} that uses the provided {@code pattern}.
* <p> * <p>
* The {@code pattern} should be relative to the servlet path * The {@code pattern} should be relative to the context path
* </p> * </p>
* @param pattern the pattern used to match * @param pattern the pattern used to match
*/ */
@ -136,9 +134,6 @@ public final class PathPatternRequestMatcher implements RequestMatcher {
*/ */
@Override @Override
public MatchResult matcher(HttpServletRequest request) { public MatchResult matcher(HttpServletRequest request) {
if (!this.servletPath.matches(request)) {
return MatchResult.notMatch();
}
if (!this.method.matches(request)) { if (!this.method.matches(request)) {
return MatchResult.notMatch(); return MatchResult.notMatch();
} }
@ -266,8 +261,9 @@ public final class PathPatternRequestMatcher implements RequestMatcher {
* also be followed by {@code /**} to signify all URIs under a given path. * also be followed by {@code /**} to signify all URIs under a given path.
* *
* <p> * <p>
* These must be specified relative to any servlet path prefix (meaning you should * These must be specified relative to any context path prefix. A
* exclude the context path and any servlet path prefix in stating your pattern). * {@link #basePath} may be specified to reuse a common prefix, for example a
* servlet path.
* *
* <p> * <p>
* The following are valid patterns and their meaning * The following are valid patterns and their meaning
@ -300,8 +296,9 @@ public final class PathPatternRequestMatcher implements RequestMatcher {
* also be followed by {@code /**} to signify all URIs under a given path. * also be followed by {@code /**} to signify all URIs under a given path.
* *
* <p> * <p>
* These must be specified relative to any servlet path prefix (meaning you should * These must be specified relative to any context path prefix. A
* exclude the context path and any servlet path prefix in stating your pattern). * {@link #basePath} may be specified to reuse a common prefix, for example a
* servlet path.
* *
* <p> * <p>
* The following are valid patterns and their meaning * The following are valid patterns and their meaning