Created
August 28, 2013 16:41
-
-
Save slorber/6368183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RequestBuilder requestBuilder = new RequestBuilder("POST").setUrl("http://myUrl/multipartUploadEndpoint"); | |
MultipartBodyGeneratorFeeder bodyFeeder = MultipartBodyGeneratorFeeder.create(requestBuilder); | |
Request request = requestBuilder.build(); | |
ListenableFuture<Response> asyncRes = asyncHttpClient | |
.prepareRequest(request) | |
.execute(new AsyncCompletionHandlerBase()); | |
bodyFeeder.addBodyPart(new StringPart("param1", "x")) | |
.addBodyPart(new StringPart("param2", "y")) | |
.addBodyPart(new StringPart("param3", "z")) | |
.addBodyPart(new FilePart("file", inputStream)) | |
.feed(); | |
Response uploadResponse = asyncRes.get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment