BTW, here's a part of the servlet spec that I really dont like the wording
of.
quote --

SRV.7.7.3 Client Semantics

Due to the fact that cookies or SSL certificates are typically controlled by
the web
browser process and are not associated with any particular window of the
browser,
requests from all windows of a client application to a servlet container
might be part
of the same session. For maximum portability, the Developer should always
assume
that all windows of a client are participating in the same session.

-- end quote

In one way you have already seen how this is not true in certain situations.
And, as Dan pointed out, this is also browser dependent.
I would say that you dont make that assumption and to use the encodeXXX
anywhere in ur application
that opens new windows or links to new pages to avoid any guessing about
which session is being used.

-Tim

-----Original Message-----
From: Daniel Wink [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 09, 2002 11:23 AM
To: [EMAIL PROTECTED]
Subject: Re: Session tracking API


Hi,

This behaviour is browser dependant: from my experience opening a new
InternetExplorer window treats session as discussed (file->new->window
== same session, starting from start bar == new session).

However, be aware that ALL open Netscape windows on your screen are
likely to have the same session id when making requests to your servlet.

Later,

Dan.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 09, 2002 4:19 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Session tracking API
>
>
> If you open a new window from anywhere outside of the current
> window then it
> will create a new session.
> Closing a window will (usually) close out your current
> session as well. So
> closing a window and reopening a new one will usually be the
> equivalent of
> starting a new session.
> -Tim
>
> -----Original Message-----
> From: Kumar Sameer [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 09, 2002 11:10 AM
> To: [EMAIL PROTECTED]
> Subject: Session tracking API
>
>
> Hi !
>
> I am using the class HttpSession for session tracking. I have
> a simple class
> which just keeps a count and displays it.
>
> When i run it in a browser, and hit refresh button, the count
> is incremented
> correctly.
>
> But if i open another window, the count restarts from 1. I
> was expecting
> that even in the new window, the count will be maintained.
>
> The code is :
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.util.*;
>
> public class sessionTrackingApiCount extends HttpServlet
> {
>
> PrintWriter out;
> Integer count;
>     public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException
>     {
>         res.setContentType("text/html");
>         out = res.getWriter();
>
>         HttpSession session = req.getSession(true);
>
>         count = (Integer) session.getValue("tracker.count");
>
>         if(count == null)
>         {
>           count =new Integer(1);
>         }
>         else
>         {
>           count = new Integer(count.intValue() + 1);
>         }
>
>         session.putValue("tracker.count",count);
>
>           out.println("<HEAD><TITLE> Session Tracking using
> session tracking
> API.</HEAD></TITLE>");
>         out.println("<BODY>");
>
>         out.println("You have visited this page " + count +
> ((count.intValue() ==1) ? "time." : "times."));
>         out.println("<P>");
>         out.println("<h2>Your session data  : </h2>");
>
>         String[] names = session.getValueNames();
>         for(int i = 0; i < names.length;i++)
>         {
>           out.println(names[i] +" : " + session.getValue(names[i]) +
> "<BR>");
>         }
>
>          out.println("</BODY></HTML>");
>     }
>
>     public void doPost(HttpServletRequest req,
> HttpServletResponse res)
> throws ServletException, IOException
>     {
>
>         doGet(req,res);
>     }
>
>     public String getServletInfo()
>     {
>
>         return " Servlet using session tracking API for
> session tracking.
> ";
>     }
>
>     public void destroy()
>     {
>
>     }
>
> }
>
> Can anyone please point out my mistake?
>
> Regards
>
> Sameer
>
> ______________________________________________________________
> _____________
> 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

___________________________________________________________________________
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