Set all strategies in CNM factory bean

ContentNegotiationManagerFactoryBean now provides an option to
explicitly set the strategies to use vs customizing a fixed
list of default strategies.

Issue: SPR-11114
This commit is contained in:
Rossen Stoyanchev
2017-07-11 21:00:57 +02:00
parent befacf4a35
commit 134ceac58e
4 changed files with 119 additions and 59 deletions

View File

@@ -5198,10 +5198,14 @@ And in XML use the `<mvc:interceptors>` element:
[[mvc-config-content-negotiation]]
=== Content Negotiation
You can configure how Spring MVC determines the requested media types from the request.
The available options are to check the URL path for a file extension, check the
"Accept" header, a specific query parameter, or to fall back on a default content
type when nothing is requested. By default the path extension in the request URI
is checked first and the "Accept" header is checked second.
The available options are to check a query parameter, the URL path for a file extension,
the "Accept" header, use a fixed list, or a custom strategy.
By default for backwards compatibility the path extension in the request URI is checked
first and the "Accept" header is checked second. However if you must use URL-based content
type resolution, we highly recommend using the query parameter strategy over the path
extension since the latter can cause issues with URI variables, path parameters, and also
in combination with URI decoding.
The MVC Java config and the MVC namespace register `json`, `xml`, `rss`, `atom` by
default if corresponding dependencies are on the classpath. Additional