Java Code Examples for com.sun.xml.internal.messaging.saaj.util.ByteOutputStream#getBytes()

The following examples show how to use com.sun.xml.internal.messaging.saaj.util.ByteOutputStream#getBytes() . 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 TencentKona-8 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 2
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 3
Source File: AttachmentPartImpl.java    From jdk8u60 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 4
Source File: AttachmentPartImpl.java    From jdk8u60 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 5
Source File: AttachmentPartImpl.java    From openjdk-jdk8u 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 6
Source File: AttachmentPartImpl.java    From openjdk-jdk8u 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 7
Source File: AttachmentPartImpl.java    From openjdk-jdk8u-backup 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 8
Source File: AttachmentPartImpl.java    From openjdk-jdk8u-backup 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 9
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 10
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 11
Source File: AttachmentPartImpl.java    From openjdk-8-source 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 12
Source File: AttachmentPartImpl.java    From openjdk-8-source 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 13
Source File: AttachmentPartImpl.java    From openjdk-8 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 14
Source File: AttachmentPartImpl.java    From openjdk-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);
        }
    }
}