Class AbstractMappingContentNegotiationStrategy

java.lang.Object
org.springframework.web.accept.MappingMediaTypeFileExtensionResolver
org.springframework.web.accept.AbstractMappingContentNegotiationStrategy
All Implemented Interfaces:
ContentNegotiationStrategy, MediaTypeFileExtensionResolver
Direct Known Subclasses:
ParameterContentNegotiationStrategy, PathExtensionContentNegotiationStrategy

public abstract class AbstractMappingContentNegotiationStrategy extends MappingMediaTypeFileExtensionResolver implements ContentNegotiationStrategy
Base class for ContentNegotiationStrategy implementations with the steps to resolve a request to media types.

First a key (for example, "json", "pdf") must be extracted from the request (for example, file extension, query param). The key must then be resolved to media type(s) through the base class MappingMediaTypeFileExtensionResolver which stores such mappings.

The method handleNoMatch(org.springframework.web.context.request.NativeWebRequest, java.lang.String) allow subclasses to plug in additional ways of looking up media types (for example, through the Java Activation framework, or ServletContext.getMimeType(java.lang.String)). Media types resolved via base classes are then added to the base class MappingMediaTypeFileExtensionResolver, i.e. cached for new lookups.

Since:
3.2
Author:
Rossen Stoyanchev