public class ParameterContentNegotiationStrategy extends AbstractMappingContentNegotiationStrategy
ContentNegotiationStrategy that resolves a query parameter to a key
 to be used to look up a media type. The default parameter name is format.| Constructor and Description | 
|---|
ParameterContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
Create an instance with the given map of file extensions and media types. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected String | 
getMediaTypeKey(NativeWebRequest request)
Extract a key from the request to use to look up media types. 
 | 
String | 
getParameterName()  | 
protected void | 
handleMatch(String mediaTypeKey,
           MediaType mediaType)
Override to provide handling when a key is successfully resolved via
  
MappingMediaTypeFileExtensionResolver.lookupMediaType(java.lang.String). | 
protected MediaType | 
handleNoMatch(NativeWebRequest request,
             String key)
Override to provide handling when a key is not resolved via. 
 | 
void | 
setParameterName(String parameterName)
Set the name of the parameter to use to determine requested media types. 
 | 
resolveMediaTypeKey, resolveMediaTypesaddMapping, getAllFileExtensions, getAllMediaTypes, getMediaTypes, lookupMediaType, resolveFileExtensionspublic void setParameterName(String parameterName)
By default this is set to "format".
public String getParameterName()
protected String getMediaTypeKey(NativeWebRequest request)
AbstractMappingContentNegotiationStrategygetMediaTypeKey in class AbstractMappingContentNegotiationStrategynull if noneprotected void handleMatch(String mediaTypeKey, MediaType mediaType)
AbstractMappingContentNegotiationStrategyMappingMediaTypeFileExtensionResolver.lookupMediaType(java.lang.String).handleMatch in class AbstractMappingContentNegotiationStrategyprotected MediaType handleNoMatch(NativeWebRequest request, String key) throws HttpMediaTypeNotAcceptableException
AbstractMappingContentNegotiationStrategyMappingMediaTypeFileExtensionResolver.lookupMediaType(java.lang.String). Sub-classes can take further steps to
 determine the media type(s). If a MediaType is returned from
 this method it will be added to the cache in the base class.handleNoMatch in class AbstractMappingContentNegotiationStrategyHttpMediaTypeNotAcceptableException