You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "joh sar....." <eh...@gmail.com> on 2011/06/22 12:49:56 UTC
How to Send a HttpPost with a Mime which is a "mime4j.Message" type ?
Hi,
I'am writing because i don't find how to send a Mime which i construct
with the library mime4j.
I would like send this mime by means of a http post request. For this
i try to use httpmime.
I know that i can construct mime with httpmime but in my case I must
send a base64 body so body of httpmime doesn't work for that;
My question is : Does someone know (or give me clues) how to send the
mime (with base64 body) in a http Post request ?
For the moment, I have my beautiful Mime (type :mime4j.Message) which
is correct but i don't find lines of codes which send a mime in
HttpPost
thx by advance
message.setMultipart(multipart);
try {
??? I don't find this line ???
httpPost.setEntity(????);
response = httpClient.execute(httpPost);
HttpEntity httpEntity = response.getEntity();
line = EntityUtils.toString(httpEntity);
} catch (ParseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return line;
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: How to Send a HttpPost with a Mime which is a "mime4j.Message"
type ?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2011-06-22 at 12:49 +0200, joh sar..... wrote:
> Hi,
>
> I'am writing because i don't find how to send a Mime which i construct
> with the library mime4j.
> I would like send this mime by means of a http post request. For this
> i try to use httpmime.
>
> I know that i can construct mime with httpmime but in my case I must
> send a base64 body so body of httpmime doesn't work for that;
>
> My question is : Does someone know (or give me clues) how to send the
> mime (with base64 body) in a http Post request ?
>
> For the moment, I have my beautiful Mime (type :mime4j.Message) which
> is correct but i don't find lines of codes which send a mime in
> HttpPost
>
You need to implement a custom HttpEntity class that uses Multipart
implementation from mime4j internally instead of HttpMultipart provided
by HttpMime.
Hope this helps
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org