com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeBodyPart Java Examples

The following examples show how to use com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeBodyPart. 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: AttachmentPartImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void copyMimeHeaders(MimeBodyPart mbp, AttachmentPartImpl ap)
    throws SOAPException {
    try {
        List hdr = mbp.getAllHeaders();
        int sz = hdr.size();
        for( int i=0; i<sz; i++ ) {
            Header h = (Header)hdr.get(i);
            if(h.getName().equalsIgnoreCase("Content-Type"))
                continue;   // skip
            ap.addMimeHeader(h.getName(), h.getValue());
        }
    } catch (Exception ex) {
        log.severe("SAAJ0506.soap.cannot.copy.mime.hdrs.into.attachment");
        throw new SOAPExceptionImpl(
            "Unable to copy MIME headers into attachment",
            ex);
    }
}
 
Example #2
Source File: AttachmentPartImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
MimeBodyPart getMimePart() throws SOAPException {
    try {
        if (this.mimePart != null) {
            return new MimeBodyPart(mimePart);
        }
        if (rawContent != null) {
            copyMimeHeaders(headers, rawContent);
            return rawContent;
        }

        MimeBodyPart envelope = new MimeBodyPart();

        envelope.setDataHandler(dataHandler);
        copyMimeHeaders(headers, envelope);

        return envelope;
    } catch (Exception ex) {
        log.severe("SAAJ0504.soap.cannot.externalize.attachment");
        throw new SOAPExceptionImpl("Unable to externalize attachment", ex);
    }
}
 
