Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A8B2C493B for ; Wed, 8 Jun 2011 17:36:54 +0000 (UTC) Received: (qmail 10145 invoked by uid 500); 8 Jun 2011 17:36:54 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 9896 invoked by uid 500); 8 Jun 2011 17:36:53 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 9887 invoked by uid 99); 8 Jun 2011 17:36:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2011 17:36:53 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [74.86.119.220] (HELO smtpb.spamarrest.com) (74.86.119.220) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2011 17:36:44 +0000 Received: from [192.168.0.60] (static-64-115-155-170.isp.broadviewnet.net [64.115.155.170]) by smtpb.spamarrest.com (Postfix) with ESMTP id E3EC7FBC16F for ; Wed, 8 Jun 2011 12:36:22 -0500 (CDT) Subject: Question about endAccess method in org.apache.catalina.session.StandardServlet From: Ben Souther Reply-To: bsouther@fwdco.com To: dev@tomcat.apache.org Content-Type: text/plain Organization: F. W. Davison & Co, Inc Date: Wed, 08 Jun 2011 13:33:21 -0400 Message-Id: <1307554401.7252.46.camel@ben-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 (2.26.3-1.fc11) Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I'm wondering if anyone can tell me why the endAccess method (which resets the lastAccessedTime) in org.apache.catalina.session.StandardServlet is called by the org.apache.catalina.connector.request.recycle() method. /** * End the access. */ @Override public void endAccess() { isNew = false; /** * The servlet spec mandates to ignore request handling time * in lastAccessedTime. */ if (LAST_ACCESS_AT_START) { this.lastAccessedTime = this.thisAccessedTime; // <<=====<<< Here this.thisAccessedTime = System.currentTimeMillis(); } else { this.thisAccessedTime = System.currentTimeMillis(); this.lastAccessedTime = this.thisAccessedTime; // <<=====<<< Here } if (ACTIVITY_CHECK) { accessCount.decrementAndGet(); } } I'm asking because this, along with another change in TC7 breaks a feature in my application (that has been working well in 5.5 and 6.x) by causing every request, even to static resources like html pages, and images, to reset the session counter. The feature, for the curious, is an AJAX timer that can sync up with the server to let the user know how much time is left in their session. With listeners, I was able to store references to all active sessions in a context scoped object. The AJAX timer is able to read the maxInactive and lastAccessedTime properties of the user's session, without tripping the counter, to show them how much time is left in their session. It improves the security of our app by redirecting the user to the login screen if they left the browser running until the app's session expired. It's nice that it's able to double check to insure that it didn't switch screens on the user until the server's session has definitely expired. I'm able to get this working by commenting out the lines in this method and by altering the org.apache.catalina.connector.request.getSessionInternal method so that it gets session handles without calling the access() method of the session. The spec states that every call to getSession() and getSession(boolean) should reset the session timer but it isn't clear as to whether requests that don't call these methods should or shouldn't update the timer. I'd be more than happy to put together a small patch that gets Tomcat to handle this the way it did in version 6 if anyone is interested. Thanks for your time. -Ben --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org