org.springframework.web

## Class HttpMediaTypeException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - javax.servlet.ServletException
      - - org.springframework.web.HttpMediaTypeException

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    HttpMediaTypeNotAcceptableException, HttpMediaTypeNotSupportedException

      public abstract class HttpMediaTypeException
      extends ServletException

  Abstract base for exceptions related to media types. Adds a list of supported `MediaTypes`.
  Since:
    3.0
  Author:
    Arjen Poutsma
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `HttpMediaTypeException(String message)` Create a new HttpMediaTypeException.
    `protected` | `HttpMediaTypeException(String message, List<MediaType> supportedMediaTypes)` Create a new HttpMediaTypeException with a list of supported media types.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<MediaType>` | `getSupportedMediaTypes()` Return the list of supported media types.

    - ### Methods inherited from class javax.servlet.ServletException

      `getRootCause`

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

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

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

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

- - ### Constructor Detail

    - #### HttpMediaTypeException

          protected HttpMediaTypeException(String message)

      Create a new HttpMediaTypeException.
      Parameters:
        `message` - the exception message

    - #### HttpMediaTypeException

          protected HttpMediaTypeException(String message,
                                List<MediaType> supportedMediaTypes)

      Create a new HttpMediaTypeException with a list of supported media types.
      Parameters:
        `supportedMediaTypes` - the list of supported media types

  - ### Method Detail

    - #### getSupportedMediaTypes

          public List<MediaType> getSupportedMediaTypes()

      Return the list of supported media types.