Consider MIME content data
for optimized binary storage as an attachment.
This method is called by JAXB marshal process when AttachmentMarshaller.isXOPPackage()
is
true
, for each element whose datatype is "base64Binary", as described in
Step 3 in
Creating XOP Packages.
The method implementor determines whether data
shall be attached separately
or inlined as base64Binary data. If the implementation chooses to optimize the storage
of the binary data as a MIME part, it is responsible for attaching data
to the
MIME-based package, and then assigning an unique content-id, cid, that identifies
the MIME part within the MIME message. This method returns the cid,
which enables the JAXB marshaller to marshal a XOP element that refers to that cid in place
of marshalling the binary data. When the method returns null, the JAXB marshaller
inlines data
as base64binary data.
The caller of this method is required to meet the following constraint.
If the element infoset item containing data
has the attribute
xmime:contentType
or if the JAXB property/field representing
data
is annotated with a known MIME type,
data.getContentType()
should be set to that MIME type.
The elementNamespace
and elementLocalName
parameters provide the
context that contains the binary data. This information could
be used by the MIME-based package processor to determine if the
binary data should be inlined or optimized as an attachment.
Returns:
a valid content-id URI (see RFC 2387) that identifies the attachment containing data
.
Otherwise, null if the attachment was not added and should instead be inlined in the message.
Parameters:
- data - represents the data to be attached. Must be non-null.
- elementNamespace - the namespace URI of the element that encloses the base64Binary data.
Can be empty but never null.
- elementLocalName - The local name of the element. Always a non-null valid string.
See Also:
XML-binary Optimized Packaging,
Describing Media Content of Binary Data in XML,