类 FixedContentNegotiationStrategy
- java.lang.Object
- org.springframework.web.accept.FixedContentNegotiationStrategy
- 所有已实现的接口:
ContentNegotiationStrategy
public class FixedContentNegotiationStrategy extends Object implements ContentNegotiationStrategy
AContentNegotiationStrategy
that returns a fixed content type.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev
字段概要
从接口继承的字段 org.springframework.web.accept.ContentNegotiationStrategy
MEDIA_TYPE_ALL_LIST
构造器概要
构造器 构造器 说明 FixedContentNegotiationStrategy(List<MediaType> contentTypes)
Constructor with an ordered List of defaultMediaType
's to return for use in applications that support a variety of content types.FixedContentNegotiationStrategy(MediaType contentType)
Constructor with a single defaultMediaType
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 List<MediaType>
getContentTypes()
Return the configured list of media types.List<MediaType>
resolveMediaTypes(NativeWebRequest request)
Resolve the given request to a list of media types.
构造器详细资料
FixedContentNegotiationStrategy
public FixedContentNegotiationStrategy(MediaType contentType)
Constructor with a single defaultMediaType
.
FixedContentNegotiationStrategy
public FixedContentNegotiationStrategy(List<MediaType> contentTypes)
Constructor with an ordered List of defaultMediaType
'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.- 从以下版本开始:
- 5.0
方法详细资料
getContentTypes
public List<MediaType> getContentTypes()
Return the configured list of media types.
resolveMediaTypes
public List<MediaType> resolveMediaTypes(NativeWebRequest request)
从接口复制的说明:ContentNegotiationStrategy
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
ContentNegotiationStrategy.MEDIA_TYPE_ALL_LIST
if none were requested.