ClassCast Exception in Cookie.saveCookie

I've been trying to get some of my servlets working with the new beta1
release
and I'm running into a problem when I try to save a cookie using the
Cookie.saveCookie() call. My servlets and the Sun "Counter" demo servlet

shipped with jeeves both respond with the following error whenever
saveCookie is called.
All of these servlets work fine with srun and the sun server.

The output in the web browser is:
Servlet has thrown exception:java.lang.ClassCastException:
w3c.jigsaw.servlet.JigsawHttpServletResponse

The stack trace is:
        at sun.servlet.http.Cookie.saveCookie(Cookie.java:365)
        at JASServlet.generateNewCookie(JASServlet.java:258)
        at JASServlet.doPost(JASServlet.java:86)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:278)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:330)
        at
w3c.jigsaw.servlet.ServletWrapper.perform(ServletWrapper.java)
        at w3c.jigsaw.http.httpd.perform(httpd.java)
        at w3c.jigsaw.http.Client.processRequest(Client.java)
        at w3c.jigsaw.http.Client.startConnection(Client.java)
        at w3c.jigsaw.http.socket.SocketClient.run(SocketClient.java)
        at w3c.util.CachedThread.run(ThreadCache.java

I modified the Jeeves 1.0 Counter.java file like this:
System.err.println("Before saveCookie");
 try
   {
     c.saveCookie (res);
   }
 catch (Exception e)
   {
     e.printStackTrace();
     throw new ServletException("Couldn't save Cookie");
   }
 System.err.println("After saveCookie");

and got this result:

Counter: init
Before saveCookie
java.lang.ClassCastException:
w3c.jigsaw.servlet.JigsawHttpServletResponse
        at sun.servlet.http.Cookie.saveCookie(Cookie.java:365)
        at Counter.doGet(Counter.java:151)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:252)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:330)
        at
w3c.jigsaw.servlet.ServletWrapper.perform(ServletWrapper.java)
        at w3c.jigsaw.http.httpd.perform(httpd.java)
        at w3c.jigsaw.http.Client.processRequest(Client.java)
        at w3c.jigsaw.http.Client.startConnection(Client.java)
        at w3c.jigsaw.http.socket.SocketClient.run(SocketClient.java)
        at w3c.util.CachedThread.run(ThreadCache.java)

My first thought was that the saveCookie didn't like the
JigsawHttpServletResponse object I'm getting from jigsaw's but
JigsawHttpServletResponse implements HttpServletResponse and that is
what saveCookie wants. My next guess was that the JSDK saveCookie
implementation really wanted an HttpResponse for some reason. Trying to
cast
the jigsaw version to HttpResponse didn't work though.

Can someone else verify this problem? Or does anyone have a workaround?

P

Received on Thursday, 4 September 1997 04:12:31 UTC