spring-framework / org.springframework.web.accept / ContentNegotiationManagerFactoryBean / <init>

<init>

ContentNegotiationManagerFactoryBean()

Factory to create a ContentNegotiationManager and configure it with one or more ContentNegotiationStrategy instances.

As of 5.0 you can set the exact strategies to use via #setStrategies(List).

As an alternative you can also rely on the set of defaults described below which can be turned on or off or customized through the methods of this builder:

Property Setter Underlying Strategy Default Setting #setFavorPathExtension PathExtensionContentNegotiationStrategy On favorParameter ParameterContentNegotiationStrategy Off ignoreAcceptHeader HeaderContentNegotiationStrategy On defaultContentType FixedContentNegotiationStrategy Not set defaultContentTypeStrategy ContentNegotiationStrategy Not set Note: if you must use URL-based content type resolution, the use of a query parameter is simpler and preferable to the use of a path extension since the latter can cause issues with URI variables, path parameters, and URI decoding. Consider setting #setFavorPathExtension to false or otherwise set the strategies to use explicitly via #setStrategies(List).

Author
Rossen Stoyanchev

Author
Brian Clozel

Since
3.2