aoqi@0: /* aoqi@0: * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: package javax.xml.bind.attachment; aoqi@0: aoqi@0: import javax.activation.DataHandler; aoqi@0: aoqi@0: /** aoqi@0: *
Enables JAXB unmarshalling of a root document containing optimized binary data formats.
aoqi@0: * aoqi@0: *This API enables an efficient cooperative processing of optimized aoqi@0: * binary data formats between a JAXB 2.0 implementation and MIME-based package aoqi@0: * processor (MTOM/XOP and WS-I AP 1.0). JAXB unmarshals the body of a package, delegating the aoqi@0: * understanding of the packaging format being used to a MIME-based aoqi@0: * package processor that implements this abstract class.
aoqi@0: * aoqi@0: *This abstract class identifies if a package requires XOP processing, {@link #isXOPPackage()} and provides retrieval of binary content stored as attachments by content-id.
aoqi@0: * aoqi@0: *getAttachment*(String cid)
ref:swaRef
specified in
aoqi@0: * Section 4.4 Referencing Attachments from the SOAP Envelope
aoqi@0: * Lookup MIME content by content-id, cid
, and return as a {@link DataHandler}.
The returned DataHandler
instance must be configured
aoqi@0: * to meet the following required mapping constaint.
aoqi@0: *
aoqi@0: * Required Mappings between MIME and Java Types aoqi@0: * | |
---|---|
MIME Type | aoqi@0: *Java Type | aoqi@0: *
DataHandler.getContentType() |
aoqi@0: * instanceof DataHandler.getContent() |
aoqi@0: *
image/gif | aoqi@0: *java.awt.Image | aoqi@0: *
image/jpeg | aoqi@0: *java.awt.Image | aoqi@0: *
text/xml or application/xml | aoqi@0: *javax.xml.transform.Source | aoqi@0: *
xs:anyURI
datatype. If {@link #isXOPPackage()}
aoqi@0: * ==true
, it must be a valid URI per the cid:
URI scheme (see RFC 2387)
aoqi@0: *
aoqi@0: * @return
aoqi@0: * a {@link DataHandler} that represents the MIME attachment.
aoqi@0: *
aoqi@0: * @throws IllegalArgumentException if the attachment for the given cid is not found.
aoqi@0: */
aoqi@0: public abstract DataHandler getAttachmentAsDataHandler(String cid);
aoqi@0:
aoqi@0: /**
aoqi@0: * Retrieve the attachment identified by content-id, cid
, as a byte[]
xs:anyURI
datatype. If {@link #isXOPPackage()}
aoqi@0: * ==true
, it must be a valid URI per the cid:
URI scheme (see RFC 2387)
aoqi@0: *
aoqi@0: * @return byte[] representation of attachment identified by cid.
aoqi@0: *
aoqi@0: * @throws IllegalArgumentException if the attachment for the given cid is not found.
aoqi@0: */
aoqi@0: public abstract byte[] getAttachmentAsByteArray(String cid);
aoqi@0:
aoqi@0: /**
aoqi@0: * Read-only property that returns true if JAXB unmarshaller needs to perform XOP processing.
aoqi@0: * aoqi@0: *This method returns true
when the constraints specified
aoqi@0: * in Identifying XOP Documents are met.
aoqi@0: * This value must not change during the unmarshalling process.