Running on Windows NT using Tomcat 2.3.2. and sending an HTTP request from Internet Explorer 6.0.2 running on Windows 2000
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Keren_R
Posted On:   Monday, April 22, 2002 03:06 AM

I am running the following servlet on Windows NT using Tomcat 2.3.2. When I am sending an HTTP request from Internet Explorer 6.0.2 running on Windows 2000, The browser does not get the JSESSIONID cookie , thus creating a new session for each request. However, When I am sending an HTTP request from Internet Explorer 5.5 running on Windows NT, the browser does get the JSESSIONID cookie, thus maintaining the HTTP session while the browser is open. package test; import javax.servlet.http.*; import javax.servlet.ServletException; import java.io.IOException; public class TestServlet    More>>

I am running the following servlet on Windows NT using Tomcat 2.3.2.


When I am sending an HTTP request from Internet Explorer 6.0.2 running on Windows 2000,
The browser does not get the JSESSIONID cookie , thus creating a new session for each request.


However, When I am sending an HTTP request from Internet Explorer 5.5 running on Windows NT,
the browser does get the JSESSIONID cookie, thus maintaining the HTTP session while the browser is open.

			

package test;

import javax.servlet.http.*;

import javax.servlet.ServletException;

import java.io.IOException;

public class TestServlet extends HttpServlet {

public TestServlet() {

  super();

}

protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

  handleRequest(req, resp);

}

protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException{

  handleRequest(req, resp);

}

protected void handleRequest(HttpServletRequest req, HttpServletResponse resp){

  Cookie[] cookies = req.getCookies();

  System.out.println("
Cookies count: " + cookies.length);

  for(int i=0; i

   System.out.println("Cookie["+i+"] : " + cookies[i].getName() + " = " +cookies[i].getValue());

  }

  System.out.println("Requested Session ID : " + req.getRequestedSessionId());

  System.out.println("isRequestedSessionIdFromCookie : " + req.isRequestedSessionIdFromCookie());

  System.out.println("isRequestedSessionIdFromURL : " + req.isRequestedSessionIdFromURL());

  System.out.println("isRequestedSessionIdValid : " + req.isRequestedSessionIdValid());

  HttpSession currentSession = req.getSession(true);

  System.out.println(" Session ID (after creating session): " + currentSession.getId());

  }


Results when sending HTTP requests from IE6.0.2 on Windows 2000:

First Request:

 Cookies' count: 0

 Requested Session ID : null

 isRequestedSessionIdFromCookie : false

 isRequestedSessionIdFromURL : false

 isRequestedSessionIdValid : false

  Session ID (after creating session): ftjzgwj391

Second Request:

 Cookies' count: 1

 Cookie[0] : JSESSIONID = ftjzgwj391

 Requested Session ID : ftjzgwj391

 isRequestedSessionIdFromCookie : true

 isRequestedSessionIdFromURL : false

 isRequestedSessionIdValid : true

  Session ID (after creating session): ftjzgwj391

Results when sending HTTP requests from IE5.5 on Windows NT:

First Request:

Cookies' count: 0

Requested Session ID : null

isRequestedSessionIdFromCookie : false

isRequestedSessionIdFromURL : false

isRequestedSessionIdValid : false

Session ID (after creating session): zvpk6ok0i1

Second Request:

Cookie[0] : JSESSIONID = zvpk6ok0i1

Requested Session ID : zvpk6ok0i1

isRequestedSessionIdFromCookie : true

isRequestedSessionIdFromURL : false

isRequestedSessionIdValid : true

Session ID (after creating session): zvpk6ok0i1

   <<Less

Re: Running on Windows NT using Tomcat 2.3.2. and sending an HTTP request from Internet Explorer 6.0.2 running on Windows 2000

Posted By:   AlessandroA_Garbagnati  
Posted On:   Tuesday, April 23, 2002 05:38 AM

Hi,

It seems to be an IE issue, more than a Tomcat issue.

A question... I don't see differences in the two "Result" sets. They have both received the cookie in the second request.
About | Sitemap | Contact