public class ParameterContentNegotiationStrategy extends AbstractMappingContentNegotiationStrategy
format
.
Its value is used to look up the media type in the map given to the constructor.Constructor and Description |
---|
ParameterContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getMediaTypeKey(NativeWebRequest webRequest)
Sub-classes must extract the key to use to look up a media type.
|
protected void |
handleMatch(String mediaTypeKey,
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.
|
void |
setParameterName(String parameterName)
Set the parameter name that can be used to determine the requested media type.
|
resolveMediaTypes
addMapping, getAllFileExtensions, getAllMediaTypes, lookupMediaType, resolveFileExtensions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllFileExtensions, resolveFileExtensions
public ParameterContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
IllegalArgumentException
- if a media type string cannot be parsedpublic void setParameterName(String parameterName)
The default parameter name is format
.
protected String getMediaTypeKey(NativeWebRequest webRequest)
AbstractMappingContentNegotiationStrategy
getMediaTypeKey
in class AbstractMappingContentNegotiationStrategy
null
if the key cannot be derivedprotected void handleMatch(String mediaTypeKey, MediaType mediaType)
AbstractMappingContentNegotiationStrategy
handleMatch
in class AbstractMappingContentNegotiationStrategy
protected MediaType handleNoMatch(NativeWebRequest request, String key) throws HttpMediaTypeNotAcceptableException
AbstractMappingContentNegotiationStrategy
handleNoMatch
in class AbstractMappingContentNegotiationStrategy
HttpMediaTypeNotAcceptableException