hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <o.kalnichev...@dplanet.ch>
Subject Re: File Upload
Date Thu, 13 Feb 2003 22:53:44 GMT

On Thu, 2003-02-13 at 22:47, Daniel Walsh wrote:
> > 2. Send the plain file as the request body. Look at the example
> > PostXML.java. On the server side you need only the request input stream.
> > That's it.
> Why would this method need to be limited to a plain text file, doesn't it
> just send the bytes?

PostMethod & PutMethod do just send raw bytes

> Also, I notice that the JavaDoc for the PostMethod's setRequestBody method
> states:
>   Once this method has been invoked, the request parameters cannot be
> altered until I am recycled.
> While the addParameter method states:
>     Throws:
>     java.lang.IllegalStateException - if my request body has already been
> generated.

addParameter & friends have been deprecated primarily because of this
problem. You might want to upgrade to the newest HttpClient nightly
build and use setRequestBody methods that the preferred way of setting
POST & PUT request content

> Is there a way of sending the file name with the file contents?  Or, would I
> need to revert back to sending the file name ahead of time and setting the
> name to a session attribute to be extracted when the file contents are later
> received?

You should probably use MultipartPostMethod

I hope this helps a bit


View raw message