hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@lexmark.com
Subject Re: Advice please
Date Thu, 13 Jan 2005 17:47:10 GMT

Thanks.


Couple more questions, if you don't mind...

- any advantage/performance issues if I just do this instead?
                  post.setRequestBody(in);
                  post.setRequestContentLength(bytesToCome);

- I've just discovered that later on in the process, I will get blocks of
data sent through the InputStream, each preceeded with the number of bytes
to come.  How would you suggest I best handle that?  If I do what you
suggested below, will it send the whole content of the stream, including
the blocks?  Will it stream it across itself?  I guess, do I need to remove
the block information from the stream?

Sorry if this doesn't make sense!

cheers,

David





|---------+---------------------------->
|         |           Roland Weber     |
|         |           <ROLWEBER@de.ibm.|
|         |           com>             |
|         |                            |
|         |           01/13/2005 02:47 |
|         |           AM               |
|         |           Please respond to|
|         |           "HttpClient User |
|         |           Discussion"      |
|         |                            |
|---------+---------------------------->
  >-----------------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                                |
  |       To:       "HttpClient User Discussion" <httpclient-user@jakarta.apache.org>
                                    |
  |       cc:                                                                            
                                |
  |       Subject:  Re: Advice please                                                    
                                |
  >-----------------------------------------------------------------------------------------------------------------------|




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








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


Mime
View raw message