public class FixedContentNegotiationStrategy extends java.lang.Object implements ContentNegotiationStrategy
ContentNegotiationStrategy
that returns a fixed content type.MEDIA_TYPE_ALL_LIST
Constructor and Description |
---|
FixedContentNegotiationStrategy(java.util.List<MediaType> contentTypes)
Constructor with an ordered List of default
MediaType 's to return
for use in applications that support a variety of content types. |
FixedContentNegotiationStrategy(MediaType contentType)
Constructor with a single default
MediaType . |
Modifier and Type | Method and Description |
---|---|
java.util.List<MediaType> |
getContentTypes()
Return the configured list of media types.
|
java.util.List<MediaType> |
resolveMediaTypes(NativeWebRequest request)
Resolve the given request to a list of media types.
|
public FixedContentNegotiationStrategy(MediaType contentType)
MediaType
.public FixedContentNegotiationStrategy(java.util.List<MediaType> contentTypes)
MediaType
's to return
for use in applications that support a variety of content types.
Consider appending MediaType.ALL
at the end if destinations
are present which do not support any of the other default media types.
public java.util.List<MediaType> getContentTypes()
public java.util.List<MediaType> resolveMediaTypes(NativeWebRequest request)
ContentNegotiationStrategy
resolveMediaTypes
in interface ContentNegotiationStrategy
request
- the current requestContentNegotiationStrategy.MEDIA_TYPE_ALL_LIST
if none
were requested.