tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gould...@netscape.net
Subject Problem with session tracking
Date Tue, 24 Apr 2001 08:36:56 GMT
Hi there,

I'm having trouble with session tracking in a servlet in that the session always appears to
be new. When exercising the following code fragment:

HttpSession session = request.getSession();
if (session.isNew())
{
      // Some stuff here
}

the isNew() call always evaluates to true. I also have noticed that no cookies are being written
since if I try:

Cookie[] cookies = request.getCookies();
System.out.print("Number of cookies is ");
System.out.println(cookies.length);

it is always zero. However, if I write cookies myself by calling response.addCookie(), I get
a cookie next time round.

I'm finding this confusing since my understanding is that the session tracking is by default
implemented using cookies. I'm guessing that the lack of cookies and the always-new-session
are not unconnected but I've failed so far to find a solution or a reference to this problem
in the Tomcat FAQ.

btw, I do have cookies turned on in my browser and the "noCookies" parameter in server.xml
is set to false.

I would appreciate any ideas you might have.

Regards,
Alan Goulding.
__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/

Mime
View raw message