Package com.sun.jersey.multipart

Examples of com.sun.jersey.multipart.MultiPart


    // just to avoid concurrency issues if this arg is mutable
    final ArrayList<AttachmentInput> myAttachments = Lists.newArrayList(attachments);
    invoke(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        final MultiPart multiPartInput = new MultiPart();
        for (AttachmentInput attachment : myAttachments) {
          BodyPart bp = new BodyPart(attachment.getInputStream(), MediaType.APPLICATION_OCTET_STREAM_TYPE);
          FormDataContentDisposition.FormDataContentDispositionBuilder dispositionBuilder =
              FormDataContentDisposition.name(FILE_ATTACHMENT_CONTROL_NAME);
          dispositionBuilder.fileName(attachment.getFilename());
          final FormDataContentDisposition formDataContentDisposition = dispositionBuilder.build();
          bp.setContentDisposition(formDataContentDisposition);
          multiPartInput.bodyPart(bp);
        }

        postFileMultiPart(multiPartInput, attachmentsUri);
        return null;
      }
View Full Code Here


  public void addAttachments(ProgressMonitor progressMonitor, final URI attachmentsUri, File... files) {
    final ArrayList<File> myFiles = Lists.newArrayList(files); // just to avoid concurrency issues if this arg is mutable
    invoke(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        final MultiPart multiPartInput = new MultiPart();
        for (File file : myFiles) {
          FileDataBodyPart fileDataBodyPart = new FileDataBodyPart(FILE_ATTACHMENT_CONTROL_NAME, file);
          multiPartInput.bodyPart(fileDataBodyPart);
        }
        postFileMultiPart(multiPartInput, attachmentsUri);
        return null;
      }
View Full Code Here

    // just to avoid concurrency issues if this arg is mutable
    final ArrayList<AttachmentInput> myAttachments = Lists.newArrayList(attachments);
    invoke(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        final MultiPart multiPartInput = new MultiPart();
        for (AttachmentInput attachment : myAttachments) {
          BodyPart bp = new BodyPart(attachment.getInputStream(), MediaType.APPLICATION_OCTET_STREAM_TYPE);
          FormDataContentDisposition.FormDataContentDispositionBuilder dispositionBuilder =
              FormDataContentDisposition.name(FILE_ATTACHMENT_CONTROL_NAME);
          dispositionBuilder.fileName(attachment.getFilename());
          final FormDataContentDisposition formDataContentDisposition = dispositionBuilder.build();
          bp.setContentDisposition(formDataContentDisposition);
          multiPartInput.bodyPart(bp);
        }

        postFileMultiPart(multiPartInput, attachmentsUri);
        return null;
      }
View Full Code Here

  public void addAttachments(ProgressMonitor progressMonitor, final URI attachmentsUri, File... files) {
    final ArrayList<File> myFiles = Lists.newArrayList(files); // just to avoid concurrency issues if this arg is mutable
    invoke(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        final MultiPart multiPartInput = new MultiPart();
        for (File file : myFiles) {
          FileDataBodyPart fileDataBodyPart = new FileDataBodyPart(FILE_ATTACHMENT_CONTROL_NAME, file);
          multiPartInput.bodyPart(fileDataBodyPart);
        }
        postFileMultiPart(multiPartInput, attachmentsUri);
        return null;
      }
View Full Code Here

TOP

Related Classes of com.sun.jersey.multipart.MultiPart

Copyright © 2018 www.massapicom. 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.