Package com.adaptris.core.http
Class MetadataContentTypeProvider
- java.lang.Object
-
- com.adaptris.core.http.ContentTypeProviderImpl
-
- com.adaptris.core.http.MetadataContentTypeProvider
-
- All Implemented Interfaces:
ContentTypeProvider
public class MetadataContentTypeProvider extends ContentTypeProviderImpl
Provides a content type derived from metadata.Note that the content type charset will be derived from
AdaptrisMessage.getCharEncoding()
so configuring a mime type oftext/xml
when the message has a char encoding ofUTF-8
will returntext/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 Summary
Constructors Constructor Description MetadataContentTypeProvider()
MetadataContentTypeProvider(java.lang.String key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class com.adaptris.core.http.ContentTypeProviderImpl
build
-
-
-
-
Method Detail
-
getContentType
public java.lang.String getContentType(AdaptrisMessage msg) throws CoreException
Description copied from interface:ContentTypeProvider
Get the content type.- Parameters:
msg
- the Adaptris Message- Returns:
- the content type.
- Throws:
CoreException
- wrapping other exceptions
-
getMetadataKey
public java.lang.String getMetadataKey()
-
setMetadataKey
public void setMetadataKey(java.lang.String key)
Set the metadata item containing content type.- Parameters:
key
- the key containing the base content type
-
getDefaultMimeType
public java.lang.String getDefaultMimeType()
-
setDefaultMimeType
public void setDefaultMimeType(java.lang.String mt)
Set the default mime type to use if the metadata key does not exist.- Parameters:
mt
- the mime type; defaults to text/plain
-
-