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.
------------------------------------------------------------
- Since:
- Jetty 7
- Author:
- Greg Wilkins
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MimeTypes
public MimeTypes()
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
-