java.lang.Object
org.glassfish.grizzly.http.util.MimeType

public class MimeType extends Object
Hardcoded mime-type supported by default. Additional extension/mime-type mappings may be added by calling add(String, String), however, keep in mind that these mappings are per-JVM.
Author:
Jeanfrancois Arcand
  • Constructor Details

    • MimeType

      public MimeType()
  • Method Details

    • get

      public static String get(String extension)
      Parameters:
      extension - the extension
      Returns:
      the content type associated with extension. If no association is found, this method will return text/plain
    • get

      public static String get(String extension, String defaultCt)
      Parameters:
      extension - the extension
      defaultCt - the content type to return if there is no known association for the specified extension
      Returns:
      the content type associated with extension or if no associate is found, returns defaultCt
    • contains

      public static boolean contains(String extension)
      Parameters:
      extension - the extension
      Returns:
      true if the specified extension has been registered otherwise, returns false
    • add

      public static void add(String extension, String contentType)

      Associates the specified extension and content type

      Parameters:
      extension - the extension
      contentType - the content type associated with the extension
    • getByFilename

      public static String getByFilename(String fileName)
      Parameters:
      fileName - the filename
      Returns:
      the content type associated with extension of the given filename or if no associate is found, returns null