org.klomp.snark.web

## Class MimeTypes

- java.lang.Object
- - org.klomp.snark.web.MimeTypes

-     class MimeTypes
      extends Object

  Based on MimeTypes from Jetty 6.1.26, heavily simplified and modified to remove all dependencies on Jetty libs.

  Supports mime types only, not encodings. Does not support a default "*" mapping.

  This is only for local mappings. Caller should use getServletContext().getMimeType() if this returns null.

  ------------------------------------------------------------

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MimeTypes()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMimeMapping(String extension, String type)` Set a mime mapping
    `String` | `getMimeByExtension(String filename)` Get the MIME type by filename extension.
    `void` | `loadMimeMap(String resourcePath)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MimeTypes

          public MimeTypes()

  - ### Method Detail

    - #### addMimeMapping

          public void addMimeMapping(String extension,
                                     String type)

      Set a mime mapping
      Parameters:
        `extension` -
        `type` -

    - #### getMimeByExtension

          public String getMimeByExtension(String filename)

      Get the MIME type by filename extension.

      Returns ONLY local mappings. Caller should use getServletContext().getMimeType() if this returns null.

      Parameters:
        `filename` - A file name
      Returns:
        MIME type matching the longest dot extension of the file name.

    - #### loadMimeMap

          public void loadMimeMap(String resourcePath)

      Parameters:
        `resourcePath` - A Map of file extension to mime-type.