Top Description Fields Constructors Methods
org.glassfish.grizzly.http.util

public Class MimeType

extends Object
Class Inheritance
Imports
java.util.HashMap, .Map

Hardcoded mime-type supported by default. Additional extension/mime-type mappings may be added by calling MimeType#add(String, String), however, keep in mind that these mappings are per-JVM.
Author
Jeanfrancois Arcand

Field Summary

Modifier and TypeField and Description
private static final Map<String, String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
add(String
the extension
extension
,
String
the content type associated with the extension
contentType
)

Associates the specified extension and content type

public static boolean
contains(String
the extension
extension
)

Returns: true if the specified extension has been registered otherwise, returns false

public static String
get(String
the extension
extension
)

Returns: the content type associated with extension.

public static String
get(String
the extension
extension
,
String
the content type to return if there is no known association for the specified extension
defaultCt
)

Returns: the content type associated with extension or if no associate is found, returns defaultCt

public static String
getByFilename(String
the filename
fileName
)

Returns: the content type associated with extension of the given filename or if no associate is found, returns null

private static String
getExtension(String fileName)

Get extension of file, without fragment id

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentTypesback to summary
private static final Map<String, String> contentTypes

Constructor Detail

MimeTypeback to summary
public MimeType()

Method Detail

addback to summary
public static void add(String extension, String contentType)

Associates the specified extension and content type

Parameters
extension:String

the extension

contentType:String

the content type associated with the extension

containsback to summary
public static boolean contains(String extension)
Parameters
extension:String

the extension

Returns:boolean

true if the specified extension has been registered otherwise, returns false

getback to summary
public static String get(String extension)
Parameters
extension:String

the extension

Returns:String

the content type associated with extension. If no association is found, this method will return text/plain

getback to summary
public static String get(String extension, String defaultCt)
Parameters
extension:String

the extension

defaultCt:String

the content type to return if there is no known association for the specified extension

Returns:String

the content type associated with extension or if no associate is found, returns defaultCt

getByFilenameback to summary
public static String getByFilename(String fileName)
Parameters
fileName:String

the filename

Returns:String

the content type associated with extension of the given filename or if no associate is found, returns null

getExtensionback to summary
private static String getExtension(String fileName)

Get extension of file, without fragment id