Remove - from path-match and content-negotiation properties
Closes gh-11913
This commit is contained in:
parent
83f65a38b1
commit
9a456924e4
|
@ -218,21 +218,21 @@ public class WebMvcAutoConfiguration {
|
|||
@Override
|
||||
public void configurePathMatch(PathMatchConfigurer configurer) {
|
||||
configurer.setUseSuffixPatternMatch(
|
||||
this.mvcProperties.getPathMatch().isUseSuffixPattern());
|
||||
this.mvcProperties.getPathmatch().isUseSuffixPattern());
|
||||
configurer.setUseRegisteredSuffixPatternMatch(
|
||||
this.mvcProperties.getPathMatch().isUseRegisteredSuffixPattern());
|
||||
this.mvcProperties.getPathmatch().isUseRegisteredSuffixPattern());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||
WebMvcProperties.ContentNegotiation contentNegotiation = this.mvcProperties
|
||||
.getContentNegotiation();
|
||||
configurer.favorPathExtension(contentNegotiation.isFavorPathExtension());
|
||||
configurer.favorParameter(contentNegotiation.isFavorParameter());
|
||||
if (contentNegotiation.getParameterName() != null) {
|
||||
configurer.parameterName(contentNegotiation.getParameterName());
|
||||
WebMvcProperties.Contentnegotiation contentnegotiation = this.mvcProperties
|
||||
.getContentnegotiation();
|
||||
configurer.favorPathExtension(contentnegotiation.isFavorPathExtension());
|
||||
configurer.favorParameter(contentnegotiation.isFavorParameter());
|
||||
if (contentnegotiation.getParameterName() != null) {
|
||||
configurer.parameterName(contentnegotiation.getParameterName());
|
||||
}
|
||||
Map<String, MediaType> mediaTypes = this.mvcProperties.getContentNegotiation()
|
||||
Map<String, MediaType> mediaTypes = this.mvcProperties.getContentnegotiation()
|
||||
.getMediaTypes();
|
||||
for (Entry<String, MediaType> mediaType : mediaTypes.entrySet()) {
|
||||
configurer.mediaType(mediaType.getKey(), mediaType.getValue());
|
||||
|
|
|
@ -98,9 +98,9 @@ public class WebMvcProperties {
|
|||
|
||||
private final View view = new View();
|
||||
|
||||
private final ContentNegotiation contentNegotiation = new ContentNegotiation();
|
||||
private final Contentnegotiation contentnegotiation = new Contentnegotiation();
|
||||
|
||||
private final PathMatch pathMatch = new PathMatch();
|
||||
private final Pathmatch pathmatch = new Pathmatch();
|
||||
|
||||
public DefaultMessageCodesResolver.Format getMessageCodesResolverFormat() {
|
||||
return this.messageCodesResolverFormat;
|
||||
|
@ -196,12 +196,12 @@ public class WebMvcProperties {
|
|||
return this.view;
|
||||
}
|
||||
|
||||
public ContentNegotiation getContentNegotiation() {
|
||||
return this.contentNegotiation;
|
||||
public Contentnegotiation getContentnegotiation() {
|
||||
return this.contentnegotiation;
|
||||
}
|
||||
|
||||
public PathMatch getPathMatch() {
|
||||
return this.pathMatch;
|
||||
public Pathmatch getPathmatch() {
|
||||
return this.pathmatch;
|
||||
}
|
||||
|
||||
public static class Async {
|
||||
|
@ -270,7 +270,7 @@ public class WebMvcProperties {
|
|||
|
||||
}
|
||||
|
||||
public static class ContentNegotiation {
|
||||
public static class Contentnegotiation {
|
||||
|
||||
/**
|
||||
* Whether the path extension in the URL path should be used to determine the
|
||||
|
@ -330,7 +330,7 @@ public class WebMvcProperties {
|
|||
|
||||
}
|
||||
|
||||
public static class PathMatch {
|
||||
public static class Pathmatch {
|
||||
|
||||
/**
|
||||
* Whether to use suffix pattern match (".*") when matching patterns to requests.
|
||||
|
|
|
@ -414,7 +414,7 @@
|
|||
"type" : "java.util.Map<java.lang.String,org.springframework.http.MediaType>",
|
||||
"description" : "Maps file extensions to media types for content negotiation, e.g. yml to text/yaml.",
|
||||
"deprecation" : {
|
||||
"replacement" : "spring.mvc.content-negotiation.media-types",
|
||||
"replacement" : "spring.mvc.contentnegotiation.media-types",
|
||||
"level" : "error"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -473,8 +473,8 @@ public class WebMvcAutoConfigurationTests {
|
|||
public void customMediaTypes() {
|
||||
this.contextRunner
|
||||
.withPropertyValues(
|
||||
"spring.mvc.content-negotiation.media-types.yaml:text/yaml",
|
||||
"spring.mvc.content-negotiation.favor-path-extension:true")
|
||||
"spring.mvc.contentnegotiation.media-types.yaml:text/yaml",
|
||||
"spring.mvc.contentnegotiation.favor-path-extension:true")
|
||||
.run((context) -> {
|
||||
RequestMappingHandlerAdapter adapter = context
|
||||
.getBean(RequestMappingHandlerAdapter.class);
|
||||
|
@ -755,8 +755,8 @@ public class WebMvcAutoConfigurationTests {
|
|||
@Test
|
||||
public void useSuffixPatternMatch() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.mvc.path-match.use-suffix-pattern:true",
|
||||
"spring.mvc.path-match.use-registered-suffix-pattern:true")
|
||||
.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true",
|
||||
"spring.mvc.pathmatch.use-registered-suffix-pattern:true")
|
||||
.run((context) -> {
|
||||
RequestMappingHandlerMapping handlerMapping = context
|
||||
.getBean(RequestMappingHandlerMapping.class);
|
||||
|
@ -782,7 +782,7 @@ public class WebMvcAutoConfigurationTests {
|
|||
public void pathExtensionContentNegotiation() {
|
||||
this.contextRunner
|
||||
.withPropertyValues(
|
||||
"spring.mvc.content-negotiation.favor-path-extension:true")
|
||||
"spring.mvc.contentnegotiation.favor-path-extension:true")
|
||||
.run((context) -> {
|
||||
RequestMappingHandlerMapping handlerMapping = context
|
||||
.getBean(RequestMappingHandlerMapping.class);
|
||||
|
@ -797,7 +797,7 @@ public class WebMvcAutoConfigurationTests {
|
|||
@Test
|
||||
public void queryParameterContentNegotiation() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.mvc.content-negotiation.favor-parameter:true")
|
||||
.withPropertyValues("spring.mvc.contentnegotiation.favor-parameter:true")
|
||||
.run((context) -> {
|
||||
RequestMappingHandlerMapping handlerMapping = context
|
||||
.getBean(RequestMappingHandlerMapping.class);
|
||||
|
|
|
@ -396,10 +396,10 @@ content into your application. Rather, pick only the properties that you need.
|
|||
|
||||
# SPRING MVC ({sc-spring-boot-autoconfigure}/web/servlet/WebMvcProperties.{sc-ext}[WebMvcProperties])
|
||||
spring.mvc.async.request-timeout= # Amount of time before asynchronous request handling times out.
|
||||
spring.mvc.content-negotiation.favor-parameter=false # Whether a request parameter ("format" by default) should be used to determine the requested media type.
|
||||
spring.mvc.content-negotiation.favor-path-extension=false # Whether the path extension in the URL path should be used to determine the requested media type.
|
||||
spring.mvc.content-negotiation.media-types.*= # Maps file extensions to media types for content negotiation.
|
||||
spring.mvc.content-negotiation.parameter-name= # Query parameter name to use when "favor-parameter" is enabled.
|
||||
spring.mvc.contentnegotiation.favor-parameter=false # Whether a request parameter ("format" by default) should be used to determine the requested media type.
|
||||
spring.mvc.contentnegotiation.favor-path-extension=false # Whether the path extension in the URL path should be used to determine the requested media type.
|
||||
spring.mvc.contentnegotiation.media-types.*= # Maps file extensions to media types for content negotiation.
|
||||
spring.mvc.contentnegotiation.parameter-name= # Query parameter name to use when "favor-parameter" is enabled.
|
||||
spring.mvc.date-format= # Date format to use. For instance, `dd/MM/yyyy`.
|
||||
spring.mvc.dispatch-trace-request=false # Whether to dispatch TRACE requests to the FrameworkServlet doService method.
|
||||
spring.mvc.dispatch-options-request=true # Whether to dispatch OPTIONS requests to the FrameworkServlet doService method.
|
||||
|
@ -410,8 +410,8 @@ content into your application. Rather, pick only the properties that you need.
|
|||
spring.mvc.locale-resolver=accept-header # Define how the locale should be resolved.
|
||||
spring.mvc.log-resolved-exception=false # Whether to enable warn logging of exceptions resolved by a "HandlerExceptionResolver".
|
||||
spring.mvc.message-codes-resolver-format= # Formatting strategy for message codes. For instance, `PREFIX_ERROR_CODE`.
|
||||
spring.mvc.path-match.use-registered-suffix-pattern=false # Whether suffix pattern matching should work only against extensions registered with "spring.mvc.content-negotiation.media-types.*".
|
||||
spring.mvc.path-match.use-suffix-pattern=false # Whether to use suffix pattern match (".*") when matching patterns to requests.
|
||||
spring.mvc.pathmatch.use-registered-suffix-pattern=false # Whether suffix pattern matching should work only against extensions registered with "spring.mvc.contentnegotiation.media-types.*".
|
||||
spring.mvc.pathmatch.use-suffix-pattern=false # Whether to use suffix pattern match (".*") when matching patterns to requests.
|
||||
spring.mvc.servlet.load-on-startup=-1 # Load on startup priority of the Spring Web Services servlet.
|
||||
spring.mvc.static-path-pattern=/** # Path pattern used for static resources.
|
||||
spring.mvc.throw-exception-if-no-handler-found=false # Whether a "NoHandlerFoundException" should be thrown if no Handler was found to process a request.
|
||||
|
|
|
@ -2076,13 +2076,13 @@ will be mapped to `@GetMapping("/projects/spring-boot")`:
|
|||
|
||||
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
spring.mvc.content-negotiation.favor-parameter=true
|
||||
spring.mvc.contentnegotiation.favor-parameter=true
|
||||
|
||||
# We can change the parameter name, which is "format" by default:
|
||||
# spring.mvc.content-negotiation.parameter-name=myparam
|
||||
# spring.mvc.contentnegotiation.parameter-name=myparam
|
||||
|
||||
# We can also register additional file extensions/media types with:
|
||||
spring.mvc.content-negotiation.media-types.markdown=text/markdown
|
||||
spring.mvc.contentnegotiation.media-types.markdown=text/markdown
|
||||
----
|
||||
|
||||
If you understand the caveats and would still like your application to use
|
||||
|
@ -2090,13 +2090,13 @@ suffix pattern matching, the following configuration is required:
|
|||
|
||||
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
spring.mvc.content-negotiation.favor-path-extension=true
|
||||
spring.mvc.contentnegotiation.favor-path-extension=true
|
||||
|
||||
# You can also restrict that feature to known extensions only
|
||||
# spring.mvc.path-match.use-registered-suffix-pattern=true
|
||||
# spring.mvc.pathmatch.use-registered-suffix-pattern=true
|
||||
|
||||
# We can also register additional file extensions/media types with:
|
||||
# spring.mvc.content-negotiation.media-types.adoc=text/asciidoc
|
||||
# spring.mvc.contentnegotiation.media-types.adoc=text/asciidoc
|
||||
----
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue