public class RequestedContentTypeResolverBuilder extends Object
RequestedContentTypeResolver
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
.
Modifier and Type | Class and Description |
---|---|
static class |
RequestedContentTypeResolverBuilder.ParameterResolverConfigurer
Helper to create and configure
ParameterContentTypeResolver . |
Constructor and Description |
---|
RequestedContentTypeResolverBuilder() |
Modifier and Type | Method and Description |
---|---|
RequestedContentTypeResolver |
build()
Build a
RequestedContentTypeResolver 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.
|
public RequestedContentTypeResolverBuilder.ParameterResolverConfigurer parameterResolver()
"format"
.public void headerResolver()
public void fixedResolver(MediaType... mediaTypes)
mediaTypes
- the media types to usepublic void resolver(RequestedContentTypeResolver resolver)
resolver
- the resolver to addpublic RequestedContentTypeResolver build()
RequestedContentTypeResolver
that delegates to the list
of resolvers configured through this builder.