Methods Summary |
---|
public void | addContentType(java.lang.String extn, java.lang.String type)
map.put(extn, type.toLowerCase());
|
public java.lang.String | getContentType(java.lang.String extn)
String type = (String)map.get(extn.toLowerCase());
if( type == null ) type=(String)defaultMap.get( extn );
return type;
|
public java.lang.String | getContentTypeFor(java.lang.String fileName)
String extn=getExtension( fileName );
if (extn!=null) {
return getContentType(extn);
} else {
// no extension, no content type
return null;
}
|
public static java.lang.String | getExtension(java.lang.String fileName)Get extension of file, without fragment id
// play it safe and get rid of any fragment id
// that might be there
int length=fileName.length();
int newEnd = fileName.lastIndexOf('#");
if( newEnd== -1 ) newEnd=length;
// Instead of creating a new string.
// if (i != -1) {
// fileName = fileName.substring(0, i);
// }
int i = fileName.lastIndexOf('.", newEnd );
if (i != -1) {
return fileName.substring(i + 1, newEnd );
} else {
// no extension, no content type
return null;
}
|
public java.util.Enumeration | getExtensions()
return map.keys();
|
public void | removeContentType(java.lang.String extn)
map.remove(extn.toLowerCase());
|