commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlos1.riv...@ps.ge.com
Subject How to send a serializable object as the request body
Date Thu, 16 Oct 2003 03:02:28 GMT

We are in the process of replacing the URLConnection class with HttpClient.
Currently we send serialized objects to a servlet with something similar to
the following code snippet:

	URL url = URL(hostURL.getProtocol(),
                                 hostURL.getHost(),
                                 hostURL.getPort(),
                                 "/servlet/TestServlet");
	URLConnection httpURLConnection = url.openConnection();
	out = new
ObjectOutputStream(httpURLConnection.getRequestOutputStream());

	out.writeObject(serializedObject);

           out.flush();
	out.close()

	-------------------------- (Meanwhile in the server)

	The servlet reads the serializedObject from the InputStream of the
HttpServletRequest parameter and sends the response in the 
	HttpServletResponse

	---------------------------(Back in the client)
	
	  in = new ObjectInputStream(
httpURLConnection.getResponseInputStream() );
	 result = in.readObject();
	in.close();

I have tried to accomplish the same technique with HttpClient, but I have
been unsuccessful.  Is this possible with this library?

Thank You
Carlos R.
 	


Carlos Javier Rivera Vazquez
Staff Engineer
GE Power Systems
Network Reliability Services
__________________________________________________



---------------------------------------------------------------------
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