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 dh...@lexmark.com on 2005/01/12 22:36:21 UTC

Advice please

Hi,

I need to use HTTPClient to connect to a servlet, sending either XML, or
(possibly very large) binary data.

I have it working nicely with the XML, but am stuck with the binary data.
I receive the data as a stream, not a file, but can't see a way of sending
that (probably as multipart?).

Does anyone have any advice, please, on how to do this, and on the
performance issues I'll face with different ways of doing it?

thanks!

David




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


Re: Advice please

Posted by Roland Weber <RO...@de.ibm.com>.
Hello David,

you should implement the interface
org.apache.commons.httpclient.methods.multipart.PartSource
and create a
org.apache.commons.httpclient.methods.multipart.FilePart
from it.

If you don't know the length of the binary data, try returning
EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED
(I'm not sure about this).
If you can obtain the InputStream only once, throw an
exception if it is requested again.

cheers,
  Roland




dhay@lexmark.com 
12.01.2005 22:36
Please respond to
"HttpClient User Discussion"


To
httpclient-user@jakarta.apache.org
cc

Subject
Advice please







Hi,

I need to use HTTPClient to connect to a servlet, sending either XML, or
(possibly very large) binary data.

I have it working nicely with the XML, but am stuck with the binary data.
I receive the data as a stream, not a file, but can't see a way of sending
that (probably as multipart?).

Does anyone have any advice, please, on how to do this, and on the
performance issues I'll face with different ways of doing it?

thanks!

David




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