hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ossf...@dubioso.net>
Subject Re: [help] how to set an OutputStream to a POST request?
Date Sat, 23 Feb 2008 21:13:41 GMT

Micky(米其屁) wrote:
> I set the HttpEntity with my own object to HttpClient, the execute the post
> request.

Please be more specific. What do you mean with your own object?
Did you implement a custom HttpEntity? Do you use one of the
standard entities with your own file/byte array/string?
What do you mean with "set to HttpClient"? HttpEntities are set
on requests, which get executed at an HttpClient.

> But the server can't get the object I set.

Please be more specific. What does the server get? Is there an
error response? An exception? Unexpectedly closed connection?

> What I want to do is that only send a java object to the output stream of
> that http connection instead of setAttribute.

Where did you call setAttribute? If you want to serialize an
object, you have to use an ObjectOutputStream [1]. Either
serialize your object to a byte array which you can put into
a ByteArrayEntity [2], or implement your own entity that stores
the object and creates the ObjectOutputStream when writeTo [3]
is called.

hope that helps,

[1] http://java.sun.com/j2se/1.5.0/docs/api/java/io/ObjectOutputStream.html

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

View raw message