Hi Rob,
i must thank you for the code u have written. its working and helped me
a lot
Thanx
Akas

>----------
>From:  Rob Griffin[SMTP:[EMAIL PROTECTED]]
>Sent:  Tuesday, September 14, 1999 7:47 AM
>To:    [EMAIL PROTECTED]
>Subject:       Re: Applet-Servlet
>
>Hello,
>
>We are successfully sending objects from an applet to a servlet and
>vice
>versa.
>
>Here's a cut down version of the code:
>
>
>In the applet:
>
>        URLConnection urlConnection = (new URL("url
>goeshere")).openConnection();
>        urlConnection.setDoOutput(true);
>        urlConnection.setDoInput(true);
>        urlConnection.setRequestProperty
>("Content-Type","application/octet-stream");
>        urlConnection.setAllowUserInteraction(false);
>        urlConnection.setUseCaches(false);
>
>        ObjectOutputStream oos = new
>ObjectOutputStream(urlConnection.getOutputStream());
>        oos.writeObject(theObjectToSend);
>        oos.flush();
>        oos.close();
>
>        urlConnection.connect();
>
>        // only do this if you expect an object back
>        ObjectInputStream ois = new
>ObjectInputStream(urlConnection.getInputStream());
>        Object replyObject = ois.readObject();
>
>
>In the servlet:
>
>    public void doPost (HttpServletRequest httpRequest,
>HttpServletResponse
>httpResponse)
>    {
>        try
>        {
>            ObjectInputStream ois = new
>ObjectInputStream(httpRequest.getInputStream());
>            Object object = ois.readObject();
>
>            //... process object here
>
>            // send an object back here if required
>            httpResponse.setContentType("application/octet-stream");
>            ObjectOutputStream oos = new
>ObjectOutputStream(httpResponse.getOutputStream());
>            oos.writeObject(reply);
>
>        }
>        catch (Exception exception)
>        {
>            getServletContext().log("Exception reading object from HTTP
>stream = " + 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
>> Rajendra Mishra
>> Sent: Tuesday, 14 September 1999 11:11
>> To: [EMAIL PROTECTED]
>> Subject: Applet-Servlet
>>
>>
>> Hello,
>>     I am getting an exception in the servlet - EOF Exception
>> (something like...there is no header) when I do
>>     ObjectInptStream i = new ObjectInputStream(request.getInputStream());
>>
>>     But I am doing a writeObject(String) in the applet. I am also
>> doing setDoInput and setDoOutput to true as well as setting the
>> content-type to a java serializable object.
>>
>>     What am I mising here? Any help would be appreciated.
>> Thanks.
>
>________________________________________________________________________
>___
>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

Reply via email to