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

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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FixedContentNegotiationStrategy(MediaType defaultContentType)` Create an instance that always returns the given content type.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<MediaType>` | `resolveMediaTypes(NativeWebRequest webRequest)` Resolve the given request to a list of media types.

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

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

- - ### Constructor Detail

    - #### FixedContentNegotiationStrategy

          public FixedContentNegotiationStrategy(MediaType defaultContentType)

      Create an instance that always returns the given content type.

  - ### Method Detail

    - #### resolveMediaTypes

          public List<MediaType> resolveMediaTypes(NativeWebRequest webRequest)

      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 interface `ContentNegotiationStrategy`
      Parameters:
        `webRequest` - the current request
      Returns:
        the requested media types or an empty list, never `null`