Your serialisation method is almost the same as the com.oreilly.servlet.HttpMessage 
from
Jason Hunter's book except for the content type. I tried `application/octet-stream' and
still receive the FileNotFoundException trace.

I don't understand what the other bloke was on about. What difference between
`URLConnection' and `HttpURLConnection' ?

--

Peter Pilgrim
Welcome to the "Me Too" generation.



---------------------------------------- Message History 
----------------------------------------


From: [EMAIL PROTECTED] on 25/09/2000 18:29

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  Re: HTTP Tunnelling + Applet + Java Plug1.3 + Servlets 2.0



I too am using Applet+ Plugin+Servlets and this is how I have managed it:

Create a serialized object (by implementing Serializable) MyObj

The Applet contains the foll. code:

MyObj myobj = new MyObj();
try {
    URL url = new URL("http://localhost:8080/servlet/YourServlet");
    URLConnection con = url.openConnection();
    con.setUseCaches(false);
    con.setRequestProperty("CONTENT-TYPE", "application/octet-stream");
    con.setDoInput(true);
    con.setDoOutput(true);
    ObjectOutputStream os = new ObjectOutputStream(con.getOutputStream());
    os.writeObject(myobj);
    os.flush();
    os.close();

    /* read the object back in from the servlet: */
    ObjectInputStream is = new ObjectInputStream(con.getInputStream());
    MyObj newobj = (MyObj) is.readObject(con);
} catch.......


In the service method of YourServlet;
try {
    ObjectInputStream is = new ObjectInputStream(request.getInputStream());
    MyObj obj = (MyObj) is.getInputStream();

    // set values of obj

    response.setContentType("application/octet-stream");

    ObjectOutputStream os = new
ObjectOutputStream(response.getOutputStream());
    os.writeObject(obj);
    os.flush();
    os.close();
}

Go over each syntax and see if you have done anything different. Hope it



--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.

___________________________________________________________________________
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