@ -543,7 +543,7 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@@ -543,7 +543,7 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
privatebooleantrailingSlashMatch=true;
privatebooleansuffixPatternMatch=true;
privatebooleansuffixPatternMatch=false;
privatebooleanregisteredSuffixPatternMatch=false;
@ -600,11 +600,10 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@@ -600,11 +600,10 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@ -613,9 +612,8 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@@ -613,9 +612,8 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@ -630,8 +628,7 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@@ -630,8 +628,7 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@ -93,14 +93,13 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
@@ -93,14 +93,13 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
@ -113,7 +112,7 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
@@ -113,7 +112,7 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
@ -191,8 +190,8 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
@@ -191,8 +190,8 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
@ -201,8 +200,8 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
@@ -201,8 +200,8 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
@ -469,22 +469,26 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@@ -469,22 +469,26 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@ -727,8 +731,11 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@@ -727,8 +731,11 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@ -753,8 +760,11 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@@ -753,8 +760,11 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@ -1674,8 +1684,13 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@@ -1674,8 +1684,13 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@ -1720,8 +1735,13 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@@ -1720,8 +1735,13 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@ -87,15 +85,11 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@@ -87,15 +85,11 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@ -143,22 +137,21 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@@ -143,22 +137,21 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@ -264,11 +257,6 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@@ -264,11 +257,6 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@ -282,10 +270,7 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@@ -282,10 +270,7 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@ -295,10 +280,7 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@@ -295,10 +280,7 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@ -313,12 +295,13 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@@ -313,12 +295,13 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@ -326,10 +309,7 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@@ -326,10 +309,7 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@ -1683,11 +1683,11 @@ See <<mvc-config-path-matching>> in the configuration section.
@@ -1683,11 +1683,11 @@ See <<mvc-config-path-matching>> in the configuration section.
[[mvc-ann-requestmapping-suffix-pattern-match]]
==== Suffix Match
By default, Spring MVC performs `.{asterisk}` suffix pattern matching so that a
controller mapped to `/person` is also implicitly mapped to `/person.{asterisk}`.
The file extension is then used to interpret the requested content type to use for
the response (that is, instead of the `Accept` header) -- for example, `/person.pdf`,
`/person.xml`, and others.
Starting in 5.3, by default Spring MVC no longer performs `.{asterisk}` suffix pattern
matching where a controller mapped to `/person` is also implicitly mapped to
`/person.{asterisk}`. As a consequence path extensions are no longer used to interpret
the requested content type for the response -- for example, `/person.pdf`, `/person.xml`,
and so on.
Using file extensions in this way was necessary when browsers used to send `Accept` headers
that were hard to interpret consistently. At present, that is no longer a necessity and
@ -1698,28 +1698,16 @@ It can cause ambiguity when overlain with the use of URI variables, path paramet
@@ -1698,28 +1698,16 @@ It can cause ambiguity when overlain with the use of URI variables, path paramet
URI encoding. Reasoning about URL-based authorization
and security (see next section for more details) also become more difficult.
To completely disable the use of file extensions, you must set both of the following:
To completely disable the use of path extensions in versions prior to 5.3, set the following:
* `useSuffixPatternMatching(false)`, see <<mvc-config-path-matching, PathMatchConfigurer>>
* `favorPathExtension(false)`, see <<mvc-config-content-negotiation, ContentNegotiationConfigurer>>
URL-based content negotiation can still be useful (for example, when typing a URL in a
browser). To enable that, we recommend a query parameter-based strategy to avoid most of
the issues that come with file extensions. Alternatively, if you must use file extensions, consider
restricting them to a list of explicitly registered extensions through the
`mediaTypes` property of <<mvc-config-content-negotiation,ContentNegotiationConfigurer>>.
[NOTE]
====
Starting in 5.2.4, path extension related options for request mapping in
@ -5851,7 +5839,6 @@ The following example shows how to customize path matching in Java configuration
@@ -5851,7 +5839,6 @@ The following example shows how to customize path matching in Java configuration
public void configurePathMatch(PathMatchConfigurer configurer) {
@ -5879,7 +5866,6 @@ The following example shows how to customize path matching in Java configuration
@@ -5879,7 +5866,6 @@ The following example shows how to customize path matching in Java configuration
@ -5904,7 +5890,6 @@ The following example shows how to achieve the same configuration in XML:
@@ -5904,7 +5890,6 @@ The following example shows how to achieve the same configuration in XML: