public abstract class AbstractMappingContentNegotiationStrategy extends MappingMediaTypeFileExtensionResolver implements ContentNegotiationStrategy, MediaTypeFileExtensionResolver
Constructor and Description |
---|
AbstractMappingContentNegotiationStrategy(java.util.Map<java.lang.String,MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.String |
getMediaTypeKey(NativeWebRequest request)
Sub-classes must extract the key to use to look up a media type.
|
protected void |
handleMatch(java.lang.String mappingKey,
MediaType mediaType)
Invoked when a matching media type is found in the lookup map.
|
protected MediaType |
handleNoMatch(NativeWebRequest request,
java.lang.String mappingKey)
Invoked when no matching media type is found in the lookup map.
|
java.util.List<MediaType> |
resolveMediaTypes(NativeWebRequest webRequest)
Resolve the given request to a list of media types.
|
addMapping, getAllFileExtensions, lookupMediaType, resolveFileExtensions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllFileExtensions, resolveFileExtensions
public AbstractMappingContentNegotiationStrategy(java.util.Map<java.lang.String,MediaType> mediaTypes)
java.lang.IllegalArgumentException
- if a media type string cannot be parsedpublic java.util.List<MediaType> resolveMediaTypes(NativeWebRequest webRequest)
ContentNegotiationStrategy
resolveMediaTypes
in interface ContentNegotiationStrategy
null
protected abstract java.lang.String getMediaTypeKey(NativeWebRequest request)
null
if the key cannot be derivedprotected void handleMatch(java.lang.String mappingKey, MediaType mediaType)
protected MediaType handleNoMatch(NativeWebRequest request, java.lang.String mappingKey)