Top Description Fields Constructors Methods
org.springframework.web.accept

public Class FixedContentNegotiationStrategy

extends Object
implements ContentNegotiationStrategy
Class Inheritance
All Implemented Interfaces
org.springframework.web.accept.ContentNegotiationStrategy
Imports
java.util.Collections, .List, org.springframework.http.MediaType, org.springframework.util.Assert, org.springframework.web.context.request.NativeWebRequest

A ContentNegotiationStrategy that returns a fixed content type.
Author
Rossen Stoyanchev
Since
3.2

Field Summary

Modifier and TypeField and Description
private final List<MediaType>

Constructor Summary

AccessConstructor and Description
public
FixedContentNegotiationStrategy(MediaType contentType)

Constructor with a single default MediaType.

public
FixedContentNegotiationStrategy(List<MediaType> contentTypes)

Constructor with an ordered List of default MediaType's to return for use in applications that support a variety of content types.

Method Summary

Modifier and TypeMethod and Description
public List<MediaType>
getContentTypes()

Return the configured list of media types.

public List<MediaType>
resolveMediaTypes(NativeWebRequest
the current request
request
)

Implements org.springframework.web.accept.ContentNegotiationStrategy.resolveMediaTypes.

Resolve the given request to a list of media types.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentTypesback to summary
private final List<MediaType> contentTypes

Constructor Detail

FixedContentNegotiationStrategyback to summary
public FixedContentNegotiationStrategy(MediaType contentType)

Constructor with a single default MediaType.

FixedContentNegotiationStrategyback to summary
public FixedContentNegotiationStrategy(List<MediaType> contentTypes)

Constructor with an ordered List of default MediaType's to return for use in applications that support a variety of content types.

Consider appending MediaType#ALL at the end if destinations are present which do not support any of the other default media types.

Since
5.0

Method Detail

getContentTypesback to summary
public List<MediaType> getContentTypes()

Return the configured list of media types.

resolveMediaTypesback to summary
public List<MediaType> resolveMediaTypes(NativeWebRequest request)

Implements org.springframework.web.accept.ContentNegotiationStrategy.resolveMediaTypes.

Doc from org.springframework.web.accept.ContentNegotiationStrategy.resolveMediaTypes.

Resolve the given request to a list of media types. The returned list is ordered by specificity first and by quality parameter second.

Parameters
request:NativeWebRequest

the current request

Returns:List<MediaType>

the requested media types, or MEDIA_TYPE_ALL_LIST if none were requested.

Annotations
@Override