Example #3
Source File: AttachmentPartImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void setRawContentBytes(
    byte[] content, int off, int len, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    if (content == null) {
        throw new SOAPExceptionImpl("Null content passed to setRawContentBytes");
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        rawContent = new MimeBodyPart(hdrs, content, off, len);
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE,
            "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    }
}
 
Example #4
Source File: AttachmentPartImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void copyMimeHeaders(MimeBodyPart mbp, AttachmentPartImpl ap)
    throws SOAPException {
    try {
        List hdr = mbp.getAllHeaders();
        int sz = hdr.size();
        for( int i=0; i<sz; i++ ) {
            Header h = (Header)hdr.get(i);
            if(h.getName().equalsIgnoreCase("Content-Type"))
                continue;   // skip
            ap.addMimeHeader(h.getName(), h.getValue());
        }
    } catch (Exception ex) {
        log.severe("SAAJ0506.soap.cannot.copy.mime.hdrs.into.attachment");
        throw new SOAPExceptionImpl(
            "Unable to copy MIME headers into attachment",
            ex);
    }
}
 
Example #5
Source File: AttachmentPartImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
MimeBodyPart getMimePart() throws SOAPException {
    try {
        if (this.mimePart != null) {
            return new MimeBodyPart(mimePart);
        }
        if (rawContent != null) {
            copyMimeHeaders(headers, rawContent);
            return rawContent;
        }

        MimeBodyPart envelope = new MimeBodyPart();

        envelope.setDataHandler(dataHandler);
        copyMimeHeaders(headers, envelope);

        return envelope;
    } catch (Exception ex) {
        log.severe("SAAJ0504.soap.cannot.externalize.attachment");
        throw new SOAPExceptionImpl("Unable to externalize attachment", ex);
    }
}
 
Example #6
Source File: AttachmentPartImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void setRawContentBytes(
    byte[] content, int off, int len, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    if (content == null) {
        throw new SOAPExceptionImpl("Null content passed to setRawContentBytes");
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        rawContent = new MimeBodyPart(hdrs, content, off, len);
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE,
            "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    }
}
 
Example #7
Source File: AttachmentPartImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void copyMimeHeaders(MimeBodyPart mbp, AttachmentPartImpl ap)
    throws SOAPException {
    try {
        List hdr = mbp.getAllHeaders();
        int sz = hdr.size();
        for( int i=0; i<sz; i++ ) {
            Header h = (Header)hdr.get(i);
            if(h.getName().equalsIgnoreCase("Content-Type"))
                continue;   // skip
            ap.addMimeHeader(h.getName(), h.getValue());
        }
    } catch (Exception ex) {
        log.severe("SAAJ0506.soap.cannot.copy.mime.hdrs.into.attachment");
        throw new SOAPExceptionImpl(
            "Unable to copy MIME headers into attachment",
            ex);
    }
}
 
Example #8
Source File: AttachmentPartImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
MimeBodyPart getMimePart() throws SOAPException {
    try {
        if (this.mimePart != null) {
            return new MimeBodyPart(mimePart);
        }
        if (rawContent != null) {
            copyMimeHeaders(headers, rawContent);
            return rawContent;
        }

        MimeBodyPart envelope = new MimeBodyPart();

        envelope.setDataHandler(dataHandler);
        copyMimeHeaders(headers, envelope);

        return envelope;
    } catch (Exception ex) {
        log.severe("SAAJ0504.soap.cannot.externalize.attachment");
        throw new SOAPExceptionImpl("Unable to externalize attachment", ex);
    }
}
 
Example #9
Source File: AttachmentPartImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void copyMimeHeaders(MimeBodyPart mbp, AttachmentPartImpl ap)
    throws SOAPException {
    try {
        List hdr = mbp.getAllHeaders();
        int sz = hdr.size();
        for( int i=0; i<sz; i++ ) {
            Header h = (Header)hdr.get(i);
            if(h.getName().equalsIgnoreCase("Content-Type"))
                continue;   // skip
            ap.addMimeHeader(h.getName(), h.getValue());
        }
    } catch (Exception ex) {
        log.severe("SAAJ0506.soap.cannot.copy.mime.hdrs.into.attachment");
        throw new SOAPExceptionImpl(
            "Unable to copy MIME headers into attachment",
            ex);
    }
}
 
Example #10
Source File: AttachmentPartImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setRawContentBytes(
    byte[] content, int off, int len, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    if (content == null) {
        throw new SOAPExceptionImpl("Null content passed to setRawContentBytes");
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        rawContent = new MimeBodyPart(hdrs, content, off, len);
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE,
            "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    }
}
 
Example #11
Source File: AttachmentPartImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void copyMimeHeaders(MimeBodyPart mbp, AttachmentPartImpl ap)
    throws SOAPException {
    try {
        List hdr = mbp.getAllHeaders();
        int sz = hdr.size();
        for( int i=0; i<sz; i++ ) {
            Header h = (Header)hdr.get(i);
            if(h.getName().equalsIgnoreCase("Content-Type"))
                continue;   // skip
            ap.addMimeHeader(h.getName(), h.getValue());
        }
    } catch (Exception ex) {
        log.severe("SAAJ0506.soap.cannot.copy.mime.hdrs.into.attachment");
        throw new SOAPExceptionImpl(
            "Unable to copy MIME headers into attachment",
            ex);
    }
}
 
Example #12
Source File: AttachmentPartImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
MimeBodyPart getMimePart() throws SOAPException {
    try {
        if (this.mimePart != null) {
            return new MimeBodyPart(mimePart);
        }
        if (rawContent != null) {
            copyMimeHeaders(headers, rawContent);
            return rawContent;
        }

        MimeBodyPart envelope = new MimeBodyPart();

        envelope.setDataHandler(dataHandler);
        copyMimeHeaders(headers, envelope);

        return envelope;
    } catch (Exception ex) {
        log.severe("SAAJ0504.soap.cannot.externalize.attachment");
        throw new SOAPExceptionImpl("Unable to externalize attachment", ex);
    }
}
 
Example #13
Source File: AttachmentPartImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void setRawContentBytes(
    byte[] content, int off, int len, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    if (content == null) {
        throw new SOAPExceptionImpl("Null content passed to setRawContentBytes");
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        rawContent = new MimeBodyPart(hdrs, content, off, len);
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE,
            "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    }
}
 
Example #14
Source File: AttachmentPartImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
MimeBodyPart getMimePart() throws SOAPException {
    try {
        if (this.mimePart != null) {
            return new MimeBodyPart(mimePart);
        }
        if (rawContent != null) {
            copyMimeHeaders(headers, rawContent);
            return rawContent;
        }

        MimeBodyPart envelope = new MimeBodyPart();

        envelope.setDataHandler(dataHandler);
        copyMimeHeaders(headers, envelope);

        return envelope;
    } catch (Exception ex) {
        log.severe("SAAJ0504.soap.cannot.externalize.attachment");
        throw new SOAPExceptionImpl("Unable to externalize attachment", ex);
    }
}
 
Example #15
Source File: AttachmentPartImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void setRawContentBytes(
    byte[] content, int off, int len, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    if (content == null) {
        throw new SOAPExceptionImpl("Null content passed to setRawContentBytes");
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        rawContent = new MimeBodyPart(hdrs, content, off, len);
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE,
            "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    }
}
 
Example #16
Source File: AttachmentPartImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void copyMimeHeaders(MimeBodyPart mbp, AttachmentPartImpl ap)
    throws SOAPException {
    try {
        List hdr = mbp.getAllHeaders();
        int sz = hdr.size();
        for( int i=0; i<sz; i++ ) {
            Header h = (Header)hdr.get(i);
            if(h.getName().equalsIgnoreCase("Content-Type"))
                continue;   // skip
            ap.addMimeHeader(h.getName(), h.getValue());
        }
    } catch (Exception ex) {
        log.severe("SAAJ0506.soap.cannot.copy.mime.hdrs.into.attachment");
        throw new SOAPExceptionImpl(
            "Unable to copy MIME headers into attachment",
            ex);
    }
}
 
Example #17
Source File: AttachmentPartImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
MimeBodyPart getMimePart() throws SOAPException {
    try {
        if (this.mimePart != null) {
            return new MimeBodyPart(mimePart);
        }
        if (rawContent != null) {
            copyMimeHeaders(headers, rawContent);
            return rawContent;
        }

        MimeBodyPart envelope = new MimeBodyPart();

        envelope.setDataHandler(dataHandler);
        copyMimeHeaders(headers, envelope);

        return envelope;
    } catch (Exception ex) {
        log.severe("SAAJ0504.soap.cannot.externalize.attachment");
        throw new SOAPExceptionImpl("Unable to externalize attachment", ex);
    }
}
 
Example #18
Source File: AttachmentPartImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void copyMimeHeaders(MimeBodyPart mbp, AttachmentPartImpl ap)
    throws SOAPException {
    try {
        List hdr = mbp.getAllHeaders();
        int sz = hdr.size();
        for( int i=0; i<sz; i++ ) {
            Header h = (Header)hdr.get(i);
            if(h.getName().equalsIgnoreCase("Content-Type"))
                continue;   // skip
            ap.addMimeHeader(h.getName(), h.getValue());
        }
    } catch (Exception ex) {
        log.severe("SAAJ0506.soap.cannot.copy.mime.hdrs.into.attachment");
        throw new SOAPExceptionImpl(
            "Unable to copy MIME headers into attachment",
            ex);
    }
}
 
Example #19
Source File: AttachmentPartImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
MimeBodyPart getMimePart() throws SOAPException {
    try {
        if (this.mimePart != null) {
            return new MimeBodyPart(mimePart);
        }
        if (rawContent != null) {
            copyMimeHeaders(headers, rawContent);
            return rawContent;
        }

        MimeBodyPart envelope = new MimeBodyPart();

        envelope.setDataHandler(dataHandler);
        copyMimeHeaders(headers, envelope);

        return envelope;
    } catch (Exception ex) {
        log.severe("SAAJ0504.soap.cannot.externalize.attachment");
        throw new SOAPExceptionImpl("Unable to externalize attachment", ex);
    }
}
 
Example #20
Source File: AttachmentPartImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
MimeBodyPart getMimePart() throws SOAPException {
    try {
        if (this.mimePart != null) {
            return new MimeBodyPart(mimePart);
        }
        if (rawContent != null) {
            copyMimeHeaders(headers, rawContent);
            return rawContent;
        }

        MimeBodyPart envelope = new MimeBodyPart();

        envelope.setDataHandler(dataHandler);
        copyMimeHeaders(headers, envelope);

        return envelope;
    } catch (Exception ex) {
        log.severe("SAAJ0504.soap.cannot.externalize.attachment");
        throw new SOAPExceptionImpl("Unable to externalize attachment", ex);
    }
}
 
Example #21
Source File: AttachmentPartImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void setRawContentBytes(
    byte[] content, int off, int len, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    if (content == null) {
        throw new SOAPExceptionImpl("Null content passed to setRawContentBytes");
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        rawContent = new MimeBodyPart(hdrs, content, off, len);
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE,
            "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    }
}
 
Example #22
Source File: AttachmentPartImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void copyMimeHeaders(MimeBodyPart mbp, AttachmentPartImpl ap)
    throws SOAPException {
    try {
        List hdr = mbp.getAllHeaders();
        int sz = hdr.size();
        for( int i=0; i<sz; i++ ) {
            Header h = (Header)hdr.get(i);
            if(h.getName().equalsIgnoreCase("Content-Type"))
                continue;   // skip
            ap.addMimeHeader(h.getName(), h.getValue());
        }
    } catch (Exception ex) {
        log.severe("SAAJ0506.soap.cannot.copy.mime.hdrs.into.attachment");
        throw new SOAPExceptionImpl(
            "Unable to copy MIME headers into attachment",
            ex);
    }
}
 
Example #23
Source File: AttachmentPartImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void setRawContentBytes(
    byte[] content, int off, int len, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    if (content == null) {
        throw new SOAPExceptionImpl("Null content passed to setRawContentBytes");
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        rawContent = new MimeBodyPart(hdrs, content, off, len);
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE,
            "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    }
}
 
Example #24
Source File: AttachmentPartImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void setRawContentBytes(
    byte[] content, int off, int len, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    if (content == null) {
        throw new SOAPExceptionImpl("Null content passed to setRawContentBytes");
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        rawContent = new MimeBodyPart(hdrs, content, off, len);
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE,
            "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    }
}
 
Example #25
Source File: AttachmentPartImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void setRawContent(InputStream content, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart
        // Ctor with inputStream causes problems based on whether the InputStream has
        // markSupported()==true or false
        ByteOutputStream bos = new ByteOutputStream();
        bos.write(content);
        rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount());
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    } finally {
        try {
            content.close();
        } catch (IOException ex) {
            throw new SOAPException(ex);
        }
    }
}
 
Example #26
Source File: AttachmentPartImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public  void setBase64Content(InputStream content, String contentType)
    throws SOAPException {

    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    dataHandler = null;
    InputStream decoded = null;
    try {
        decoded = MimeUtility.decode(content, "base64");
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart
        // Ctor with inputStream causes problems based on the InputStream
        // has markSupported()==true
        ByteOutputStream bos = new ByteOutputStream();
        bos.write(decoded);
        rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount());
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    } finally {
        try {
                decoded.close();
        } catch (IOException ex) {
            throw new SOAPException(ex);
        }
    }
}
 
Example #27
Source File: AttachmentPartImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void setRawContent(InputStream content, String contentType)
    throws SOAPException {
    if (mimePart != null) {
        mimePart.close();
        mimePart = null;
    }
    dataHandler = null;
    try {
        InternetHeaders hdrs = new InternetHeaders();
        hdrs.setHeader("Content-Type", contentType);
        //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart
        // Ctor with inputStream causes problems based on whether the InputStream has
        // markSupported()==true or false
        ByteOutputStream bos = new ByteOutputStream();
        bos.write(content);
        rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount());
        setMimeHeader("Content-Type", contentType);
    } catch (Exception e) {
        log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e);
        throw new SOAPExceptionImpl(e.getLocalizedMessage());
    } finally {
        try {
            content.close();
        } catch (IOException ex) {
            throw new SOAPException(ex);
        }
    }
}
 
Example #28
Source File: AttachmentPartImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void copyMimeHeaders(MimeHeaders headers, MimeBodyPart mbp)
    throws SOAPException {

    Iterator i = headers.getAllHeaders();

    while (i.hasNext())
        try {
            MimeHeader mh = (MimeHeader) i.next();

            mbp.setHeader(mh.getName(), mh.getValue());
        } catch (Exception ex) {
            log.severe("SAAJ0505.soap.cannot.copy.mime.hdr");
            throw new SOAPExceptionImpl("Unable to copy MIME header", ex);
        }
}
 
Example #29
Source File: AttachmentPartImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void copyMimeHeaders(MimeHeaders headers, MimeBodyPart mbp)
    throws SOAPException {

    Iterator i = headers.getAllHeaders();

    while (i.hasNext())
        try {
            MimeHeader mh = (MimeHeader) i.next();

            mbp.setHeader(mh.getName(), mh.getValue());
        } catch (Exception ex) {
            log.severe("SAAJ0505.soap.cannot.copy.mime.hdr");
            throw new SOAPExceptionImpl("Unable to copy MIME header", ex);
        }
}
 
Example #30
Source File: AttachmentPartImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void copyMimeHeaders(MimeHeaders headers, MimeBodyPart mbp)
    throws SOAPException {

    Iterator i = headers.getAllHeaders();

    while (i.hasNext())
        try {
            MimeHeader mh = (MimeHeader) i.next();

            mbp.setHeader(mh.getName(), mh.getValue());
        } catch (Exception ex) {
            log.severe("SAAJ0505.soap.cannot.copy.mime.hdr");
            throw new SOAPExceptionImpl("Unable to copy MIME header", ex);
        }
}