接口 ContentNegotiationStrategy
- 所有已知实现类:
AbstractMappingContentNegotiationStrategy
,ContentNegotiationManager
,FixedContentNegotiationStrategy
,HeaderContentNegotiationStrategy
,ParameterContentNegotiationStrategy
,PathExtensionContentNegotiationStrategy
,ServletPathExtensionContentNegotiationStrategy
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface public interface ContentNegotiationStrategy
A strategy for resolving the requested media types for a request.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev
字段概要
字段 修饰符和类型 字段 说明 static List<MediaType>
MEDIA_TYPE_ALL_LIST
A singleton list withMediaType.ALL
that is returned fromresolveMediaTypes(org.springframework.web.context.request.NativeWebRequest)
when no specific media types are requested.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 List<MediaType>
resolveMediaTypes(NativeWebRequest webRequest)
Resolve the given request to a list of media types.
字段详细资料
MEDIA_TYPE_ALL_LIST
static final List<MediaType> MEDIA_TYPE_ALL_LIST
A singleton list withMediaType.ALL
that is returned fromresolveMediaTypes(org.springframework.web.context.request.NativeWebRequest)
when no specific media types are requested.- 从以下版本开始:
- 5.0.5
方法详细资料
resolveMediaTypes
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.- 参数:
webRequest
- the current request- 返回:
- the requested media types, or
MEDIA_TYPE_ALL_LIST
if none were requested. - 抛出:
HttpMediaTypeNotAcceptableException
- if the requested media types cannot be parsed