Re: [httpclient] Sending serialized object from httpclient to servlet.

Wendy Smoak <[email protected]>
Newsgroups gmane.comp.jakarta.commons.user,gmane.text.xml.commons.devel
Message-ID <[email protected]>
From: "Sanjeev Tripathi" <[email protected]>

> Can any one tell me how send serialized object to
> servlet from httpclient.

Colin already gave you one option, (base 64 encoding the binary data):
http://www.mail-archive.com/commons-dev%40jakarta.apache.org/msg57055.html

For general information on base 64 encoding:
http://www.google.com/search?q=java+base64+encoding

Here's Jakarta Commons Codec, which includes a base 64 encoder:
http://jakarta.apache.org/commons/codec/
http://jakarta.apache.org/commons/codec/apidocs/org/apache/commons/codec/binary/Base64.html

Without actually trying it, it looks like all you need to do is:
     byte[] encodedData = Base64.encodeBase64( binaryData );
Then turn the byte[] into a String and POST it to the server as the value of
a request parameter.  If it's not too big, it should work the same way as
sending a big string from a text area.

The 'commons-dev' list is usually reserved for questions about the
development of the libraries themselves, so I'm replying to commons-user
(and copying dev).

-- 
Wendy Smoak
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.