Sudhir,
At the server side over ride the doPost method in your servlet and
deserialize
the object there. I believe calling setDoOutput(true) on the URLConnection
causes it to do a POST instead of a GET.
Here's some sample code:
public void doPost (HttpServletRequest httpRequest, HttpServletResponse
httpResponse)
{
try
{
ObjectInputStream ois = new
ObjectInputStream(httpRequest.getInputStream());
Object object = ois.readObject();
....etc.
// and send an object back if you want to
ObjectOutputStream oos = new
ObjectOutputStream(httpResponse.getOutputStream());
oos.writeObject(outgoing);
}
catch (Exception exception)
{
// report this exception
}
}
Hope this helps,
Rob Griffin
[EMAIL PROTECTED]
Quest Software Pty Ltd
303 High St, Ashburton, Vic. 3147 Australia
http://www.quest.com
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> A.Sudhir
> Sent: Tuesday, 17 August 1999 5:18
> To: [EMAIL PROTECTED]
> Subject: Question on Servlets Processing Methods Precedence
>
>
> Hi All,
> This might be a simple Question. But i am sure it helpful to many of
> us. Here is the sequence. I load a Applet on the Clients Browser. Then i
> create a new Object which implemens Serializable. Then i get the
> OutputStream for URLConnection to the Servlet. When i say WriteObject,
> then the request goes to the Servlet.
>
> Now at the Servlet side i noticed that processing of the request is done
> in the service(HttpServletRequest request, HttpServletResponse response)
> method the Servlet. Now instead of service if i use method
> doPost(HttpServletRequest request, HttpServletResponse response) then
> also the request get's processed and the client gets back the data.
>
> Can someone tell me the order or precedence in which these methods in
> servlet are called. Please not i am not using any Form. It's a simple
> URLConnection and writing Data from Applet. Here is the Sample Code
>
> At the Client Side
> ***************
>
> URL myUrl = new URL ("http://prithvi:8080/servlet/testServlet");
> URLConnection con = myUrl.openConnection();
>
> con.setDoInput(true);
> con.setDoOutput(true);
> con.setUseCaches(false);
> con.setDefaultUseCaches(false);
> con.setRequestProperty("Content-type",
> "application/octet-stream");
>
> ObjectOutputStream out = new
> ObjectOutputStream(con.getOutputStream());
> SBSRequest myObject = new SBSRequest(100);
>
> //passing a serialized object to the servlet
>
> out.writeObject(myObject);
> out.close();
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html