|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Adaptee
org.norther.tammi.core.locale.DefaultContentTypeMap
public class DefaultContentTypeMap
A default implementation of ContentTypeMap.
| Field Summary |
|---|
| Fields inherited from class org.norther.tammi.core.base.Adaptee |
|---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
| Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
DefaultContentTypeMap()
Constructs a new map. |
|
| Method Summary | |
|---|---|
String |
getCharSet(Locale locale)
Gets the charset for a locale. |
String |
getCharSet(Locale locale,
List accepted)
Gets the accepted charset for a locale. |
String |
getCharSet(Locale locale,
String variant)
Gets the charset for a locale with an optional variant. |
String |
getCharSet(Locale locale,
String variant,
List accepted)
Gets the accepted charset for a locale with an optional variant. |
String |
getCharSet(String path)
Gets the charset for a localized file path. |
protected CharSetMap |
getCharSetMap()
Gets the char set map to use. |
String |
getCharSetPath()
Gets the pathname of the charset file. |
String |
getConfigKey()
Gets the path finder key for resolving configuration paths. |
String |
getContentType(File file)
Gets the MIME content type for a file as a string. |
String |
getContentType(String name)
Gets the MIME content type for a named file as a string. |
String |
getContentType(String ext,
String def)
Gets the MIME content type for a file name extension as a string. |
String[] |
getContentTypes(String ext)
Gets the MIME content types for a file name extension. |
String |
getDefaultExtension(MimeType mime)
Gets the default file name extension for a MIME type. |
String |
getDefaultExtension(String type)
Gets the default file name extension for a MIME type. |
String[] |
getExtensions(String type)
Gets the file name extensions for a MIME type. |
MimeType |
getMimeType(File file)
Gets the MIME content type for a file. |
MimeType |
getMimeType(String name)
Gets the MIME type for a named file. |
MimeType |
getMimeType(String ext,
String def)
Gets the MIME type for a file name extension. |
protected MimeTypeMap |
getMimeTypeMap()
Gets the MIME type map to use. |
String |
getMimeTypePath()
Gets the pathname of the MIME type file. |
void |
setCharSet(String key,
String charset)
Sets a locale-charset mapping. |
void |
setCharSetPath(String path)
Sets the pathname of the charset file. |
void |
setConfigKey(String key)
Sets the path finder key for resolving configuration paths. |
void |
setContentType(String spec)
Sets a MIME content type mapping to extensions to the map. |
void |
setMimeTypePath(String path)
Sets the pathname of the MIME type file. |
| Methods inherited from class org.norther.tammi.core.base.Adaptee |
|---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultContentTypeMap()
| Method Detail |
|---|
public String getConfigKey()
ContentTypeMap
getConfigKey in interface ContentTypeMappublic void setConfigKey(String key)
ContentTypeMap
setConfigKey in interface ContentTypeMapkey - the path finder key.public void setContentType(String spec)
ContentTypeMap
setContentType in interface ContentTypeMapspec - a MIME type extension specification to add.public String getContentType(File file)
ContentTypeMap
getContentType in interface ContentTypeMapfile - the file.
public String getContentType(String name)
ContentTypeMap
getContentType in interface ContentTypeMapname - the name of the file.
public String getContentType(String ext,
String def)
ContentTypeMap
getContentType in interface ContentTypeMapext - the file name extension.def - the default type if none is found.
public String[] getContentTypes(String ext)
ContentTypeMap
getContentTypes in interface ContentTypeMapext - the file name extension.
public MimeType getMimeType(File file)
ContentTypeMap
getMimeType in interface ContentTypeMapfile - the file.
public MimeType getMimeType(String name)
ContentTypeMap
getMimeType in interface ContentTypeMapname - the name of the file.
public MimeType getMimeType(String ext,
String def)
ContentTypeMap
getMimeType in interface ContentTypeMapext - the file name extension.def - the default type if none is found.
public String getDefaultExtension(String type)
ContentTypeMap
getDefaultExtension in interface ContentTypeMaptype - the MIME type as a string.
public String getDefaultExtension(MimeType mime)
ContentTypeMap
getDefaultExtension in interface ContentTypeMapmime - the MIME type.
public String[] getExtensions(String type)
ContentTypeMap
getExtensions in interface ContentTypeMaptype - the MIME type as a string.
public String getCharSet(String path)
ContentTypeMap
getCharSet in interface ContentTypeMappath - the localized path.
public void setCharSet(String key,
String charset)
ContentTypeMap
setCharSet in interface ContentTypeMapkey - the key for the charset.charset - the corresponding charset.public String getCharSet(Locale locale)
ContentTypeMap
getCharSet in interface ContentTypeMaplocale - the locale.
public String getCharSet(Locale locale,
String variant)
ContentTypeMap
getCharSet in interface ContentTypeMaplocale - the locale.variant - an optional variant.
public String getCharSet(Locale locale,
List accepted)
ContentTypeMap
getCharSet in interface ContentTypeMaplocale - the locale.accepted - a list of accepted charsets.
public String getCharSet(Locale locale,
String variant,
List accepted)
ContentTypeMapThe search is performed in the following order:
The found charsets are compared with the list of accepted ones and the first accepted charset is returned. If none of the above is accepted but UTF-8 is, UTF-8 is returned. Otherwise the first found charset is returned.
getCharSet in interface ContentTypeMaplocale - the locale.variant - the variant.accepted - a list of accepted charsets.
public String getMimeTypePath()
ContentTypeMap
getMimeTypePath in interface ContentTypeMappublic void setMimeTypePath(String path)
ContentTypeMap
setMimeTypePath in interface ContentTypeMappath - the pathname of the MIME type file.public String getCharSetPath()
ContentTypeMap
getCharSetPath in interface ContentTypeMappublic void setCharSetPath(String path)
ContentTypeMap
setCharSetPath in interface ContentTypeMappath - the pathname of the charset file.protected MimeTypeMap getMimeTypeMap()
protected CharSetMap getCharSetMap()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||