Enum MediaType

    • Enum Constant Detail

      • XHTML

        public static final MediaType XHTML
        An (X)HTML document (application/xhtml+xml).
      • XHTML_ATTRIBUTE

        public static final MediaType XHTML_ATTRIBUTE
        Indicates that a value contains a XHTML attribute only. This is a non-standard media type and is only used during internal conversions. The final output should not be this type.
      • JAVASCRIPT

        public static final MediaType JAVASCRIPT
        A JavaScript script (application/javascript).
      • JSON

        public static final MediaType JSON
        A JSON script (application/json).
      • LD_JSON

        public static final MediaType LD_JSON
        A JSON linked data script (application/ld+json).
      • TEXT

        public static final MediaType TEXT
        Any plaintext document comprised of unicode characters (text/plain). This is used for any arbitrary, unknown and untrusted data.
      • URL

        public static final MediaType URL
        A URL-encoded, & (not &) separated URL.
      • SH

        public static final MediaType SH
        A Bourne shell script (text/x-sh).
      • MYSQL

        public static final MediaType MYSQL
        The MySQL mysql command line (text/x-mysql).
      • PSQL

        public static final MediaType PSQL
        The PostgreSQL psql command line (text/x-psql).
    • Method Detail

      • values

        public static MediaType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MediaType c : MediaType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

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

        public String getContentType()
        Gets the actual media type, such as text/html.
      • getMarkupType

        public abstract MarkupType getMarkupType()
        Gets the markup type compatible with this media type.
      • getMediaTypeByName

        public static MediaType getMediaTypeByName​(String name)
        Gets the media type for the given name using case-insensitive matching.
        Returns:
        the MediaType or null if not found.