hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: Invalid stream header
Date Thu, 29 Jun 2006 16:50:56 GMT
Hello sANTo,

your getting an exception on the server side from an
ObjectInputStream layered on top of a ByteArrayInputStream.
However I look at it, this has nothing to do with HttpClient
and is off-topic for this mailing list. Maybe your Hashtable
holds objects of a class that is unknown on the server side?

You are badly abusing the HTTP protocol by sending data in a
header instead of an entity (message body). If you have to
send data, in particular binary data, then use a POST or PUT
method. You can send binary data without string-encoding it.
The string en- and decoding is another potential source of
your problem. Have you debug-printed and compared the string
and the byte array on client and server side?

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/EntityEnclosingMethod.html
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/ByteArrayRequestEntity.html

Using an entity, you can stream the data directly through an
ObjectOutputStream instead of wasting memory for temporary
byte arrays and strings. That's not much of a difference for
the data sizes you mentioned in your mail, but I don't know
how big your tables will become.

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/RequestEntity.html


hope that helps,
  Roland

---------------------------------------------------------------------
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