At 06:14 PM 5/18/99 +0000, you wrote:
>Mike Varley wrote:
>
>> I am trying to use the session tracking API with JServ, but have run
>> into a problem in that sessions don't get tracked properly. I can run
>> the servlets on the Java Web server and they track perfectly.
>>
>> But I don't want to use the JWS. :)
>>
>> Basically, when I go to new pages, the HttpSession session =
>> req.getSession(false) always returns null; using (true) means I get a
>> new session ID on every page.
>> here is the code at the top of all my doPost(req, res) methods:
>>
>> res.setContentType("text/html");
>> ServletOutputStream outPut = res.getOutputStream();
>> HttpSession session = req.getSession(true);
>>
>
>You might try changing the order of these calls to:
>
> HttpSession session = req.getSession(true); // Or false
> res.setContentType("text/html");
> ServletOutputStream outPut = res.getOutputStream();
>
>That way, you're guaranteed to have asked for the session ID cookie to be
>included, because you have done nothing that could possibly generate any output
>beforehand.
>
>Craig McClanahan
Tried this in Hunter's examples and still have the problem. From jserv.log:
[05/19/1999 09:38:42:945 EDT] ProtectedServlet: init
* added a log() line to show that the initial URL was being stored in
* session
[05/19/1999 09:38:42:945 EDT] ProtectedServlet: storing target:
http://MICHAEL.LEXI/new/ProtectedServlet
[05/19/1999 09:38:47:431 EDT] LoginHandler: init
* first lines of LoginHandler:
HttpSession session = req.getSession(false);
if ( session == null ) {
session = req.getSession(true);
log("LoginHandler creating new session!");
}
[05/19/1999 09:38:47:431 EDT] LoginHandler: LoginHandler creating new session!
[05/19/1999 09:38:47:431 EDT] LoginHandler: valid login: mike
[05/19/1999 09:38:47:431 EDT] LoginHandler: target for redirect: null
---
Michael Stacey
Lexi-Comp, Inc.
1100 Terex Road
Hudson OH 44236
(330) 650-6506
-- --------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]