Class ParameterContentTypeResolver
java.lang.Object
org.springframework.web.reactive.accept.ParameterContentTypeResolver
- All Implemented Interfaces:
RequestedContentTypeResolver
Resolver that checks a query parameter and uses it to lookup a matching
MediaType. Lookup keys can be registered or as a fallback
MediaTypeFactory can be used to perform a lookup.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields inherited from interface org.springframework.web.reactive.accept.RequestedContentTypeResolver
MEDIA_TYPE_ALL_LIST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionresolveMediaTypes(ServerWebExchange exchange) Resolve the given request to a list of requested media types.voidsetParameterName(String parameterName) Set the name of the parameter to use to determine requested media types.
-
Constructor Details
-
ParameterContentTypeResolver
-
-
Method Details
-
setParameterName
Set the name of the parameter to use to determine requested media types.By default this is set to "format".
-
getParameterName
-
resolveMediaTypes
public List<MediaType> resolveMediaTypes(ServerWebExchange exchange) throws NotAcceptableStatusException Description copied from interface:RequestedContentTypeResolverResolve the given request to a list of requested media types. The returned list is ordered by specificity first and by quality parameter second.- Specified by:
resolveMediaTypesin interfaceRequestedContentTypeResolver- Parameters:
exchange- the current exchange- Returns:
- the requested media types, or
RequestedContentTypeResolver.MEDIA_TYPE_ALL_LISTif none were requested. - Throws:
NotAcceptableStatusException- if the requested media type is invalid
-