• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serialization using Apache's HttpClient

 
Arnab Sahoo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Is it not possible to send and receive serialized data using Apache's HttpClient API? I can't find a way to get or send a stream.

Thanks
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please define serialized data. Are you talking about a stream of data ?

Please also change your name to reflect our naming standards

http://www.javaranch.com/name.jsp
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Angel Eyes", please check your private messages for an important administrative matter.
 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can send and receive stream using HttpClient.

PostMethod postMethod = new PostMethod(url);
postMethod.setRequestBody("your stream goes here");;
 
Arnab Sahoo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok here's the full story.
I want to serialize my objects and send them over to a server and get it's serialized data as well. But I keep getting an SSLHandshake exception.
Now my final problem is to get rid of this.
But, before I do this I have been told to not use URLConnection class (which is what I use right now). Apparently Java's own network classes aren't good (I have personally not seen any result to corroborate this).
So as step 1 I am trying to replace my code using URLConnection with HTTPClient, but for the life of me I can't find out how to serialize and deserialize the data.

Once I do this then I'll try to get rid of the SSLHandshake exception (I have no idea how to do this either).

Is URLConnection really as bad as people say? Or is that a myth?
 
Arnab Sahoo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@shivendra tripathi -- PostMethod's setRequestBody seems to take an array of NameValuePairs. NameValuePair seems to comprise only of strings. So how can I pass or send streams ?
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use RMI or EJB or Spring if you want to access serialized objects / make remote calls.

But I keep getting an SSLHandshake exception.


You are using a secure line to transfer the objects and the SSL layer is rejecting the handshake for some reason. The certificate might have expired or the common name is incorrect or something similar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!