Package javax.mail.internet

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


        headers.setHeader("Content-Disposition", contentDisposition);
        headers.setHeader("Content-Type", contentType);
        body.addBodyPart(new MimeBodyPart(headers, content ));

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        body.writeTo(bout);
        request.setContent(bout.toByteArray());
    }

    @Test
    public void testCreateLayerFromCopy() throws Exception {
View Full Code Here


      // If we have a body, we must preserve it, so use multipart/mixed encoding

      MimeMultipart multi = createMultiPartEntity(entity, request.getHeader(HEADER_CONTENT_TYPE), query);
      requestBuilder.setHeader(HEADER_CONTENT_TYPE, multi.getContentType());
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      multi.writeTo(os);
      requestBuilder.setEntity(ByteString.copy(os.toByteArray()));
    }

    // Set the base uri, supply the original method in the override header, and change method to POST
    requestBuilder.setURI(uri);
View Full Code Here

    multi.addBodyPart(partTwo);
    multi.addBodyPart(partOne);

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    multi.writeTo(os);

    // Create request with multi-part body and query args
    RestRequest request = new RestRequestBuilder(new URI("http://localhost:7279?args=xyz"))
        .setMethod("PUT")
        .setHeader("Content-Type", multi.getContentType())
View Full Code Here

    bodyPart.setText(sampleClinicalDocument);
    mimeMessage.addBodyPart(bodyPart);
   
    // send the MIME message into a ByteArrayOutputStream
    ByteArrayOutputStream byte1 = new ByteArrayOutputStream();
    mimeMessage.writeTo(byte1);

    // set the value of ED with the String
    ED encapsuledData = new ED(mdmMessage);

    encapsuledData.getTypeOfData().setValue("multipart");
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

         MimeMultipart mp = gen.generate(EnvelopedWriter.createBodyPart(providers, out));
         String contentType = mp.getContentType();
         contentType = contentType.replace("\r\n", "").replace("\t", " ");
         headers.putSingle("Content-Type", contentType);
         mp.writeTo(os);
      }
      catch (Exception e)
      {
         throw new WriterException(e);
      }
View Full Code Here

      mp.addBodyPart(bp);



      ByteArrayOutputStream os = new ByteArrayOutputStream();
      mp.writeTo(os);
      String s = new String(os.toByteArray());

      System.out.println(s);
      System.out.println("************");

 
View Full Code Here

      gen.addSignerInfoGenerator(signer);

      MimeMultipart mp = gen.generate(createMsg());

      ByteArrayOutputStream os = new ByteArrayOutputStream();
      mp.writeTo(os);

      ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
      String contentType = mp.getContentType();
      contentType = contentType.replace("\r\n", "").replace("\t", " ");
View Full Code Here

      SignerInfoGenerator signer = new JcaSimpleSignerInfoGeneratorBuilder().setProvider("BC").build("SHA1WITHRSA", privateKey, cert);
      gen.addSignerInfoGenerator(signer);

      MimeMultipart mp = gen.generate(createMsg());
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      mp.writeTo(os);
      String contentType = mp.getContentType();
      contentType = contentType.replace("\r\n", "").replace("\t", " ");
      System.out.println(contentType);
      String s = new String(os.toByteArray());
      StringBuilder builder = new StringBuilder();
View Full Code Here

      SignerInfoGenerator signer = new JcaSimpleSignerInfoGeneratorBuilder().setProvider("BC").build("SHA1WITHRSA", badKey, cert);
      gen.addSignerInfoGenerator(signer);

      MimeMultipart mp = gen.generate(createMsg());
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      mp.writeTo(os);
      String contentType = mp.getContentType();
      contentType = contentType.replace("\r\n", "").replace("\t", " ");
      System.out.println(contentType);
      String s = new String(os.toByteArray());
      StringBuilder builder = new StringBuilder();
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.