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

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


                  if(contentType==null) {
                    contentType = "application/octet-stream"; // default
                  }
                  String contentName = content.getName();
                  parts.add(new FormBodyPart(contentName,
                       new InputStreamBody(
                           content.getStream(),
                           contentType,
                           content.getName())));
                }
              }
View Full Code Here


                  if(contentType==null) {
                    contentType = "application/octet-stream"; // default
                  }
                  String contentName = content.getName();
                  parts.add(new FormBodyPart(contentName,
                       new InputStreamBody(
                           content.getStream(),
                           contentType,
                           content.getName())));
                }
              }
View Full Code Here

                  if(contentType==null) {
                    contentType = "application/octet-stream"; // default
                  }
                  String contentName = content.getName();
                  parts.add(new FormBodyPart(contentName,
                       new InputStreamBody(
                           content.getStream(),
                           contentType,
                           content.getName())));
                }
              }
View Full Code Here

    try {
      HttpPost post = new HttpPost("http://localhost:9998/controller/router");
      is = getClass().getResourceAsStream("/UploadTestFile.txt");

      MultipartEntityBuilder builder = MultipartEntityBuilder.create();
      ContentBody cbFile = new InputStreamBody(is,
          ContentType.create("text/plain"), "UploadTestFile.txt");
      builder.addPart("fileUpload", cbFile);
      builder.addPart("extTID", new StringBody("2", ContentType.DEFAULT_TEXT));
      builder.addPart("extAction", new StringBody("fileUploadController",
          ContentType.DEFAULT_TEXT));
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) return null;
View Full Code Here

        }
        if (me.getPart(KEY_CONTENT_MODIFIED_AT) == null) {
            me.addPart(KEY_CONTENT_MODIFIED_AT, new StringBody(date));
        }

        me.addPart(fileName, new InputStreamBody(inputStream, fileName));

        return me;
    }
View Full Code Here

    }

    private static MultipartEntityWithProgressListener getNewVersionMultipartEntity(final String name, final InputStream inputStream)
        throws UnsupportedEncodingException {
        MultipartEntityWithProgressListener me = new MultipartEntityWithProgressListener(HttpMultipartMode.BROWSER_COMPATIBLE);
        me.addPart(name, new InputStreamBody(inputStream, name));

        if (me.getPart(KEY_CONTENT_MODIFIED_AT) == null) {
            me.addPart(KEY_CONTENT_MODIFIED_AT, new StringBody(ISO8601DateParser.toString(new Date())));
        }
        return me;
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) return null;
View Full Code Here

        me.addBoxJSONStringEntityPart(METADATA, getMetadataBody(parentId, fileName));

        // The contents of the file should come after the part that specifies the parent folder id, so
        // that Box's infrastructure can efficiently stream the file to its final destination based on
        // the parent folder.
        me.addContentBodyPart(KEY_FILE_NAME, new InputStreamBody(inputStream, PLACEHOLDER_FILENAME));

        return me;
    }
View Full Code Here

    }

    private static MultipartEntityWithProgressListener getNewVersionMultipartEntity(final String name, final InputStream inputStream)
        throws UnsupportedEncodingException {
        MultipartEntityWithProgressListener me = new MultipartEntityWithProgressListener(HttpMultipartMode.BROWSER_COMPATIBLE);
        me.addContentBodyPart(KEY_FILE_NAME, new InputStreamBody(inputStream, PLACEHOLDER_FILENAME));

        return me;
    }
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.