Module org.htmlunit

Class MimeType

java.lang.Object
org.htmlunit.util.MimeType

public final class MimeType extends Object
Utility class holding information about the association between MIME types and file extensions.
Author:
Marc Guillemot, Ronald Brill
  • Field Details

  • Method Details

    • isJavascriptMimeType

      public static boolean isJavascriptMimeType(String mimeType)
      Returns whether the given MIME type is a valid JavaScript MIME type according to RFC 9239.
      Parameters:
      mimeType - the type to check
      Returns:
      true if the MIME type is a JavaScript MIME type
    • isObsoleteJavascriptMimeType

      public static boolean isObsoleteJavascriptMimeType(String mimeType)
      Returns whether the given MIME type is an obsolete JavaScript MIME type according to MIME Sniffing.
      Parameters:
      mimeType - the type to check
      Returns:
      true if the MIME type is an obsolete JavaScript MIME type
    • getFileExtension

      public static String getFileExtension(String contentType)
      Returns the preferred file extension for the given content type, or "unknown" if none is known.
      Parameters:
      contentType - the MIME type
      Returns:
      the file extension, or "unknown" if not recognized