GitHub user Slikey opened a pull request:
https://github.com/apache/httpclient/pull/36
Allow usage of MultipartFormEntity in HttpAsyncClient.
There currently is only a workaround for the usage of MultipartFormEntity
which requires sending the binary data of the MultipartFormEntity to a
NByteArrayEntity. Actually I couldn't get this workaround working and it
appears to not capture all part of the purpose of MultipartFormEntity.
See:
http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201311.mbox/%3C13034392.132.1384195516775.JavaMail.Hal@Harold-Rosenbergs-MacBook-Pro.local%3E
This fix allows the usage of the MultipartFormEntity in the HttpAsyncClient
because it calls #getContent() instead of #writeTo().
See people who have a similar problem:
http://stackoverflow.com/questions/4720077/how-can-i-see-the-content-of-a-multipartform-request
https://github.com/Mashape/unirest-java/issues/31
Something I want to point out is this quote: "That's the problem with
trying to mix an asynchronous transport with an inherently blocking content
producer. MultipartFormEntity can only produce its content using #writeTo
method and cannot be used asynchronously. You basically have two options. (1)
Write out entity content to ByteArrayOutputStream (or similar) and then create
NByteArrayEntity using the resultant byte array. (2) Create multipart entity
implementation that can produce its content asynchronously. " - Source:
http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201311.mbox/%3C13034392.132.1384195516775.JavaMail.Hal@Harold-Rosenbergs-MacBook-Pro.local%3E
I'd like to get some discussion going on this approach and end up having a
solution to this problem because I had to recreate part of the HttpMime in my
project to support MultipartFormEntity in my HttpAsyncClient.
Thank you for reading!
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Slikey/httpclient trunk
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/httpclient/pull/36.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #36
----
commit 7605310c2ddde28766b644d1a4a36a82bff041c2
Author: Slikey <[email protected]>
Date: 2015-10-12T00:01:00Z
Allow usage of MultipartFormEntity in HttpAsyncClient.
There currently is only a workaround for the usage of MultipartFormEntity
which requires sending the binary data of the MultipartFormEntity to a
NByteArrayEntity. Actually I couldn't get this workaround working and it
appears to not capture all part of the purpose of MultipartFormEntity.
See:
http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201311.mbox/%3C13034392.132.1384195516775.JavaMail.Hal@Harold-Rosenbergs-MacBook-Pro.local%3E
This fix allows the usage of the MultipartFormEntity in the HttpAsyncClient
because it calls #getContent() instead of #writeTo().
See people who have a similar problem:
http://stackoverflow.com/questions/4720077/how-can-i-see-the-content-of-a-multipartform-request
https://github.com/Mashape/unirest-java/issues/31
Something I want to point out is this quote: "That's the problem with
trying to mix an asynchronous transport with an inherently blocking content
producer. MultipartFormEntity can only produce its content using #writeTo
method and cannot be used asynchronously. You basically have two options. (1)
Write out entity content to ByteArrayOutputStream (or similar) and then create
NByteArrayEntity using the resultant byte array. (2) Create multipart entity
implementation that can produce its content asynchronously. " - Source:
http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201311.mbox/%3C13034392.132.1384195516775.JavaMail.Hal@Harold-Rosenbergs-MacBook-Pro.local%3E
I'd like to get some discussion going on this approach and end up having a
solution to this problem because I had to recreate part of the HttpMime in my
project to support MultipartFormEntity in my HttpAsyncClient.
Thank you for reading!
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]