Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 60041 invoked from network); 30 Nov 2004 01:16:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 30 Nov 2004 01:16:16 -0000 Received: (qmail 90489 invoked by uid 500); 30 Nov 2004 01:15:49 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 90468 invoked by uid 500); 30 Nov 2004 01:15:48 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 90452 invoked by uid 99); 30 Nov 2004 01:15:48 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from mail.mtctrains.com (HELO mail.mtctrains.com) (63.76.25.118) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 29 Nov 2004 17:15:47 -0800 Received: from MTC-MTA by mail.mtctrains.com with Novell_GroupWise; Mon, 29 Nov 2004 18:15:45 -0700 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Mon, 29 Nov 2004 18:15:25 -0700 From: "Dennis Payne" To: , Subject: Re: [HttpSession creation: When & How] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 500/1000/N You can use the session.invalidate() if you need to before creating a new session (I did not use this approach). With my system, if the session exists we check for required elements and place them there if they are missing. Every thirty minutes the session automatically invalidates. At that point we create a new session and simply repeat the check for required elements. All of this is invisible to the user who logs in only once. The only information that stays from session to session is data that is persisted in (written to) the database and put in the session for servlet/JSP use. If I understand correctly the HTTP Session is initiated by the web server when authentication takes place (I only have experience with basic authentication). Other wiser sources may clarify... >>> cecajina@hotmail.com 11-29-2004 17:31 >>> Good evening. My question is about HttpSession objects creation and destruction within a Servlet/JSP container. I'm using the JBoss/Tomcat bundle (versions 3.2.3/4.1.29) with a database realm properly configured. Here's how things work so far: 1. User goes to a predefined Welcome File (index.html) 2. Within the welcome file there's a link to a protected resource (wich happens to be the application's "main screen") 3. The user clicks the link and the login page appears. 4. The user enters login/password and logs on successfully or is redirected to an error page. Up to this point everything works fine, but the thing that I don't understand is that the moment the user clicks the link that points to a protected resource an HttpSession object is created by the server even though the user hasn't been authenticated. This behavior kinda ruin my plans because I have a Session Creation/Destruction Listener that is supposed to detect a session creation event in order to be able to place some things (objects) in that user session, but it seems that the created session for the unauthenticated is "recycled" after authentication and my session lifecycle listener is no longer useful (the session already exists) I've looked into the Servlet spec but couldn't find anything clarifying enough... I'f anyone has any comments, tips, thoughts on this issue I'd like to hear'em... :^) Regards, Carlos... --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org