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 Java Prog <ja...@gmail.com> on 2007/02/13 11:31:49 UTC

Sending data through stream

Dear all,
I would like to ask if it is possible to send Multipart request (using
post method - described in the documentation), but to supply
InputStream to the ByteArrayPartSource?

I would like to send data and avoid creating temp file, since data is
read from different source,
and available through InputStream.
In docs for HttpClient ByteArrayPartSource it says that this class
should be used only for data already loaded in memory (I would like to
minimize usage of the memory).

Is this possible at all and is there some example how to do this.

Regards,
JP

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


Re: Sending data through stream

Posted by Roland Weber <RO...@de.ibm.com>.
> I would like to ask if it is possible to send Multipart request (using
> post method - described in the documentation), but to supply
> InputStream to the ByteArrayPartSource?

No, it is not possible to supply an input stream to the 
ByteArrayPartSource.

> I would like to send data and avoid creating temp file, since data is
> read from different source,
> and available through InputStream.

Then you should implement your own PartSource.
See FilePartSource for an example.

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/multipart/PartSource.html
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/multipart/FilePartSource.html

hope that helps,
  Roland