com.sun.xml.internal.ws.developer.StreamingDataHandler Java Examples

The following examples show how to use com.sun.xml.internal.ws.developer.StreamingDataHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MtomCodec.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
Example #2
Source File: MtomCodec.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
Example #3
Source File: MtomCodec.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
Example #4
Source File: MtomCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
Example #5
Source File: MtomCodec.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
Example #6
Source File: MtomCodec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
Example #7
Source File: MtomCodec.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
Example #8
Source File: MtomCodec.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
Example #9
Source File: SaajStaxWriterEx.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private String addBinaryText(DataHandler data) {
    String hrefOrCid = null;
    if (data instanceof StreamingDataHandler) {
        hrefOrCid = ((StreamingDataHandler) data).getHrefCid();
    }
    if (hrefOrCid == null) hrefOrCid = encodeCid();

    String prefixedCid = (hrefOrCid.startsWith("cid:")) ? hrefOrCid : "cid:" + hrefOrCid;
    // Should we do the threshold processing on DataHandler ? But that would be
    // expensive as DataHolder need to read the data again from its source
  //binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl) soap, prefixedCid, currentElement.getOwnerDocument(), data);
  //currentElement.appendChild(binaryText);
    if (currentElement instanceof MtomEnabled) {
        binaryText = ((MtomEnabled) currentElement).addBinaryText(prefixedCid, data);
    } else {
        throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
    }
    return hrefOrCid;
}
 
Example #10
Source File: MtomCodec.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}
 
Example #11
Source File: MtomCodec.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
ByteArrayBuffer(@NotNull DataHandler dh, String b) {
    this.dh = dh;
    String cid = null;
    if (dh instanceof StreamingDataHandler) {
        StreamingDataHandler sdh = (StreamingDataHandler) dh;
        if (sdh.getHrefCid() != null)
            cid = sdh.getHrefCid();
    }
    this.contentId = cid != null ? cid : encodeCid();
    boundary = b;
}
 
Example #12
Source File: MtomCodec.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
ByteArrayBuffer(@NotNull DataHandler dh, String b) {
    this.dh = dh;
    String cid = null;
    if (dh instanceof StreamingDataHandler) {
        StreamingDataHandler sdh = (StreamingDataHandler) dh;
        if (sdh.getHrefCid() != null)
            cid = sdh.getHrefCid();
    }
    this.contentId = cid != null ? cid : encodeCid();
    boundary = b;
}
 
Example #13
Source File: MtomCodec.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}
 
Example #14
Source File: MtomCodec.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
ByteArrayBuffer(@NotNull DataHandler dh, String b) {
    this.dh = dh;
    String cid = null;
    if (dh instanceof StreamingDataHandler) {
        StreamingDataHandler sdh = (StreamingDataHandler) dh;
        if (sdh.getHrefCid() != null)
            cid = sdh.getHrefCid();
    }
    this.contentId = cid != null ? cid : encodeCid();
    boundary = b;
}
 
Example #15
Source File: MtomCodec.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}
 
Example #16
Source File: MtomCodec.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
ByteArrayBuffer(@NotNull DataHandler dh, String b) {
    this.dh = dh;
    String cid = null;
    if (dh instanceof StreamingDataHandler) {
        StreamingDataHandler sdh = (StreamingDataHandler) dh;
        if (sdh.getHrefCid() != null)
            cid = sdh.getHrefCid();
    }
    this.contentId = cid != null ? cid : encodeCid();
    boundary = b;
}
 
Example #17
Source File: MtomCodec.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}
 
Example #18
Source File: MtomCodec.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
ByteArrayBuffer(@NotNull DataHandler dh, String b) {
    this.dh = dh;
    String cid = null;
    if (dh instanceof StreamingDataHandler) {
        StreamingDataHandler sdh = (StreamingDataHandler) dh;
        if (sdh.getHrefCid() != null)
            cid = sdh.getHrefCid();
    }
    this.contentId = cid != null ? cid : encodeCid();
    boundary = b;
}
 
Example #19
Source File: MtomCodec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}
 
Example #20
Source File: MtomCodec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
ByteArrayBuffer(@NotNull DataHandler dh, String b) {
    this.dh = dh;
    String cid = null;
    if (dh instanceof StreamingDataHandler) {
        StreamingDataHandler sdh = (StreamingDataHandler) dh;
        if (sdh.getHrefCid() != null)
            cid = sdh.getHrefCid();
    }
    this.contentId = cid != null ? cid : encodeCid();
    boundary = b;
}
 
Example #21
Source File: MtomCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}
 
Example #22
Source File: MtomCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
ByteArrayBuffer(@NotNull DataHandler dh, String b) {
    this.dh = dh;
    String cid = null;
    if (dh instanceof StreamingDataHandler) {
        StreamingDataHandler sdh = (StreamingDataHandler) dh;
        if (sdh.getHrefCid() != null)
            cid = sdh.getHrefCid();
    }
    this.contentId = cid != null ? cid : encodeCid();
    boundary = b;
}
 
Example #23
Source File: MtomCodec.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}
 
Example #24
Source File: MtomCodec.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
ByteArrayBuffer(@NotNull DataHandler dh, String b) {
    this.dh = dh;
    String cid = null;
    if (dh instanceof StreamingDataHandler) {
        StreamingDataHandler sdh = (StreamingDataHandler) dh;
        if (sdh.getHrefCid() != null)
            cid = sdh.getHrefCid();
    }
    this.contentId = cid != null ? cid : encodeCid();
    boundary = b;
}
 
Example #25
Source File: MtomCodec.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}