Skip to content

Commit 8d31dca

Browse files
committed
Clarification on path extension deprecations
Closes gh-24642
1 parent 4b85b44 commit 8d31dca

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

spring-web/src/main/java/org/springframework/web/accept/ContentNegotiationManagerFactoryBean.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,14 @@
8585
* methods and set the exact strategies to use via
8686
* {@link #setStrategies(List)}.
8787
*
88-
* <p><strong>Note:</strong> As of 5.2.4,
88+
* <p><strong>Deprecation Note:</strong> As of 5.2.4,
8989
* {@link #setFavorPathExtension(boolean) favorPathExtension} and
9090
* {@link #setIgnoreUnknownPathExtensions(boolean) ignoreUnknownPathExtensions}
91-
* are deprecated in order to discourage use of path extensions for content
92-
* negotiation as well as for request mapping (with similar deprecations in
91+
* are deprecated in order to discourage using path extensions for content
92+
* negotiation and for request mapping with similar deprecations on
9393
* {@link org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
94-
* RequestMappingHandlerMapping}). For further context, please read issue
94+
* RequestMappingHandlerMapping}. For further context, please read issue
9595
* <a href="https://github.com/spring-projects/spring-framework/issues/24179">#24719</a>.
96-
*
9796
* @author Rossen Stoyanchev
9897
* @author Brian Clozel
9998
* @since 3.2
@@ -149,7 +148,10 @@ public void setStrategies(@Nullable List<ContentNegotiationStrategy> strategies)
149148
* for {@code /hotels.pdf} will be interpreted as a request for
150149
* {@code "application/pdf"} regardless of the 'Accept' header.
151150
* @deprecated as of 5.2.4. See class-level note on the deprecation of path
152-
* extension config options.
151+
* extension config options. As there is no replacement for this method,
152+
* for the time being it's necessary to continue using it in order to set it
153+
* to {@code false}. In 5.3 when {@code false} becomes the default, use of
154+
* this property will no longer be necessary.
153155
*/
154156
@Deprecated
155157
public void setFavorPathExtension(boolean favorPathExtension) {

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ContentNegotiationConfigurer.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ public void strategies(@Nullable List<ContentNegotiationStrategy> strategies) {
131131
* {@code "application/pdf"} regardless of the 'Accept' header.
132132
* @deprecated as of 5.2.4. See class-level note in
133133
* {@link ContentNegotiationManagerFactoryBean} on the deprecation of path
134-
* extension config options.
134+
* extension config options. As there is no replacement for this method,
135+
* for the time being it's necessary to continue using it in order to set it
136+
* to {@code false}. In 5.3 when {@code false} becomes the default, use of
137+
* this property will no longer be necessary.
135138
*/
136139
@Deprecated
137140
public ContentNegotiationConfigurer favorPathExtension(boolean favorPathExtension) {

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ public class PathMatchConfigurer {
6969
* @see #registeredSuffixPatternMatch
7070
* @deprecated as of 5.2.4. See class-level note in
7171
* {@link RequestMappingHandlerMapping} on the deprecation of path extension
72-
* config options.
72+
* config options. As there is no replacement for this method, for the time
73+
* being it's necessary to set it to {@code false}. In 5.3 when {@code false}
74+
* becomes the default, use of this property will no longer be necessary.
7375
*/
7476
@Deprecated
7577
public PathMatchConfigurer setUseSuffixPatternMatch(Boolean suffixPatternMatch) {

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,14 @@
5858
* {@link RequestMapping @RequestMapping} annotations in
5959
* {@link Controller @Controller} classes.
6060
*
61-
* <p><strong>Note:</strong></p> In 5.2.4,
61+
* <p><strong>Deprecation Note:</strong></p> In 5.2.4,
6262
* {@link #setUseSuffixPatternMatch(boolean) useSuffixPatternMatch} and
6363
* {@link #setUseRegisteredSuffixPatternMatch(boolean) useRegisteredSuffixPatternMatch}
6464
* are deprecated in order to discourage use of path extensions for request
6565
* mapping and for content negotiation (with similar deprecations in
6666
* {@link ContentNegotiationManager}). For further context, please read issue
6767
* <a href="https://github.com/spring-projects/spring-framework/issues/24179">#24719</a>.
6868
*
69-
* <p>In 5.3, {@link #setUseRegisteredSuffixPatternMatch(boolean) useRegisteredSuffixPatternMatch}
70-
* switches to being on by default so that path matching becomes constrained
71-
* to registered suffixes only.
72-
*
7369
* @author Arjen Poutsma
7470
* @author Rossen Stoyanchev
7571
* @author Sam Brannen
@@ -101,7 +97,10 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
10197
* <p>Also see {@link #setUseRegisteredSuffixPatternMatch(boolean)} for
10298
* more fine-grained control over specific suffixes to allow.
10399
* @deprecated as of 5.2.4. See class level comment about deprecation of
104-
* path extension config options.
100+
* path extension config options. As there is no replacement for this method,
101+
* for the time being it's necessary to set it to {@code false}. In 5.3
102+
* when {@code false} becomes the default, use of this property will no
103+
* longer be necessary.
105104
*/
106105
@Deprecated
107106
public void setUseSuffixPatternMatch(boolean useSuffixPatternMatch) {
@@ -115,8 +114,7 @@ public void setUseSuffixPatternMatch(boolean useSuffixPatternMatch) {
115114
* when a "." appears in the path for other reasons.
116115
* <p>By default this is set to "false".
117116
* @deprecated as of 5.2.4. See class level comment about deprecation of
118-
* path extension config options note also that in 5.3 the default for this
119-
* property will switch from {@code false} to {@code true}.
117+
* path extension config options.
120118
*/
121119
@Deprecated
122120
public void setUseRegisteredSuffixPatternMatch(boolean useRegisteredSuffixPatternMatch) {

0 commit comments

Comments
 (0)