You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Sanjeev Tripathi <sa...@parago.com> on 2005/02/09 17:03:42 UTC
RE: [httpclient] How to send and recieve Serialized Object using HttpClient
Sorry Wendy. But Thanks to you and Matt again. I didn't see Matt posting
before. But I used your way and SerializedUtil from Jakarta and it
worked fine. But I am still having one problem.
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.
Thanks.
Sanjeev Tripathi
-----Original Message-----
From: Wendy Smoak [mailto:java@wendysmoak.com]
Sent: Tuesday, February 08, 2005 6:49 PM
To: commons-user@jakarta.apache.org; Sanjeev Tripathi
Subject: Re: [httpclient] How to send and recieve Serialized Object
using HttpClient
From: "Sanjeev Tripathi" <sa...@parago.com>
> Can any one give me url for getting Base64OutputStream and
> Base64InputStream classes on google.
Did you see the reply on commons-user earlier today? (You're still
posting
to the 'dev' list.) Matt Goodwin posted code that gets you from an
object
to a base 64 encoded byte[].
You can see his message in the archives here:
http://www.mail-archive.com/commons-user%40jakarta.apache.org/msg10036.h
tml
Info on subscribing to commons-user is here:
http://jakarta.apache.org/site/mail2.html#Commons
--
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [httpclient] How to send and recieve Serialized Object using
HttpClient
Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Sanjeev Tripathi" <sa...@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