@ComponentProfile(summary="Builds a MIME Body part using a byte array", since="3.9.0") public class InlineMimePartBuilder extends java.lang.Object implements MimePartBuilder
Used as part of a MultipartMessageBuilder
service; this constructs a MimeBodyPart
from the configured
body
configuration. Depending on your use case you might opt to use ByteArrayFromPayload
or
ByteArrayFromMetadata
to generate the actual contents for the part.
You can also specify the various headers that will be associated with the MimeBodyPart
such as the Content-ID
,
Content-Type
or Content-Transfer-Encoding
. Additional non standard headers can be added by configuring a
setPartHeaderFilter(MetadataFilter)
to filter out metadata to include as part of the MimeBodyPart headers.
In the adapter configuration file this class is aliased as inline-mime-body-part-builder which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
InlineMimePartBuilder() |
Modifier and Type | Method and Description |
---|---|
javax.mail.internet.MimeBodyPart |
build(AdaptrisMessage msg)
Build the body part
|
MessageWrapper<byte[]> |
getBody() |
java.lang.String |
getContentEncoding() |
java.lang.String |
getContentId() |
java.lang.String |
getContentType() |
MetadataFilter |
getPartHeaderFilter() |
void |
setBody(MessageWrapper<byte[]> body)
Set where the body of the MimeBodyPart is going to come from.
|
void |
setContentEncoding(java.lang.String s)
Set the Content-Transfer-Encoding for the part.
|
void |
setContentId(java.lang.String s)
Set the Content-ID for the part,
|
void |
setContentType(java.lang.String s)
Set the Content-Type for the part.
|
void |
setPartHeaderFilter(MetadataFilter filter)
Set any additional headers that need to be set for this nested part.
|
InlineMimePartBuilder |
withBody(MessageWrapper<byte[]> body) |
InlineMimePartBuilder |
withContentEncoding(java.lang.String s) |
InlineMimePartBuilder |
withContentId(java.lang.String s) |
InlineMimePartBuilder |
withContentType(java.lang.String s) |
InlineMimePartBuilder |
withPartHeaderFilter(MetadataFilter filter) |
public javax.mail.internet.MimeBodyPart build(AdaptrisMessage msg) throws java.lang.Exception
MimePartBuilder
build
in interface MimePartBuilder
java.lang.Exception
public MessageWrapper<byte[]> getBody()
public void setBody(MessageWrapper<byte[]> body)
body
- the location of the body for the mime part; the default if not specified is the payload as a byte-array.ByteArrayFromMetadata
,
ByteArrayFromObjectMetadata
,
ByteArrayFromPayload
public MetadataFilter getPartHeaderFilter()
public void setPartHeaderFilter(MetadataFilter filter)
filter
- the metadata filter.public java.lang.String getContentEncoding()
public void setContentEncoding(java.lang.String s)
Set the encoding of the mime part; if the mime part contains text you probably don't need to
specify this; any RFC2045 value is supported such as
base64,quoted-printable,uuencode,x-uuencode,x-uue,binary,7bit,8bit
and is passed
directly to MimeUtility#encode(java.io.OutputStream, String, String)
.
s
- the Content-Transfer-Encoding, which supports the %message{}
syntax to resolve
metadata, default is 'null', no encoding.public java.lang.String getContentType()
public void setContentType(java.lang.String s)
s
- the Content-Type, which supports the %message{}
syntax to resolve metadata; if
not specified defaults to application/octet-stream
public java.lang.String getContentId()
public void setContentId(java.lang.String s)
s
- the Content-ID, which supports the %message{}
syntax to resolve metadata;
defaults to a new GUID if no value is specified.public InlineMimePartBuilder withBody(MessageWrapper<byte[]> body)
public InlineMimePartBuilder withContentEncoding(java.lang.String s)
public InlineMimePartBuilder withContentId(java.lang.String s)
public InlineMimePartBuilder withContentType(java.lang.String s)
public InlineMimePartBuilder withPartHeaderFilter(MetadataFilter filter)