blob: 219fe3cb5601f57e836973e8d20bca33fa9e25dd [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>AttachmentMarshaller</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AttachmentMarshaller";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li><a href="../../../../jakarta/xml/bind/attachment/AttachmentUnmarshaller.html" title="class in jakarta.xml.bind.attachment"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?jakarta/xml/bind/attachment/AttachmentMarshaller.html" target="_top">Frames</a></li>
<li><a href="AttachmentMarshaller.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">jakarta.xml.bind.attachment</div>
<h2 title="Class AttachmentMarshaller" class="title">Class AttachmentMarshaller</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>jakarta.xml.bind.attachment.AttachmentMarshaller</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public abstract class <span class="typeNameLabel">AttachmentMarshaller</span>
extends java.lang.Object</pre>
<div class="block"><p>Enable JAXB marshalling to optimize storage of binary data.
<p>This API enables an efficient cooperative creation of optimized
binary data formats between a JAXB marshalling process and a MIME-based package
processor. A JAXB implementation marshals the root body of a MIME-based package,
delegating the creation of referenceable MIME parts to
the MIME-based package processor that implements this abstraction.
<p>XOP processing is enabled when <a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#isXOPPackage--"><code>isXOPPackage()</code></a> is true.
See <a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#addMtomAttachment-DataHandler-java.lang.String-java.lang.String-"><code>addMtomAttachment(DataHandler, String, String)</code></a> for details.
<p>WS-I Attachment Profile 1.0 is supported by
<a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#addSwaRefAttachment-DataHandler-"><code>addSwaRefAttachment(DataHandler)</code></a> being called by the
marshaller for each JAXB property related to
{http://ws-i.org/profiles/basic/1.1/xsd}swaRef.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/xml/bind/Marshaller.html#setAttachmentMarshaller-jakarta.xml.bind.attachment.AttachmentMarshaller-"><code>Marshaller.setAttachmentMarshaller(AttachmentMarshaller)</code></a>,
<a href="http://www.w3.org/TR/2005/REC-xop10-20050125/">XML-binary Optimized Packaging</a>,
<a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html">WS-I Attachments Profile Version 1.0.</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#AttachmentMarshaller--">AttachmentMarshaller</a></span>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>abstract java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#addMtomAttachment-byte:A-int-int-java.lang.String-java.lang.String-java.lang.String-">addMtomAttachment</a></span>(byte[]&nbsp;data,
int&nbsp;offset,
int&nbsp;length,
java.lang.String&nbsp;mimeType,
java.lang.String&nbsp;elementNamespace,
java.lang.String&nbsp;elementLocalName)</code>
<div class="block">Consider binary <code>data</code> for optimized binary storage as an attachment.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>abstract java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#addMtomAttachment-DataHandler-java.lang.String-java.lang.String-">addMtomAttachment</a></span>(DataHandler&nbsp;data,
java.lang.String&nbsp;elementNamespace,
java.lang.String&nbsp;elementLocalName)</code>
<div class="block">Consider MIME content <code>data</code> for optimized binary storage as an attachment.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>abstract java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#addSwaRefAttachment-DataHandler-">addSwaRefAttachment</a></span>(DataHandler&nbsp;data)</code>
<div class="block">Add MIME <code>data</code> as an attachment and return attachment's content-id, cid.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#isXOPPackage--">isXOPPackage</a></span>()</code>
<div class="block">Read-only property that returns true if JAXB marshaller should enable XOP creation.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="AttachmentMarshaller--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>AttachmentMarshaller</h4>
<pre>public&nbsp;AttachmentMarshaller()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="addMtomAttachment-DataHandler-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addMtomAttachment</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;addMtomAttachment(DataHandler&nbsp;data,
java.lang.String&nbsp;elementNamespace,
java.lang.String&nbsp;elementLocalName)</pre>
<div class="block"><p>Consider MIME content <code>data</code> for optimized binary storage as an attachment.
<p>
This method is called by JAXB marshal process when <a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#isXOPPackage--"><code>isXOPPackage()</code></a> is
<code>true</code>, for each element whose datatype is "base64Binary", as described in
Step 3 in
<a href="http://www.w3.org/TR/2005/REC-xop10-20050125/#creating_xop_packages">Creating XOP Packages</a>.
<p>
The method implementor determines whether <code>data</code> 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 <code>data</code> 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 <code>data</code> as base64binary data.
<p>
The caller of this method is required to meet the following constraint.
If the element infoset item containing <code>data</code> has the attribute
<code>xmime:contentType</code> or if the JAXB property/field representing
<code>data</code> is annotated with a known MIME type,
<code>data.getContentType()</code> should be set to that MIME type.
<p>
The <code>elementNamespace</code> and <code>elementLocalName</code>
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.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - represents the data to be attached. Must be non-null.</dd>
<dd><code>elementNamespace</code> - the namespace URI of the element that encloses the base64Binary data.
Can be empty but never null.</dd>
<dd><code>elementLocalName</code> - The local name of the element. Always a non-null valid string.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a valid content-id URI (see <a href="http://www.w3.org/TR/xop10/#RFC2387">RFC 2387</a>) that identifies the attachment containing <code>data</code>.
Otherwise, null if the attachment was not added and should instead be inlined in the message.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://www.w3.org/TR/2005/REC-xop10-20050125/">XML-binary Optimized Packaging</a>,
<a href="http://www.w3.org/TR/xml-media-types/">Describing Media Content of Binary Data in XML</a></dd>
</dl>
</li>
</ul>
<a name="addMtomAttachment-byte:A-int-int-java.lang.String-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addMtomAttachment</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;addMtomAttachment(byte[]&nbsp;data,
int&nbsp;offset,
int&nbsp;length,
java.lang.String&nbsp;mimeType,
java.lang.String&nbsp;elementNamespace,
java.lang.String&nbsp;elementLocalName)</pre>
<div class="block"><p>Consider binary <code>data</code> for optimized binary storage as an attachment.
<p>Since content type is not known, the attachment's MIME content type must be set to "application/octet-stream".
<p>
The <code>elementNamespace</code> and <code>elementLocalName</code>
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.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - represents the data to be attached. Must be non-null. The actual data region is
specified by <code>(data,offset,length)</code> tuple.</dd>
<dd><code>offset</code> - The offset within the array of the first byte to be read;
must be non-negative and no larger than array.length</dd>
<dd><code>length</code> - The number of bytes to be read from the given array;
must be non-negative and no larger than array.length</dd>
<dd><code>mimeType</code> - If the data has an associated MIME type known to JAXB, that is passed
as this parameter. If none is known, "application/octet-stream".
This parameter may never be null.</dd>
<dd><code>elementNamespace</code> - the namespace URI of the element that encloses the base64Binary data.
Can be empty but never null.</dd>
<dd><code>elementLocalName</code> - The local name of the element. Always a non-null valid string.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>content-id URI, cid, to the attachment containing
<code>data</code> or null if data should be inlined.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html#addMtomAttachment-DataHandler-java.lang.String-java.lang.String-"><code>addMtomAttachment(DataHandler, String, String)</code></a></dd>
</dl>
</li>
</ul>
<a name="isXOPPackage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isXOPPackage</h4>
<pre>public&nbsp;boolean&nbsp;isXOPPackage()</pre>
<div class="block"><p>Read-only property that returns true if JAXB marshaller should enable XOP creation.
<p>This value must not change during the marshalling process. When this
value is true, the <code>addMtomAttachment(...)</code> method
is invoked when the appropriate binary datatypes are encountered by
the marshal process.
<p>Marshaller.marshal() must throw IllegalStateException if this value is <code>true</code>
and the XML content to be marshalled violates Step 1 in
<a href="http://www.w3.org/TR/2005/REC-xop10-20050125/#creating_xop_packages">Creating XOP Pacakges</a>
http://www.w3.org/TR/2005/REC-xop10-20050125/#creating_xop_packages.
<i>"Ensure the Original XML Infoset contains no element information item with a
[namespace name] of "http://www.w3.org/2004/08/xop/include" and a [local name] of Include"</i>
<p>When this method returns true and during the marshal process
at least one call to <code>addMtomAttachment(...)</code> returns
a content-id, the MIME-based package processor must label the
root part with the application/xop+xml media type as described in
Step 5 of
<a href="http://www.w3.org/TR/2005/REC-xop10-20050125/#creating_xop_packages">Creating XOP Pacakges</a>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true when MIME context is a XOP Package.</dd>
</dl>
</li>
</ul>
<a name="addSwaRefAttachment-DataHandler-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>addSwaRefAttachment</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;addSwaRefAttachment(DataHandler&nbsp;data)</pre>
<div class="block"><p>Add MIME <code>data</code> as an attachment and return attachment's content-id, cid.
<p>
This method is called by JAXB marshal process for each element/attribute typed as
{http://ws-i.org/profiles/basic/1.1/xsd}swaRef. The MIME-based package processor
implementing this method is responsible for attaching the specified data to a
MIME attachment, and generating a content-id, cid, that uniquely identifies the attachment
within the MIME-based package.
<p>Caller inserts the returned content-id, cid, into the XML content being marshalled.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - represents the data to be attached. Must be non-null.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>must be a valid URI used as cid. Must satisfy Conformance Requirement R2928 from
<a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html#Referencing_Attachments_from_the_SOAP_Envelope">WS-I Attachments Profile Version 1.0.</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li><a href="../../../../jakarta/xml/bind/attachment/AttachmentUnmarshaller.html" title="class in jakarta.xml.bind.attachment"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?jakarta/xml/bind/attachment/AttachmentMarshaller.html" target="_top">Frames</a></li>
<li><a href="AttachmentMarshaller.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>