commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gunnar.ahlb...@ibs.se
Subject Re: HTTPClient - PostMethod.setRequstBody(File) requires boundaries?
Date Fri, 09 Aug 2002 12:22:25 GMT
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 <jespdj@yahoo.com>
2002-08-09 13:47
Please respond to "Jakarta Commons Developers List"

 
        To:     Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
        cc: 
        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 <jsdever@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: 
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>




Mime
View raw message