Package org.springframework.web.accept
Class FixedContentNegotiationStrategy
- java.lang.Object
- org.springframework.web.accept.FixedContentNegotiationStrategy
- All Implemented Interfaces:
ContentNegotiationStrategy
public class FixedContentNegotiationStrategy extends Object implements ContentNegotiationStrategy
AContentNegotiationStrategy
that returns a fixed content type.- Since:
- 3.2
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description FixedContentNegotiationStrategy(MediaType contentType)
Create an instance with the given content type.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MediaType>
resolveMediaTypes(NativeWebRequest request)
Resolve the given request to a list of media types.
Constructor Detail
FixedContentNegotiationStrategy
public FixedContentNegotiationStrategy(MediaType contentType)
Create an instance with the given content type.
Method Detail
resolveMediaTypes
public List<MediaType> resolveMediaTypes(NativeWebRequest request)
Description copied from interface:ContentNegotiationStrategy
Resolve the given request to a list of media types. The returned list is ordered by specificity first and by quality parameter second.- Specified by:
resolveMediaTypes
in interfaceContentNegotiationStrategy
- Parameters:
request
- the current request- Returns:
- the requested media types or an empty list (never
null
)