public class MetadataContentTypeProvider extends ContentTypeProviderImpl
Note that the content type charset will be derived from AdaptrisMessage.getCharEncoding()
so configuring a mime type of text/xml
when the message has a char encoding of
UTF-8
will return text/xml; charset="UTF-8"
. No validation is done on the resulting string or on the value
that is taken from metadata.
In the adapter configuration file this class is aliased as http-metadata-content-type-provider which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
MetadataContentTypeProvider() |
MetadataContentTypeProvider(java.lang.String key) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContentType(AdaptrisMessage msg)
Get the content type.
|
java.lang.String |
getDefaultMimeType() |
java.lang.String |
getMetadataKey() |
void |
setDefaultMimeType(java.lang.String mt)
Set the default mime type to use if the metadata key does not exist.
|
void |
setMetadataKey(java.lang.String key)
Set the metadata item containing content type.
|
build
public MetadataContentTypeProvider()
public MetadataContentTypeProvider(java.lang.String key)
public java.lang.String getContentType(AdaptrisMessage msg) throws CoreException
ContentTypeProvider
msg
- the Adaptris MessageCoreException
- wrapping other exceptionspublic java.lang.String getMetadataKey()
public void setMetadataKey(java.lang.String key)
key
- the key containing the base content typepublic java.lang.String getDefaultMimeType()
public void setDefaultMimeType(java.lang.String mt)
mt
- the mime type; defaults to text/plain