public class ContentNegotiationManager extends java.lang.Object implements ContentNegotiationStrategy, MediaTypeFileExtensionResolver
HeaderContentNegotiationStrategywill be configured by default.
This class may also be used to look up file extensions associated with a
MediaType. This is done by consulting the list of configured
MediaTypeFileExtensionResolver instances. Note that some
ContentNegotiationStrategy implementations also implement
MediaTypeFileExtensionResolver and the class constructor accepting the former
will also detect if they implement the latter. If you need to register additional
resolvers, you can use the method
|Constructor and Description|
Create an instance with a
Create an instance with the given ContentNegotiationStrategy instances.
|Modifier and Type||Method and Description|
Add MediaTypeFileExtensionResolver instances.
Delegate to all configured MediaTypeFileExtensionResolver instances and aggregate the list of all known file extensions.
Delegate to all configured MediaTypeFileExtensionResolver instances and aggregate the list of all file extensions found.
Delegate to all configured ContentNegotiationStrategy instances until one returns a non-empty list.
public ContentNegotiationManager(ContentNegotiationStrategy... strategies)
Each instance is checked to see if it is also an implementation of MediaTypeFileExtensionResolver, and if so it is registered as such.
strategies- one more more ContentNegotiationStrategy instances
public void addFileExtensionResolvers(MediaTypeFileExtensionResolver... resolvers)
Note that some
ContentNegotiationStrategy implementations also
MediaTypeFileExtensionResolver and the class constructor
accepting the former will also detect implementations of the latter. Therefore
you only need to use this method to register additional instances.
one- more resolvers
public java.util.List<MediaType> resolveMediaTypes(NativeWebRequest webRequest) throws HttpMediaTypeNotAcceptableException
public java.util.List<java.lang.String> resolveFileExtensions(MediaType mediaType)
public java.util.List<java.lang.String> getAllFileExtensions()