public class ContentNegotiationManager extends Object implements ContentNegotiationStrategy, MediaTypeFileExtensionResolver
ContentNegotiationStrategy instances.
 Also provides methods to look up file extensions for a media type.
 This is done by delegating to the list of configured
 MediaTypeFileExtensionResolver instances.
MEDIA_TYPE_ALL_LIST| Constructor and Description | 
|---|
| ContentNegotiationManager()Create a default instance with a  HeaderContentNegotiationStrategy. | 
| ContentNegotiationManager(Collection<ContentNegotiationStrategy> strategies)A collection-based alternative to
  ContentNegotiationManager(ContentNegotiationStrategy...). | 
| ContentNegotiationManager(ContentNegotiationStrategy... strategies)Create an instance with the given list of
  ContentNegotiationStrategystrategies each of which may also be
 an instance ofMediaTypeFileExtensionResolver. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addFileExtensionResolvers(MediaTypeFileExtensionResolver... resolvers)Register more  MediaTypeFileExtensionResolverinstances in addition
 to those detected at construction. | 
| List<String> | getAllFileExtensions()Get all registered file extensions. | 
| Map<String,MediaType> | getMediaTypeMappings()Return all registered lookup key to media type mappings by iterating
  MediaTypeFileExtensionResolvers. | 
| List<ContentNegotiationStrategy> | getStrategies()Return the configured content negotiation strategies. | 
| <T extends ContentNegotiationStrategy> | getStrategy(Class<T> strategyType)Find a  ContentNegotiationStrategyof the given type. | 
| List<String> | resolveFileExtensions(MediaType mediaType)Resolve the given media type to a list of file extensions. | 
| List<MediaType> | resolveMediaTypes(NativeWebRequest request)Resolve the given request to a list of media types. | 
public ContentNegotiationManager(ContentNegotiationStrategy... strategies)
ContentNegotiationStrategy strategies each of which may also be
 an instance of MediaTypeFileExtensionResolver.strategies - the strategies to usepublic ContentNegotiationManager(Collection<ContentNegotiationStrategy> strategies)
ContentNegotiationManager(ContentNegotiationStrategy...).strategies - the strategies to usepublic ContentNegotiationManager()
HeaderContentNegotiationStrategy.public List<ContentNegotiationStrategy> getStrategies()
@Nullable public <T extends ContentNegotiationStrategy> T getStrategy(Class<T> strategyType)
ContentNegotiationStrategy of the given type.strategyType - the strategy typenull if nonepublic void addFileExtensionResolvers(MediaTypeFileExtensionResolver... resolvers)
MediaTypeFileExtensionResolver instances in addition
 to those detected at construction.resolvers - the resolvers to addpublic List<MediaType> resolveMediaTypes(NativeWebRequest request) throws HttpMediaTypeNotAcceptableException
ContentNegotiationStrategyresolveMediaTypes in interface ContentNegotiationStrategyrequest - the current requestContentNegotiationStrategy.MEDIA_TYPE_ALL_LIST if none
 were requested.HttpMediaTypeNotAcceptableException - if the requested media
 types cannot be parsedpublic List<String> resolveFileExtensions(MediaType mediaType)
MediaTypeFileExtensionResolverresolveFileExtensions in interface MediaTypeFileExtensionResolvermediaType - the media type to resolvenull)public List<String> getAllFileExtensions()
At startup this method returns extensions explicitly registered with
 either PathExtensionContentNegotiationStrategy or
 ParameterContentNegotiationStrategy. At runtime if there is a
 "path extension" strategy and its
 useRegisteredExtensionsOnly property is set to "false", the list of extensions may
 increase as file extensions are resolved via
 MediaTypeFactory and cached.
getAllFileExtensions in interface MediaTypeFileExtensionResolvernull)public Map<String,MediaType> getMediaTypeMappings()
MediaTypeFileExtensionResolvers.