Top Description Fields Methods
org.springframework.web.accept

public Interface ContentNegotiationStrategy

Known Direct Implementers
org.springframework.web.accept.FixedContentNegotiationStrategy, org.springframework.web.accept.HeaderContentNegotiationStrategy, org.springframework.web.accept.AbstractMappingContentNegotiationStrategy, org.springframework.web.accept.ContentNegotiationManager
Annotations
@FunctionalInterface
Imports
java.util.Collections, .List, org.springframework.http.MediaType, org.springframework.web.HttpMediaTypeNotAcceptableException, org.springframework.web.context.request.NativeWebRequest

A strategy for resolving the requested media types for a request.
Author
Rossen Stoyanchev
Since
3.2

Field Summary

Modifier and TypeField and Description
public static final List<MediaType>
MEDIA_TYPE_ALL_LIST

A singleton list with MediaType#ALL that is returned from resolveMediaTypes when no specific media types are requested.

Method Summary

Modifier and TypeMethod and Description
public List<MediaType>

Returns:

the requested media types, or MEDIA_TYPE_ALL_LIST if none were requested.
resolveMediaTypes
(NativeWebRequest
the current request
webRequest
)

Resolve the given request to a list of media types.

Field Detail

MEDIA_TYPE_ALL_LISTback to summary
public static final List<MediaType> MEDIA_TYPE_ALL_LIST

A singleton list with MediaType#ALL that is returned from resolveMediaTypes when no specific media types are requested.

Since
5.0.5

Method Detail

resolveMediaTypesback to summary
public List<MediaType> resolveMediaTypes(NativeWebRequest webRequest) throws HttpMediaTypeNotAcceptableException

Resolve the given request to a list of media types. The returned list is ordered by specificity first and by quality parameter second.

Parameters
webRequest:NativeWebRequest

the current request

Returns:List<MediaType>

the requested media types, or MEDIA_TYPE_ALL_LIST if none were requested.

Exceptions
HttpMediaTypeNotAcceptableException:
if the requested media types cannot be parsed