Deprecate UrlPathHelper shortcuts on AbstractHandlerMapping

Given the availability of two alternatives mechanisms for URL path
matching, PathPatternParser and AntPathMatcher, and now that
parsed patterns are enabled by default, it makes sense to reduce the
proliferation of options on AbstractHandlerMapping by deprecating
shortcuts related to String path matching. Most applications rely
on Boot and on the MVC config to do all this.

See gh-28607
This commit is contained in:
rstoyanchev
2022-06-29 13:03:10 +01:00
parent 8d08b1d323
commit 14fd2605a3
11 changed files with 44 additions and 34 deletions

View File

@@ -179,8 +179,9 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
* <p><strong>Note:</strong> This property is mutually exclusive with and
* ignored when {@link #setPatternParser(PathPatternParser)} is set.
* @see org.springframework.web.util.UrlPathHelper#setAlwaysUseFullPath(boolean)
* @deprecated as of 6.0, in favor of using {@link #setUrlPathHelper(UrlPathHelper)}
*/
@SuppressWarnings("deprecation")
@Deprecated
public void setAlwaysUseFullPath(boolean alwaysUseFullPath) {
this.urlPathHelper.setAlwaysUseFullPath(alwaysUseFullPath);
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource urlConfigSource) {
@@ -193,8 +194,9 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
* <p><strong>Note:</strong> This property is mutually exclusive with and
* ignored when {@link #setPatternParser(PathPatternParser)} is set.
* @see org.springframework.web.util.UrlPathHelper#setUrlDecode(boolean)
* @deprecated as of 6.0, in favor of using {@link #setUrlPathHelper(UrlPathHelper)}
*/
@SuppressWarnings("deprecation")
@Deprecated
public void setUrlDecode(boolean urlDecode) {
this.urlPathHelper.setUrlDecode(urlDecode);
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource urlConfigSource) {
@@ -207,8 +209,9 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
* <p><strong>Note:</strong> This property is mutually exclusive with and
* ignored when {@link #setPatternParser(PathPatternParser)} is set.
* @see org.springframework.web.util.UrlPathHelper#setRemoveSemicolonContent(boolean)
* @deprecated as of 6.0, in favor of using {@link #setUrlPathHelper(UrlPathHelper)}
*/
@SuppressWarnings("deprecation")
@Deprecated
public void setRemoveSemicolonContent(boolean removeSemicolonContent) {
this.urlPathHelper.setRemoveSemicolonContent(removeSemicolonContent);
if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource urlConfigSource) {

View File

@@ -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.
@@ -37,11 +37,9 @@ import org.springframework.util.StringUtils;
* a single handler.
*
* <p>Supports direct matches (given "/test" -&gt; registered "/test") and "*"
* matches (given "/test" -&gt; registered "/t*"). Note that the default is
* to map within the current servlet mapping if applicable; see the
* {@link #setAlwaysUseFullPath "alwaysUseFullPath"} property for details.
* For details on the pattern options, see the
* {@link org.springframework.util.AntPathMatcher} javadoc.
* matches (given "/test" -&gt; registered "/t*"). For details on the pattern
* options, see the {@link org.springframework.web.util.pattern.PathPattern}
* javadoc.
*
* @author Rod Johnson
* @author Juergen Hoeller

View File

@@ -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.
@@ -44,10 +44,9 @@ import org.springframework.util.CollectionUtils;
* with a slash, one is prepended.
*
* <p>Supports direct matches (given "/test" -&gt; registered "/test") and "*"
* pattern matches (given "/test" -&gt; registered "/t*"). Note that the default
* is to map within the current servlet mapping if applicable; see the
* {@link #setAlwaysUseFullPath "alwaysUseFullPath"} property. For details on the
* pattern options, see the {@link org.springframework.util.AntPathMatcher} javadoc.
* matches (given "/test" -&gt; registered "/t*"). For details on the pattern
* options, see the {@link org.springframework.web.util.pattern.PathPattern}
* javadoc.
* @author Rod Johnson
* @author Juergen Hoeller