org.springframework.http

## Class InvalidMediaTypeException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - java.lang.IllegalArgumentException
        - - org.springframework.http.InvalidMediaTypeException

- All Implemented Interfaces:
    Serializable

      public class InvalidMediaTypeException
      extends IllegalArgumentException

  Exception thrown from `MediaType.parseMediaType(String)` in case of encountering an invalid media type specification String.
  Since:
    3.2.2
  Author:
    Juergen Hoeller
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InvalidMediaTypeException(String mediaType, String msg)` Create a new InvalidMediaTypeException for the given media type.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getMediaType()` Return the offending media type.

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

    - #### InvalidMediaTypeException

          public InvalidMediaTypeException(String mediaType,
                                   String msg)

      Create a new InvalidMediaTypeException for the given media type.
      Parameters:
        `mediaType` - the offending media type
        `msg` - a detail message indicating the invalid part

  - ### Method Detail

    - #### getMediaType

          public String getMediaType()

      Return the offending media type.