类 HeaderContentNegotiationStrategy
- java.lang.Object
- org.springframework.web.accept.HeaderContentNegotiationStrategy
- 所有已实现的接口:
ContentNegotiationStrategy
public class HeaderContentNegotiationStrategy extends Object implements ContentNegotiationStrategy
AContentNegotiationStrategy
that checks the 'Accept' request header.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev, Juergen Hoeller
构造器概要
构造器 构造器 说明 HeaderContentNegotiationStrategy()
构造器详细资料
HeaderContentNegotiationStrategy
public HeaderContentNegotiationStrategy()
方法详细资料
resolveMediaTypes
public List<MediaType> resolveMediaTypes(NativeWebRequest request) 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.- 指定者:
resolveMediaTypes
在接口中ContentNegotiationStrategy
- 参数:
request
- the current request- 返回:
- the requested media types or an empty list (never
null
) - 抛出:
HttpMediaTypeNotAcceptableException
- if the 'Accept' header cannot be parsed