--- Pierre-Yves Saumont <[EMAIL PROTECTED]> wrote:
> The answer to this question is specific to each
> browser. If the session is
> from cookie, the cookie might be sent to the server
> when the new window is
> open, because the browser would open this window
> with the same document that
> is in the first window, sending the same request to
> the server (as if you
> had reloaded the page.) This is the way IE 5.5
> works. This is browser
> specific. Netscape 4.7 opens a blank page, but it
> sends the cookie if you
> access the same url.
>
> If the session is from rewrited URL, it wont work
> that way. You will only
> get session traking through urls that you will have
> sent back to the browser
> after having encoded them. The difference is
> important :
>
>  - With cookie, you get the same session as soon as
> you reload the page.
>
>  - With rewrited url, you get the same session only
> if you reload the page
> from the rewrited url.
>
> So with session from url, when you open a new window
> with Netscape, you wont
> get your session in that window. With IE, you wil
> get your session only if
> the rewrited URL had been used at least once in the
> former window.
>
> As this might sound a bit confusing, I suggest you
> test all that stuff. For
> this purpose, I just wrote a tiny servlet you can
> use :
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class TestSession extends HttpServlet {
>
>
>         public void doGet(      HttpServletRequest
> request,
>
> HttpServletResponse response)
>
> throws IOException, ServletException {
>
>
> response.setContentType("text/html");
>                 PrintWriter pw =
> response.getWriter();
>
>                 HttpSession session =
> request.getSession();
>                 pw.println("<p>Session is new : " +
> session.isNew());
>                 pw.println("<p>Session ID : " +
> session.getId());
>                 pw.println("<p>Session is from
> cookie : " +
> request.isRequestedSessionIdFromCookie());
>                 pw.println("<p>Session is from URL :
> " +
> request.isRequestedSessionIdFromURL());
>                 pw.println("<p><a href='" +
> response.encodeURL("TestSession") + "'>New
> request</a>");
>         }
> }
>
> Try this servlet with as many browsers you can, with
> cookies enabled and
> disabled. Observe not only the page displayed, but
> also the address field in
> the browser window. Everyhing will become clear !
>
> Pierre-Yves


Thanks Peirre-Yves and Nic. There is nothing like
trying and when I did that I got it. I noticed that if
you have netscape4.7 and cookies are off, then the
second window with have a different sessionid than the
one that was open before. Than again.

roy-


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

___________________________________________________________________________
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