Class FixedContentNegotiationStrategy
java.lang.Object
org.springframework.web.accept.FixedContentNegotiationStrategy
- All Implemented Interfaces:
ContentNegotiationStrategy
A
ContentNegotiationStrategy that returns a fixed content type.- Since:
- 3.2
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields inherited from interface ContentNegotiationStrategy
MEDIA_TYPE_ALL_LIST -
Constructor Summary
ConstructorsConstructorDescriptionFixedContentNegotiationStrategy(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. -
Method Summary
Modifier and TypeMethodDescriptionReturn the configured list of media types.resolveMediaTypes(NativeWebRequest request) Resolve the given request to a list of media types.
-
Constructor Details
-
FixedContentNegotiationStrategy
Constructor with a single defaultMediaType. -
FixedContentNegotiationStrategy
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.- Since:
- 5.0
-
-
Method Details
-
getContentTypes
-
resolveMediaTypes
Description copied from interface:ContentNegotiationStrategyResolve the given request to a list of media types. The returned list is ordered by specificity first and by quality parameter second.- Specified by:
resolveMediaTypesin interfaceContentNegotiationStrategy- Parameters:
request- the current request- Returns:
- the requested media types, or
ContentNegotiationStrategy.MEDIA_TYPE_ALL_LISTif none were requested.
-