Package 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
-
Constructor Summary
Constructors Constructor Description MimeTypes()
-
Method Summary
Modifier and Type Method Description void
addMimeMapping(String extension, String type)
Set a mime mappingString
getMimeByExtension(String filename)
Get the MIME type by filename extension.void
loadMimeMap(String resourcePath)
-
Constructor Details
-
MimeTypes
public MimeTypes()
-
-
Method Details
-
loadMimeMap
- Parameters:
resourcePath
- A Map of file extension to mime-type.
-
getMimeByExtension
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
Set a mime mapping- Parameters:
extension
-type
-
-