spring-framework / org.springframework.web.accept / ParameterContentNegotiationStrategy

ParameterContentNegotiationStrategy

open class ParameterContentNegotiationStrategy : AbstractMappingContentNegotiationStrategy

Strategy that resolves the requested content type from a query parameter. The default query parameter name is "format".

You can register static mappings between keys (i.e. the expected value of the query parameter) and MediaType's via #addMapping(String, MediaType). As of 5.0 this strategy also supports dynamic lookups of keys via org.springframework.http.MediaTypeFactory#getMediaType.

Author
Rossen Stoyanchev

Since
3.2

Constructors

<init>

ParameterContentNegotiationStrategy(mediaTypes: MutableMap<String, MediaType>)

Create an instance with the given map of file extensions and media types.

Functions

getParameterName

open fun getParameterName(): String

setParameterName

open fun setParameterName(parameterName: String): Unit

Set the name of the parameter to use to determine requested media types.

By default this is set to "format".