Class FixedContentTypeResolver
java.lang.Object
org.springframework.web.reactive.accept.FixedContentTypeResolver
- All Implemented Interfaces:
RequestedContentTypeResolver
Resolver that always resolves to a fixed list of media types. This can be
used as the "last in line" strategy providing a fallback for when the client
has not requested any media types.
- since:
- 5.0
- Author:
- Rossen stoyanchev
-
Field summary
Fields inherited from interface RequestedContentTypeResolver
MEDIA_TYPE_ALL_LIsT -
Constructor summary
ConstructorsConstructorDescriptionFixedContentTypeResolver(List<MediaType> contentTypes) Constructor with an ordered List of defaultMediaType's to return for use in applications that support a variety of content types.FixedContentTypeResolver(MediaType mediaType) Constructor with a single defaultMediaType. -
Method summary
Modifier and TypeMethodDescriptionReturn the configured list of media types.resolveMediaTypes(serverWebExchange exchange) Resolve the given request to a list of requested media types.
-
Constructor Details
-
FixedContentTypeResolver
Constructor with a single defaultMediaType. -
FixedContentTypeResolver
Constructor with an ordered List of defaultMediaType's to return for use in applications that support a variety of content types.Consider appending
MediaType.ALLat the end if destinations are present which do not support any of the other default media types.
-
-
Method Details
-
getContentTypes
-
resolveMediaTypes
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:
resolveMediaTypes in interface RequestedContentTypeResolver- Parameters:
exchange- the current exchange- Returns:
- the requested media types, or
RequestedContentTypeResolver.MEDIA_TYPE_ALL_LIsTif none were requested.
-