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. ------------------------------------------------------------
Since:
Jetty 7
Author:
Greg Wilkins
  • Constructor Details

    • MimeTypes

      public MimeTypes()
  • Method Details

    • loadMimeMap

      public void loadMimeMap(String resourcePath)
      Parameters:
      resourcePath - A Map of file extension to mime-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.
    • addMimeMapping

      public void addMimeMapping(String extension, String type)
      Set a mime mapping
      Parameters:
      extension -
      type -