Enum Class MediaTypes

All Implemented Interfaces:
Serializable, Comparable<MediaTypes>, Constable

public enum MediaTypes extends Enum<MediaTypes>
  • Enum Constant Details

    • ANY

      public static final MediaTypes ANY
    • DETECT

      public static final MediaTypes DETECT
      (Only for produces) Attempts to detect the MimeType as well as charset when not known
    • TEXT

      public static final MediaTypes TEXT
    • XML

      public static final MediaTypes XML
    • JSON

      public static final MediaTypes JSON
    • PDF

      public static final MediaTypes PDF
    • OCTET

      public static final MediaTypes OCTET

      public static final MediaTypes MULTIPART_FORMDATA

      public static final MediaTypes MULTIPART
  • Method Details

    • values

      public static MediaTypes[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MediaTypes valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      name - the name of the enum constant to be returned.
      the enum constant with the specified name
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getDefaultCharset

      public Charset getDefaultCharset()
      returns the default charset for the given mediatype or null when non is allowed
    • includes

      public boolean includes(@Nullable String contentTypeHeader)
      Matches the provided 'Content-Type' to this enum, should always be valid, is not weighted
    • accepts

      public boolean accepts(@Nullable String acceptHeader)
      Checks if this enum matches a value in the provided 'Accept' header.
    • fromValue

      public static MediaTypes fromValue(String contentType)
    • getMimeType

      public org.springframework.util.MimeType getMimeType()
      Returns the MimeType without any parameters (such as charset)
    • getMimeType

      public org.springframework.util.MimeType getMimeType(String charset)