org.springframework.web.reactive.accept

## Class FixedContentTypeResolver

- java.lang.Object
- - org.springframework.web.reactive.accept.FixedContentTypeResolver

All Implemented Interfaces:
  RequestedContentTypeResolver

    public class FixedContentTypeResolver
    extends Object
    implements 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 org.springframework.web.reactive.accept.RequestedContentTypeResolver

`MEDIA_TYPE_ALL_LIST`

### Constructor Summary

Constructors
Constructor and Description
`FixedContentTypeResolver(List<org.springframework.http.MediaType> contentTypes)` Constructor with an ordered List of default `MediaType`'s to return for use in applications that support a variety of content types.
`FixedContentTypeResolver(org.springframework.http.MediaType mediaType)` Constructor with a single default `MediaType`.

### Method Summary

All Methods Instance Methods Concrete Methods
`List<org.springframework.http.MediaType>` `getContentTypes()` Return the configured list of media types.
`List<org.springframework.http.MediaType>` `resolveMediaTypes(org.springframework.web.server.ServerWebExchange exchange)` Resolve the given request to a list of requested media types.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FixedContentTypeResolver

    public FixedContentTypeResolver(org.springframework.http.MediaType mediaType)

Constructor with a single default `MediaType`.

#### FixedContentTypeResolver

    public FixedContentTypeResolver(List<org.springframework.http.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.

### Method Detail

#### getContentTypes

    public List<org.springframework.http.MediaType> getContentTypes()

Return the configured list of media types.

#### resolveMediaTypes

    public List<org.springframework.http.MediaType> resolveMediaTypes(org.springframework.web.server.ServerWebExchange exchange)

Description copied from interface: `RequestedContentTypeResolver`
Resolve 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_LIST` if none were requested.