You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kf...@apache.org on 2014/03/12 05:17:38 UTC

svn commit: r1576577 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/manager/ManagerServlet.java webapps/docs/changelog.xml

Author: kfujino
Date: Wed Mar 12 04:17:38 2014
New Revision: 1576577

URL: http://svn.apache.org/r1576577
Log:
Add support for LAST_ACCESS_AT_START system property to Manager web application.

Modified:
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java?rev=1576577&r1=1576576&r2=1576577&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java Wed Mar 12 04:17:38 2014
@@ -153,6 +153,18 @@ public class ManagerServlet extends Http
 
     private static final long serialVersionUID = 1L;
 
+    protected static final boolean LAST_ACCESS_AT_START;
+
+    static {
+        String lastAccessAtStart = System.getProperty(
+                "org.apache.catalina.session.StandardSession.LAST_ACCESS_AT_START");
+        if (lastAccessAtStart == null) {
+            LAST_ACCESS_AT_START = Globals.STRICT_SERVLET_COMPLIANCE;
+        } else {
+            LAST_ACCESS_AT_START =
+                Boolean.valueOf(lastAccessAtStart).booleanValue();
+        }
+    }
 
     // ----------------------------------------------------- Instance Variables
 
@@ -1144,7 +1156,12 @@ public class ManagerServlet extends Http
             int expired = 0;
             long now = System.currentTimeMillis();
             for (int i = 0; i < sessions.length; i++) {
-                int time = (int)((now-sessions[i].getThisAccessedTimeInternal())/1000);
+                int time;
+                if (LAST_ACCESS_AT_START) {
+                    time = (int) ((now - sessions[i].getLastAccessedTimeInternal()) / 1000L);
+                } else {
+                    time = (int) ((now - sessions[i].getThisAccessedTimeInternal()) / 1000L);
+                }
                 if (idle >= 0 && time >= idle*60) {
                     sessions[i].expire();
                     expired++;

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1576577&r1=1576576&r2=1576577&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Mar 12 04:17:38 2014
@@ -145,6 +145,10 @@
         "Expire sessions" command in the manager web application on a
         context where the session timeout is disabled. (kfujino)
       </fix>
+      <fix>
+         Add support for <code>LAST_ACCESS_AT_START</code> system property to
+         Manager web application. (kfujino)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org