jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kazuhito SUGURI <suguri.kazuh...@lab.ntt.co.jp>
Subject Re: Session cookie is null
Date Tue, 13 Sep 2005 13:35:02 GMT

In article <OFAB8BF1B2.4A56A3BB-ON4925707B.0020CC25-4925707B.00216739@itfrontier.co.jp>,
Tue, 13 Sep 2005 15:04:51 +0900,
liu_hongying@itfrontier.co.jp wrote: 
liu_hongying> I have run the following code at Tomcat 5.0 and I got the sessionCookie,

liu_hongying> but when I run 
liu_hongying> it at websphere 6, sessionCookie become null. so I can't continue the 
liu_hongying> test.

liu_hongying>     public void beginSuccessForward(WebRequest theRequest) {
liu_hongying>         HttpSessionCookie sessionCookie = theRequest.getSessionCookie();
liu_hongying>         assertNotNull("Session cookie should not be null", sessionCookie);
liu_hongying>         theRequest.addCookie(sessionCookie);
liu_hongying>      }

This test is depending on server implementation and/or configuration.

Server can delay to issuing JSESSIONID until it is really needed.
AFAIK, Tomcat issues JESSIONID for the first request by default
(this is why your test works with Tomcat).
However, other container, such as WebSphere, may not.
# I'm not sure how WebSphere works.

If you need a valid session for testXXX method,
WebRequest#setAutomaticSession(boolean) may helps you.

Hope this helps,
Kazuhito SUGURI

View raw message