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,org.springframework.http.MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getMediaTypeKey(org.springframework.web.context.request.NativeWebRequest webRequest)
Sub-classes must extract the key to use to look up a media type.
|
protected void |
handleMatch(String mediaTypeKey,
org.springframework.http.MediaType mediaType)
Invoked when a matching media type is found in the lookup map.
|
protected org.springframework.http.MediaType |
handleNoMatch(org.springframework.web.context.request.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,org.springframework.http.MediaType> mediaTypes)
IllegalArgumentException
- if a media type string cannot be parsedpublic void setParameterName(String parameterName)
The default parameter name is format
.
protected String getMediaTypeKey(org.springframework.web.context.request.NativeWebRequest webRequest)
AbstractMappingContentNegotiationStrategy
getMediaTypeKey
in class AbstractMappingContentNegotiationStrategy
null
if the key cannot be derivedprotected void handleMatch(String mediaTypeKey, org.springframework.http.MediaType mediaType)
AbstractMappingContentNegotiationStrategy
handleMatch
in class AbstractMappingContentNegotiationStrategy
protected org.springframework.http.MediaType handleNoMatch(org.springframework.web.context.request.NativeWebRequest request, String key) throws org.springframework.web.HttpMediaTypeNotAcceptableException
AbstractMappingContentNegotiationStrategy
handleNoMatch
in class AbstractMappingContentNegotiationStrategy
org.springframework.web.HttpMediaTypeNotAcceptableException
Copyright © 2006–2018 TinyGroup. All rights reserved.