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