org.glassfish.grizzly.http.server.util
Class MimeType
java.lang.Object
org.glassfish.grizzly.http.server.util.MimeType
public class MimeType
- extends java.lang.Object
Hardcoded mime-type supported by default. Additional extension/mime-type mappings may be added by calling add(String, String), however, keep in mind that these mappings are per-JVM.
- Author:
- Jeanfrancois Arcand
|
Method Summary |
static void |
add(java.lang.String extension,
java.lang.String contentType)
Associates the specified extension and content type |
static boolean |
contains(java.lang.String extension)
|
static java.lang.String |
get(java.lang.String extension)
|
static java.lang.String |
get(java.lang.String extension,
java.lang.String defaultCt)
|
static java.lang.String |
getByFilename(java.lang.String fileName)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MimeType
public MimeType()
get
public static java.lang.String get(java.lang.String extension)
- Parameters:
extension - the extension
- Returns:
- the content type associated with
extension. If no association is found, this method will
return text/plain
get
public static java.lang.String get(java.lang.String extension,
java.lang.String defaultCt)
- Parameters:
extension - the extensiondefaultCt - the content type to return if there is no known association for the specified extension
- Returns:
- the content type associated with
extension or if no associate is found, returns
defaultCt
contains
public static boolean contains(java.lang.String extension)
- Parameters:
extension - the extension
- Returns:
true if the specified extension has been registered otherwise, returns false
add
public static void add(java.lang.String extension,
java.lang.String contentType)
Associates the specified extension and content type
- Parameters:
extension - the extensioncontentType - the content type associated with the extension
getByFilename
public static java.lang.String getByFilename(java.lang.String fileName)
- Parameters:
fileName - the filename
- Returns:
- the content type associated with
extension of the
given filename or if no associate is found, returns
null
Copyright © 2012 Oracle Corporation. All Rights Reserved.