Deprecate and set trailingSlash option to false
Closes gh-28552
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -150,6 +150,7 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||
private boolean catchAll = false;
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
PathPattern(String patternText, PathPatternParser parser, @Nullable PathElement head) {
|
||||
this.patternString = patternText;
|
||||
this.parser = parser;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,7 +34,7 @@ import org.springframework.http.server.PathContainer;
|
||||
*/
|
||||
public class PathPatternParser {
|
||||
|
||||
private boolean matchOptionalTrailingSeparator = true;
|
||||
private boolean matchOptionalTrailingSeparator = false;
|
||||
|
||||
private boolean caseSensitive = true;
|
||||
|
||||
@@ -48,15 +48,22 @@ public class PathPatternParser {
|
||||
* will also match request paths with a trailing slash. If set to
|
||||
* {@code false} a {@code PathPattern} will only match request paths with
|
||||
* a trailing slash.
|
||||
* <p>The default is {@code true}.
|
||||
* <p>The default was changed in 6.0 from {@code true} to {@code false} in
|
||||
* order to support the deprecation of the property.
|
||||
* @deprecated transparent support for trailing slashes is deprecated as of
|
||||
* 6.0 in favor of configuring explicit redirects through a proxy,
|
||||
* Servlet/web filter, or a controller.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setMatchOptionalTrailingSeparator(boolean matchOptionalTrailingSeparator) {
|
||||
this.matchOptionalTrailingSeparator = matchOptionalTrailingSeparator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether optional trailing slashing match is enabled.
|
||||
* @deprecated as of 6.0 together with {@link #setMatchOptionalTrailingSeparator(boolean)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isMatchOptionalTrailingSeparator() {
|
||||
return this.matchOptionalTrailingSeparator;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,7 +48,6 @@ public class PathPatternRouteMatcher implements RouteMatcher {
|
||||
public PathPatternRouteMatcher() {
|
||||
this.parser = new PathPatternParser();
|
||||
this.parser.setPathOptions(PathContainer.Options.MESSAGE_ROUTE);
|
||||
this.parser.setMatchOptionalTrailingSeparator(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user