Hello All, I have 2 servlets on 2 different web servers. I want to pass two parameters between these servlets. One is an Object and other is a String. The processing at the second servlets will be based on the String variable passed. Also I want to use the POST method. If I use the URL Connection for establishing the connection how should I pass the parameters ? How should I retrieve the parameter at the other servlet ? I am thinking of using the ObjectOutputStream for passing the Object. Any suggestions would be welcome. Thanks for your time, ashutosh :roll:
Hey William, Thanks for the reply. I am using the URL Connection to write a Object from the WebServer 1 to the WebServer2. I have used the ObjectOutputStream for this. What i need to do now is to pass a byte Stream(which used the object passed to it above) that is generated at the WebServer2 to the WebServer1 . I tried to use the DataOutputStream, but for some reason I started getting a Socket Exception. I dont know why! So, i replaced the DataOutputStream with a ObjectOutputStream for writing the byte array which i have now put in another serialisable object. I am now able to retrieve the byte array from this object... Although I have achieved what i wanted i guess there should be a better way of communication between the 2 servers. I also looked at redirect but was not sure if i can pass a object parameter through this redirected call... Any suggestions would be most welcome.. Thanks, Ashutosh
Author and all-around good cowpoke
Joined: Mar 22, 2000
Using ObjectOutputStream to send a byte array should be very efficient, so it looks like you found a good solution.
I also looked at redirect but was not sure if i can pass a object parameter through this redirected call...
Passing anything significant in a redirect sounds pretty chancy to me. Bill