tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject problem with session tracking with applets after invalidate
Date Mon, 05 Jun 2000 10:12:12 GMT

I had a problem when I tried to get a valid session in a servlet that was called
from an applet. I'm using Tomcat 3.1; NT 4.0; IE5 and NS 4.73 both with plugin
The steps are:

1. The browser sends a URL to the servlet. In doGet the session is created. A
page containing the applet is returned.
2. The applet calls the servlet thru a URLConnection with some extra parameters.
In doPost the session is recognised.
3. As kind of a logout I do a session.invalidate();

When I now do step 1 again a new session is created (as it should) but the
applet won't get that session. request.getSession( true ) returns always a new
session.  As it seems both browsers don't accept the cookie in the applet's
context (HTML is still fine).

I found the following  workaround: The page containing the applet is generated
by a JSP. I get the cookie (request.getCookies()) and pass it as a parameter to
the applet. The applet sets explicitely the cookie with
setRequestProperty("cookie", strCookie ). Now the getSession-invalidate cycle

Any comments on that?

Is there a better solution?

View raw message