Package javax.mail.internet

Examples of javax.mail.internet.MimeMultipart.writeTo()


    public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException {
        if (obj instanceof MimeMultipart) {
            MimeMultipart mp = (MimeMultipart) obj;
            try {
                mp.writeTo(os);
            } catch (MessagingException e) {
                throw (IOException) new IOException(e.getMessage()).initCause(e);
            }
        }
    }
View Full Code Here


            }
            formParameters = new ParameterMap(params);
         }

         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         parts.writeTo(baos);
         content = baos.toByteArray();
         contentType = parts.getContentType();
      }

      public ParameterMap getForm()
View Full Code Here

        }
        message.setContent(multiPart);
        message.saveChanges();
        try {
            multiPart.writeTo(outputStream);
        } catch(Exception e) {
            logger.error("Exception while writing multipart to output stream", e);
            outputStream.close();
            throw e;
        }
View Full Code Here

    public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException {
        if (obj instanceof MimeMultipart) {
            MimeMultipart mp = (MimeMultipart) obj;
            try {
                mp.writeTo(os);
            } catch (MessagingException e) {
                throw (IOException) new IOException(e.getMessage()).initCause(e);
            }
        }
    }
View Full Code Here

    if (hasAttachments()) {
      try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
       
        MimeMultipart multipart = multipart(atom);
        multipart.writeTo(baos);
       
        return new String(baos.toByteArray());
      } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
View Full Code Here

        mp.addBodyPart(new MimeBodyPart(headers,certs[i].getEncoded()));
      }
      if (log.isTraceEnabled()) {
        log.trace("content type: "+mp.getContentType());       
      }
      mp.writeTo(resp.getOutputStream());
      resp.flushBuffer();
    } catch (CertificateEncodingException e) {
      throw new ServletException(e);
    } catch (MessagingException e) {
      throw new ServletException(e);
View Full Code Here

    public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException {
        if (obj instanceof MimeMultipart) {
            MimeMultipart mp = (MimeMultipart) obj;
            try {
                mp.writeTo(os);
            } catch (MessagingException e) {
                throw (IOException) new IOException(e.getMessage()).initCause(e);
            }
        }
    }
View Full Code Here

    public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException {
        if (obj instanceof MimeMultipart) {
            MimeMultipart mp = (MimeMultipart) obj;
            try {
                mp.writeTo(os);
            } catch (MessagingException e) {
                throw (IOException) new IOException(e.getMessage()).initCause(e);
            }
        }
    }
View Full Code Here

    public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException {
        if (obj instanceof MimeMultipart) {
            MimeMultipart mp = (MimeMultipart) obj;
            try {
                mp.writeTo(os);
            } catch (MessagingException e) {
                throw (IOException) new IOException(e.getMessage()).initCause(e);
            }
        }
    }
View Full Code Here

       
        message.setContent(mp);
        // Compute the correct content type
        message.saveChanges();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        mp.writeTo(baos);
        String contentType = message.getContentType();
       
        InputStream in = new ByteArrayInputStream(baos.toByteArray());
        Attachments attachments;
        if (useFile) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.