org.springframework.web

## Class HttpMediaTypeNotSupportedException

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

- All Implemented Interfaces:
    Serializable

      public class HttpMediaTypeNotSupportedException
      extends HttpMediaTypeException

  Exception thrown when a client POSTs, PUTs, or PATCHes content of a type not supported by request handler.
  Since:
    3.0
  Author:
    Arjen Poutsma
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes)` Create a new HttpMediaTypeNotSupportedException.
    `HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes, String msg)` Create a new HttpMediaTypeNotSupportedException.
    `HttpMediaTypeNotSupportedException(String message)` Create a new HttpMediaTypeNotSupportedException.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MediaType` | `getContentType()` Return the HTTP request content type method that caused the failure.

    - ### Methods inherited from class org.springframework.web.HttpMediaTypeException

      `getSupportedMediaTypes`

    - ### 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

    - #### HttpMediaTypeNotSupportedException

          public HttpMediaTypeNotSupportedException(String message)

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

    - #### HttpMediaTypeNotSupportedException

          public HttpMediaTypeNotSupportedException(MediaType contentType,
                                            List<MediaType> supportedMediaTypes)

      Create a new HttpMediaTypeNotSupportedException.
      Parameters:
        `contentType` - the unsupported content type
        `supportedMediaTypes` - the list of supported media types

    - #### HttpMediaTypeNotSupportedException

          public HttpMediaTypeNotSupportedException(MediaType contentType,
                                            List<MediaType> supportedMediaTypes,
                                            String msg)

      Create a new HttpMediaTypeNotSupportedException.
      Parameters:
        `contentType` - the unsupported content type
        `supportedMediaTypes` - the list of supported media types
        `msg` - the detail message

  - ### Method Detail

    - #### getContentType

          public MediaType getContentType()

      Return the HTTP request content type method that caused the failure.