hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Glück <...@odi.ch>
Subject Re: PostMethod Vs MultipartPostMethod
Date Sun, 24 Jul 2005 17:35:20 GMT

If you want to include both a file and "form" parameters in a post 
request you must use Multipart MIME and send both entities as separate 
MIME parts.

Ortwin Glück

Kadlabalu, Hareesh wrote:
> Hello, 
> I am trying to use PostMethod for sending multipart data using
> PostMethod.setRequestEntity(..). I also want to conditionally add parameters
> to it (using PostMethod.addParameter(..) ). However if I call
> setRequestEntity() after calling addParameter(..), all parameters that are
> set earlier are cleared. If I call the other way around, both are retained.
> I searched the mail archives and came across a thread where it was suggested
> that one must use MultipartPostMethod and send add whatever parameters I
> would add as StringPart (along with any FilePart data).
> However, MultipartPostMethod is deprecated and suggests the users to use
> PostMethod instead. 
> Given that I want to both addParameter() and multipart data, which approach
> should I choose? It seems that for MultiPart posts, parameters are not
> preferred? Is there a change in HTTP specs that forces this?
> Thanks
> -Hareesh

To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org

View raw message