You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Martin Cooper <ma...@tumbleweed.com> on 2002/08/09 19:54:49 UTC

RE: HTTPClient - PostMethod.setRequstBody(File) requires boundari es?

+1

If I can get all my other itches dealt with first, I'd be glad to take a
look at this. The code that dims referenced needs a little work, but it's a
good start.

--
Martin Cooper


> -----Original Message-----
> From: Jeff Dever [mailto:jsdever@sympatico.ca]
> Sent: Friday, August 09, 2002 5:32 AM
> To: Jakarta Commons Developers List
> Subject: Re: HTTPClient - PostMethod.setRequstBody(File) requires
> boundaries?
> 
> 
> Any comments from anyone in adding multipart form data support to
> HttpClient?  Might be a good 2.1 feature.
> 
> 
> gunnar.ahlberg@ibs.se wrote:
> 
> >
> > Yes, this is what I was hoping for.. to allow multipart 
> messages with
> > file and text input sepearted by a boundary (this is how browser do)
> > Does anyone have any example code for how to do exactly that?
> > The problem with using QueryString is that I have to check for both
> > params and query string on the server side...
> >
> > /G
> >
> >
> >
> >  Jesper de Jong
>    <je...@yahoo.com>                  To:        Jakarta Commons
>                                Developers List
>    2002-08-09 13:47            <co...@jakarta.apache.org>
>    Please respond to "Jakarta          cc:
>    Commons Developers List"            Subject:        Re: 
> HTTPClient -
>                                PostMethod.setRequstBody(File) requires
>                                boundaries?
> >
> >
> >
> > Hello Gunnar,
> >
> > If you want to upload a file and possibly other form
> > parameters, the body of the message should be in
> > "application/form-data" format. See RFC 1867
> > (Form-based File Upload in HTML), available at
> > http://www.ietf.org.
> >
> > Jesper de Jong
> > jespdj@yahoo.com
> >
> > --- Jeff Dever <js...@sympatico.ca> wrote:
> > > Post parameters are www-url encoded and sent as the
> > > body.  Therefore, a
> > > request body and parameters are mutually exclusive.
> > > Perhaps you are
> > > needing to send a file and a query string?   The
> > > query string is sent as
> > > part of the url and can be used with a response
> > > body.
> > >
> > > setQueryString(String)
> > >     or
> > > setQueryString(NameValuePair[])
> > >
> > >
> > > gunnar.ahlberg@ibs.se wrote:
> > >
> > > >
> > > > Hi,
> > > >
> > > > I'm having trouble with posting files - I want to
> > > mimic the <form>
> > > > <input type="file"> </form> of html.
> > > >
> > > > The example PostXML seemed very promising and
> > > works for basic uploads,
> > > > however, it doesn't use additional parameters. I
> > > need to pass the file
> > > > + a couple of parameters. However, when the body
> > > is set, it's set.
> > > > There is no support for calling setRequestBody and
> > > the add.... This
> > > > only yields IllegalStateExceptions since the body
> > > is already
> > > > generated.
> > > >
> > > > Does this mean that I need to generate the whole
> > > request body with
> > > > boundaries and everything? Seems  a little to low
> > > level for my
> > > > taste...
> > > >
> > > > Thanks for your time.
> > > > /G
> > > >
> > > > Gunnar Ahlberg
> > > >
> > > > IBS R&D AB                    Telephone: 08-627 45
> > > 01
> > > > Box 1350                               Fax: 08-627
> > > 23 78
> > > > Hemvarnsgatan 8              E-mail:
> > > gunnar.ahlberg@ibs.se
> > > > 171 26 Solna
> > > http://www.ibs.se
> > > > Sweden
> > > >
> > > >
> > >
> > ----------------------------------------------------------------
> > > > --
> > > > To unsubscribe, e-mail:   <
> > > > mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > > > For additional commands, e-mail: <
> > > > mailto:commons-dev-help@jakarta.apache.org>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <ma...@jakarta.apache.org>
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > HotJobs - Search Thousands of New Jobs
> > http://www.hotjobs.com
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> >
> >
> >    ----------------------------------------------------------------
> > --
> > To unsubscribe, e-mail:   <
> > mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <
> > mailto:commons-dev-help@jakarta.apache.org>
> >
> 
> 
> --
> To unsubscribe, e-mail:   
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>