类 RequestedContentTypeResolverBuilder
- java.lang.Object
- org.springframework.web.reactive.accept.RequestedContentTypeResolverBuilder
public class RequestedContentTypeResolverBuilder extends Object
Builder for a compositeRequestedContentTypeResolver
that delegates to other resolvers each implementing a different strategy to determine the requested content type -- e.g. Accept header, query parameter, or other.Use builder methods to add resolvers in the desired order. For a given request he first resolver to return a list that is not empty and does not consist of just
MediaType.ALL
, will be used.By default, if no resolvers are explicitly configured, the builder will add
HeaderContentTypeResolver
.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
RequestedContentTypeResolverBuilder.ParameterResolverConfigurer
Helper to create and configureParameterContentTypeResolver
.
构造器概要
构造器 构造器 说明 RequestedContentTypeResolverBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 RequestedContentTypeResolver
build()
Build aRequestedContentTypeResolver
that delegates to the list of resolvers configured through this builder.void
fixedResolver(MediaType... mediaTypes)
Add resolver that returns a fixed set of media types.void
headerResolver()
Add resolver to get the requested content type from the "Accept" header.RequestedContentTypeResolverBuilder.ParameterResolverConfigurer
parameterResolver()
Add a resolver to get the requested content type from a query parameter.void
resolver(RequestedContentTypeResolver resolver)
Add a custom resolver.
构造器详细资料
RequestedContentTypeResolverBuilder
public RequestedContentTypeResolverBuilder()
方法详细资料
parameterResolver
public RequestedContentTypeResolverBuilder.ParameterResolverConfigurer parameterResolver()
Add a resolver to get the requested content type from a query parameter. By default the query parameter name is"format"
.
headerResolver
public void headerResolver()
Add resolver to get the requested content type from the "Accept" header.
fixedResolver
public void fixedResolver(MediaType... mediaTypes)
Add resolver that returns a fixed set of media types.- 参数:
mediaTypes
- the media types to use
resolver
public void resolver(RequestedContentTypeResolver resolver)
Add a custom resolver.- 参数:
resolver
- the resolver to add
build
public RequestedContentTypeResolver build()
Build aRequestedContentTypeResolver
that delegates to the list of resolvers configured through this builder.