|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.turbine.services.BaseInitable
org.apache.turbine.services.BaseService
org.apache.turbine.services.TurbineBaseService
org.apache.turbine.services.mimetype.TurbineMimeTypeService
The MimeType Service maintains mappings between MIME types and the corresponding file name extensions, and between locales and character encodings.
The MIME type mappings can be defined in MIME type files located in user's home directory, Java home directory or the current class jar. The default mapping file is defined with the mime.type.file property. In addition, the service maintains a set of most common mappings.
The charset mappings can be defined in property files located in user's home directory, Java home directory or the current class jar. The default mapping file is defined with the charset.file property. In addition, the service maintains a set of most common mappings.
| Field Summary | |
static java.lang.String |
CHARSETS
The charset file property. |
static java.lang.String |
MIME_TYPES
The MIME type file property. |
| Fields inherited from class org.apache.turbine.services.BaseService |
configuration, name, serviceBroker |
| Fields inherited from class org.apache.turbine.services.BaseInitable |
initableBroker, isInitialized |
| Fields inherited from interface org.apache.turbine.services.mimetype.MimeTypeService |
SERVICE_NAME |
| Constructor Summary | |
TurbineMimeTypeService()
Constructs a new 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 |
init()
Initializes the service. |
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 class org.apache.turbine.services.TurbineBaseService |
init, init, init, shutdown |
| Methods inherited from class org.apache.turbine.services.BaseService |
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker |
| Methods inherited from class org.apache.turbine.services.BaseInitable |
getInit, getInitableBroker, setInit, setInitableBroker |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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, setInitableBroker, shutdown |
| Field Detail |
public static final java.lang.String MIME_TYPES
public static final java.lang.String CHARSETS
| Constructor Detail |
public TurbineMimeTypeService()
| Method Detail |
public void init()
throws InitializationException
init in interface Initableinit in class TurbineBaseServiceInitializationException - if initialization fails.public void setContentType(java.lang.String spec)
setContentType in interface MimeTypeServicespec - a MIME type extension specification to add.public java.lang.String getContentType(java.io.File file)
getContentType in interface MimeTypeServicefile - the file.
public java.lang.String getContentType(java.lang.String name)
getContentType in interface MimeTypeServicename - the name of the file.
public java.lang.String getContentType(java.lang.String ext,
java.lang.String def)
getContentType in interface MimeTypeServiceext - the file name extension.def - the default type if none is found.
public MimeType getMimeContentType(java.io.File file)
getMimeContentType in interface MimeTypeServicefile - the file.
public MimeType getMimeContentType(java.lang.String name)
getMimeContentType in interface MimeTypeServicename - the name of the file.
public MimeType getMimeContentType(java.lang.String ext,
java.lang.String def)
getMimeContentType in interface MimeTypeServiceext - the file name extension.def - the default type if none is found.
public java.lang.String getDefaultExtension(java.lang.String type)
getDefaultExtension in interface MimeTypeServicetype - the MIME type as a string.
public java.lang.String getDefaultExtension(MimeType mime)
getDefaultExtension in interface MimeTypeServicemime - the MIME type.
public void setCharSet(java.lang.String key,
java.lang.String charset)
setCharSet in interface MimeTypeServicekey - the key for the charset.charset - the corresponding charset.public java.lang.String getCharSet(java.util.Locale locale)
getCharSet in interface MimeTypeServicelocale - the locale.
public java.lang.String getCharSet(java.util.Locale locale,
java.lang.String variant)
getCharSet in interface MimeTypeServicelocale - the locale.variant - a variant field.
public java.lang.String getCharSet(java.lang.String key)
getCharSet in interface MimeTypeServicekey - the key for the charset.
public java.lang.String getCharSet(java.lang.String key,
java.lang.String def)
getCharSet in interface MimeTypeServicekey - 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 | ||||||||||