|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The MimeType Service maintains mappings between MIME types and the corresponding file name extensions, and between locales and character encodings. The mappings are typically defined in properties or files located in user's home directory, Java home directory or the current class jar depending on the implementation.
Field Summary | |
static java.lang.String |
SERVICE_NAME
The name of the service. |
Method Summary | |
java.lang.String |
getCharSet(java.util.Locale locale)
Gets the charset for a locale. |
java.lang.String |
getCharSet(java.util.Locale locale,
java.lang.String variant)
Gets the charset for a locale with a variant. |
java.lang.String |
getCharSet(java.lang.String key)
Gets the charset for a specified key. |
java.lang.String |
getCharSet(java.lang.String key,
java.lang.String def)
Gets the charset for a specified key. |
java.lang.String |
getContentType(java.io.File file)
Gets the MIME content type for a file as a string. |
java.lang.String |
getContentType(java.lang.String name)
Gets the MIME content type for a named file as a string. |
java.lang.String |
getContentType(java.lang.String ext,
java.lang.String def)
Gets the MIME content type for a file name extension as a string. |
java.lang.String |
getDefaultExtension(MimeType mime)
Gets the default file name extension for a MIME type. |
java.lang.String |
getDefaultExtension(java.lang.String type)
Gets the default file name extension for a MIME type. |
MimeType |
getMimeContentType(java.io.File file)
Gets the MIME content type for a file. |
MimeType |
getMimeContentType(java.lang.String name)
Gets the MIME content type for a named file. |
MimeType |
getMimeContentType(java.lang.String ext,
java.lang.String def)
Gets the MIME content type for a file name extension. |
void |
setCharSet(java.lang.String key,
java.lang.String charset)
Sets a locale-charset mapping. |
void |
setContentType(java.lang.String spec)
Sets a MIME content type mapping to extensions to the map. |
Methods inherited from interface org.apache.turbine.services.Service |
getConfiguration, getName, getProperties, setName, setServiceBroker |
Methods inherited from interface org.apache.turbine.services.Initable |
getInit, init, init, setInitableBroker, shutdown |
Field Detail |
public static final java.lang.String SERVICE_NAME
Method Detail |
public void setContentType(java.lang.String spec)
spec
- a MIME type extension specification to add.public java.lang.String getContentType(java.io.File file)
file
- the file.
public java.lang.String getContentType(java.lang.String name)
name
- the name of the file.
public java.lang.String getContentType(java.lang.String ext, java.lang.String def)
ext
- the file name extension.def
- the default type if none is found.
public MimeType getMimeContentType(java.io.File file)
file
- the file.
public MimeType getMimeContentType(java.lang.String name)
name
- the name of the file.
public MimeType getMimeContentType(java.lang.String ext, java.lang.String def)
ext
- the file name extension.def
- the default type if none is found.
public java.lang.String getDefaultExtension(java.lang.String type)
type
- the MIME type as a string.
public java.lang.String getDefaultExtension(MimeType mime)
mime
- the MIME type.
public void setCharSet(java.lang.String key, java.lang.String charset)
key
- the key for the charset.charset
- the corresponding charset.public java.lang.String getCharSet(java.util.Locale locale)
locale
- the locale.
public java.lang.String getCharSet(java.util.Locale locale, java.lang.String variant)
locale
- the locale.variant
- a variant field.
public java.lang.String getCharSet(java.lang.String key)
key
- the key for the charset.
public java.lang.String getCharSet(java.lang.String key, java.lang.String def)
key
- the key for the charset.def
- the default charset if none is found.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |