org.klomp.snark.web
Class MimeTypes

java.lang.Object
  extended by 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 Summary
MimeTypes()
           
 
Method Summary
 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

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 -