commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjeev Tripathi" <sanjeev.tripa...@parago.com>
Subject RE: [httpclient] How to send and recieve Serialized Object usingHttpClient
Date Wed, 09 Feb 2005 16:54:18 GMT
Actually request parameter that I set in HttpCleint I can use in servlet
But
There is no way (or at least I don't know) to retrieve request
attribute/parameter in http client those set in servlet. This is very
simple in jsp but in http client I need to write object to
outputstream{ObjectOutputStream oos = new
ObjectOutputStream(response.getOutputStream())}

To work this I need to set content type as follows

response.setContentType("application/octet-stream");

I don't want to set content type "application/octet-stream" that's our
goal.

Every thing is fine in client side.

Thanks.
Sanjeev Tripathi


-----Original Message-----
From: Wendy Smoak [mailto:java@wendysmoak.com] 
Sent: Wednesday, February 09, 2005 10:23 AM
To: Sanjeev Tripathi; commons-user@jakarta.apache.org
Subject: Re: [httpclient] How to send and recieve Serialized Object
usingHttpClient

From: "Sanjeev Tripathi" <sanjeev.tripathi@parago.com>
> I am able to send object as string same way as you suggested from http
> client but from servlet I still need to use content type to
> "application/octet-stream" to receive object in httpclient side but I
> want to use content type "text/plain" in servlet.
> If I write object as byte on respose that object I am not able to
receive.
> It is giving "invalid header" error in http client side. But I will
try
> Matt's way and let you know.

If you post the code you're using, someone can probably help.  I'm quite
lost by now trying to remember who suggested what.

If you're getting all the way to the base64 encoded byte[], can't you
turn
it into a String and then use that as the value of a request parameter
for
the POST?  Wasn't that the original goal, to serialize an object,
base-64
encode the binary data, and send it to the server as text?

If so, there's a String constructor that takes a byte[], (and you can
specify the charset if necessary).

HTH,
-- 
Wendy Smoak


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


Mime
View raw message