Package org.apache.http.entity.mime.content

Examples of org.apache.http.entity.mime.content.InputStreamBody


  @Override
  public Promise<Void> addAttachments(final URI attachmentsUri, final AttachmentInput... attachments) {
    final MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE, null, Charset.defaultCharset());
    for (final AttachmentInput attachmentInput : attachments) {
      entity.addPart(FILE_BODY_TYPE, new InputStreamBody(attachmentInput.getInputStream(), attachmentInput.getFilename()));
    }
    return postAttachments(attachmentsUri, entity);
  }
View Full Code Here


  }

  @Override
  public Promise<Void> addAttachment(final URI attachmentsUri, final InputStream inputStream, final String filename) {
    final MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
    entity.addPart(FILE_BODY_TYPE, new InputStreamBody(inputStream, filename));
    return postAttachments(attachmentsUri, entity);
  }
View Full Code Here

  @Override
  public Promise<Void> addAttachments(final URI attachmentsUri, final AttachmentInput... attachments) {
    final MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
    for (final AttachmentInput attachmentInput : attachments) {
      entity.addPart(FILE_BODY_TYPE, new InputStreamBody(attachmentInput.getInputStream(), attachmentInput.getFilename()));
    }
    return postAttachments(attachmentsUri, entity);
  }
View Full Code Here

    HttpPost post = new HttpPost(url.toURI());

    setupMethod(post, newHeaders);
    MultipartEntity entity = new MultipartEntity();

    InputStreamBody body = new InputStreamBody(content, filename);

    entity.addPart("file", body);
    post.setEntity(entity);
    HttpResponse response = execute(post);
    if (responseClass == null || response.getEntity() == null)
View Full Code Here

  }

  @Override
  public Promise<Void> addAttachment(final URI attachmentsUri, final InputStream inputStream, final String filename) {
    final MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE, null, Charset.defaultCharset());
    entity.addPart(FILE_BODY_TYPE, new InputStreamBody(inputStream, filename));
    return postAttachments(attachmentsUri, entity);
  }
View Full Code Here

  @Override
  public Promise<Void> addAttachments(final URI attachmentsUri, final AttachmentInput... attachments) {
    final MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE, null, Charset.defaultCharset());
    for (final AttachmentInput attachmentInput : attachments) {
      entity.addPart(FILE_BODY_TYPE, new InputStreamBody(attachmentInput.getInputStream(), attachmentInput.getFilename()));
    }
    return postAttachments(attachmentsUri, entity);
  }
View Full Code Here

            final String filename) {
        if (this.bodyParts == null) {
            this.bodyParts = new ArrayList<FormBodyPart>();
        }
        this.bodyParts.add(
                new FormBodyPart(name, new InputStreamBody(stream, contentType, filename)));
        return this;
    }
View Full Code Here

        final FormBodyPart p1 = new FormBodyPart(
                "field1",
                new FileBody(tmpfile));
        final FormBodyPart p2 = new FormBodyPart(
                "field2",
                new InputStreamBody(new FileInputStream(tmpfile), "file.tmp"));

        multipart.addBodyPart(p1);
        multipart.addBodyPart(p2);

        final ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

        final FormBodyPart p2 = new FormBodyPart(
                "field2",
                new FileBody(tmpfile, ContentType.create("text/plain", "ANSI_X3.4-1968"), "test-file"));
        final FormBodyPart p3 = new FormBodyPart(
                "field3",
                new InputStreamBody(new FileInputStream(tmpfile), "file.tmp"));

        multipart.addBodyPart(p1);
        multipart.addBodyPart(p2);
        multipart.addBodyPart(p3);
View Full Code Here

        }

        final HttpMultipart multipart = new HttpMultipart("form-data", Charset.forName("UTF-8"), "foo", HttpMultipartMode.BROWSER_COMPATIBLE);
        final FormBodyPart p1 = new FormBodyPart(
                "field1",
                new InputStreamBody(new FileInputStream(tmpfile), s1 + ".tmp"));
        final FormBodyPart p2 = new FormBodyPart(
                "field2",
                new InputStreamBody(new FileInputStream(tmpfile), s2 + ".tmp"));

        multipart.addBodyPart(p1);
        multipart.addBodyPart(p2);

        final ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

TOP

Related Classes of org.apache.http.entity.mime.content.InputStreamBody

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.