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 (e.g. "json", "pdf") must be extracted from the request (e.g. 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 (e.g. 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