tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r711716 - in /tomcat/trunk/java/org/apache/catalina: ./ ha/session/ session/
Date Wed, 05 Nov 2008 22:11:04 GMT
Author: rjung
Date: Wed Nov  5 14:11:04 2008
New Revision: 711716

URL: http://svn.apache.org/viewvc?rev=711716&view=rev
Log:
Now expose thisAccessedTime via the session interface
and ManagerBase, so we can use it from outside the session.

Modified:
    tomcat/trunk/java/org/apache/catalina/Session.java
    tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings_es.properties
    tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/session/LocalStrings_es.properties
    tomcat/trunk/java/org/apache/catalina/session/LocalStrings_fr.properties
    tomcat/trunk/java/org/apache/catalina/session/LocalStrings_ja.properties
    tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
    tomcat/trunk/java/org/apache/catalina/session/StandardSession.java

Modified: tomcat/trunk/java/org/apache/catalina/Session.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Session.java?rev=711716&r1=711715&r2=711716&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Session.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Session.java Wed Nov  5 14:11:04 2008
@@ -131,6 +131,22 @@
      * session, as the number of milliseconds since midnight, January 1, 1970
      * GMT.  Actions that your application takes, such as getting or setting
      * a value associated with the session, do not affect the access time.
+     * This one gets updated whenever a request starts.
+     */
+    public long getThisAccessedTime();
+
+    /**
+     * Return the last client access time without invalidation check
+     * @see #getThisAccessedTime().
+     */
+    public long getThisAccessedTimeInternal();
+
+    /**
+     * Return the last time the client sent a request associated with this
+     * session, as the number of milliseconds since midnight, January 1, 1970
+     * GMT.  Actions that your application takes, such as getting or setting
+     * a value associated with the session, do not affect the access time.
+     * This one gets updated whenever a request finishes.
      */
     public long getLastAccessedTime();
 

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties?rev=711716&r1=711715&r2=711716&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties Wed Nov  5 14:11:04
2008
@@ -98,6 +98,7 @@
 standardSession.getAttribute.ise=getAttribute: Session already invalidated
 standardSession.getAttributeNames.ise=getAttributeNames: Session already invalidated
 standardSession.getCreationTime.ise=getCreationTime: Session already invalidated
+standardSession.getThisAccessedTime.ise=getThisAccessedTime: Session already invalidated
 standardSession.getLastAccessedTime.ise=getLastAccessedTime: Session already invalidated
 standardSession.getId.ise=getId: Session already invalidated
 standardSession.getMaxInactiveInterval.ise=getMaxInactiveInterval: Session already invalidated
@@ -109,4 +110,4 @@
 standardSession.setAttribute.ise=setAttribute: Session already invalidated
 standardSession.setAttribute.namenull=setAttribute: name parameter cannot be null
 standardSession.sessionCreated=Created Session id = {0}
-serializablePrincipal.readPrincipal.cnfe=readPrincipal: Failed to recreate user Principal
\ No newline at end of file
+serializablePrincipal.readPrincipal.cnfe=readPrincipal: Failed to recreate user Principal

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings_es.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings_es.properties?rev=711716&r1=711715&r2=711716&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings_es.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings_es.properties Wed Nov  5
14:11:04 2008
@@ -98,6 +98,7 @@
 standardSession.getAttribute.ise = getAttribute\: Sesi\u00F3n ya invalidada
 standardSession.getAttributeNames.ise = getAttributeNames\: Sesi\u00F3n ya invalidada
 standardSession.getCreationTime.ise = getCreationTime\: Sesi\u00F3n ya invalidada
+standardSession.getThisAccessedTime.ise = getThisAccessedTime\: Sesi\u00F3n ya invalidada
 standardSession.getLastAccessedTime.ise = getLastAccessedTime\: Sesi\u00F3n ya invalidada
 standardSession.getId.ise = getId\: Sesi\u00F3n ya invalidada
 standardSession.getMaxInactiveInterval.ise = getMaxInactiveInterval\: Sesi\u00F3n ya invalidada

Modified: tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties?rev=711716&r1=711715&r2=711716&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties Wed Nov  5 14:11:04
2008
@@ -56,6 +56,7 @@
 standardSession.getAttribute.ise=getAttribute: Session already invalidated
 standardSession.getAttributeNames.ise=getAttributeNames: Session already invalidated
 standardSession.getCreationTime.ise=getCreationTime: Session already invalidated
+standardSession.getThisAccessedTime.ise=getThisAccessedTime: Session already invalidated
 standardSession.getLastAccessedTime.ise=getLastAccessedTime: Session already invalidated
 standardSession.getId.ise=getId: Session already invalidated
 standardSession.getMaxInactiveInterval.ise=getMaxInactiveInterval: Session already invalidated

Modified: tomcat/trunk/java/org/apache/catalina/session/LocalStrings_es.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/LocalStrings_es.properties?rev=711716&r1=711715&r2=711716&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/LocalStrings_es.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/session/LocalStrings_es.properties Wed Nov  5 14:11:04
2008
@@ -55,6 +55,7 @@
 standardSession.getAttribute.ise = getAttribute\: La Sesi\u00F3n ya ha sido invalidada
 standardSession.getAttributeNames.ise = getAttributeNames\: La Sesi\u00F3n ya ha sido invalidada
 standardSession.getCreationTime.ise = getCreationTime\: La Sesi\u00F3n ya ha sido invalidada
+standardSession.getThisAccessedTime.ise = getThisAccessedTime\: La Sesi\u00F3n ya ha sido
invalidada
 standardSession.getLastAccessedTime.ise = getLastAccessedTime\: La Sesi\u00F3n ya ha sido
invalidada
 standardSession.getId.ise = getId\: La Sesi\u00F3n ya ha sido invalidada
 standardSession.getMaxInactiveInterval.ise = getMaxInactiveInterval\: La Sesi\u00F3n ya ha
sido invalidada

Modified: tomcat/trunk/java/org/apache/catalina/session/LocalStrings_fr.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/LocalStrings_fr.properties?rev=711716&r1=711715&r2=711716&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/LocalStrings_fr.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/session/LocalStrings_fr.properties Wed Nov  5 14:11:04
2008
@@ -54,6 +54,7 @@
 standardSession.getAttribute.ise="getAttribute": Session déjà invalidée
 standardSession.getAttributeNames.ise="getAttributeNames": Session déjà invalidée
 standardSession.getCreationTime.ise="getCreationTime": Session déjà invalidée
+standardSession.getThisAccessedTime.ise="getThisAccessedTime": Session d\u00E9j\u00E0 invalid\u00E9e
 standardSession.getLastAccessedTime.ise="getLastAccessedTime": Session d\u00E9j\u00E0 invalid\u00E9e
 standardSession.getId.ise=getId: Session déjà invalidée
 standardSession.getMaxInactiveInterval.ise="getMaxInactiveInterval": Session déjà invalidée

Modified: tomcat/trunk/java/org/apache/catalina/session/LocalStrings_ja.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/LocalStrings_ja.properties?rev=711716&r1=711715&r2=711716&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/LocalStrings_ja.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/session/LocalStrings_ja.properties Wed Nov  5 14:11:04
2008
@@ -56,6 +56,7 @@
 standardSession.getAttribute.ise=getAttribute: \u30bb\u30c3\u30b7\u30e7\u30f3\u306f\u65e2\u306b\u7121\u52b9\u5316\u3055\u308c\u3066\u3044\u307e\u3059
 standardSession.getAttributeNames.ise=getAttributeNames: \u30bb\u30c3\u30b7\u30e7\u30f3\u306f\u65e2\u306b\u7121\u52b9\u5316\u3055\u308c\u3066\u3044\u307e\u3059
 standardSession.getCreationTime.ise=getCreationTime: \u30bb\u30c3\u30b7\u30e7\u30f3\u306f\u65e2\u306b\u7121\u52b9\u5316\u3055\u308c\u3066\u3044\u307e\u3059
+standardSession.getThisAccessedTime.ise=getThisAccessedTime: \u30bb\u30c3\u30b7\u30e7\u30f3\u306f\u65e2\u306b\u7121\u52b9\u5316\u3055\u308c\u3066\u3044\u307e\u3059
 standardSession.getLastAccessedTime.ise=getLastAccessedTime: \u30bb\u30c3\u30b7\u30e7\u30f3\u306f\u65e2\u306b\u7121\u52b9\u5316\u3055\u308c\u3066\u3044\u307e\u3059
 standardSession.getId.ise=getId: \u30bb\u30c3\u30b7\u30e7\u30f3\u306f\u65e2\u306b\u7121\u52b9\u5316\u3055\u308c\u3066\u3044\u307e\u3059
 standardSession.getMaxInactiveInterval.ise=getMaxInactiveInterval: \u30bb\u30c3\u30b7\u30e7\u30f3\u306f\u65e2\u306b\u7121\u52b9\u5316\u3055\u308c\u3066\u3044\u307e\u3059

Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java?rev=711716&r1=711715&r2=711716&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java Wed Nov  5 14:11:04 2008
@@ -1228,13 +1228,30 @@
         s.expire();
     }
 
+    public long getThisAccessedTimestamp( String sessionId ) {
+        Session s=(Session)sessions.get(sessionId);
+        if(s== null)
+            return -1 ;
+        return s.getThisAccessedTime();
+    }
+
+    public String getThisAccessedTime( String sessionId ) {
+        Session s=(Session)sessions.get(sessionId);
+        if( s==null ) {
+            if(log.isInfoEnabled())
+                log.info("Session not found " + sessionId);
+            return "";
+        }
+        return new Date(s.getThisAccessedTime()).toString();
+    }
+
     public long getLastAccessedTimestamp( String sessionId ) {
         Session s=(Session)sessions.get(sessionId);
         if(s== null)
             return -1 ;
         return s.getLastAccessedTime();
     }
-  
+
     public String getLastAccessedTime( String sessionId ) {
         Session s=(Session)sessions.get(sessionId);
         if( s==null ) {

Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSession.java?rev=711716&r1=711715&r2=711716&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StandardSession.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardSession.java Wed Nov  5 14:11:04
2008
@@ -432,6 +432,32 @@
      * session, as the number of milliseconds since midnight, January 1, 1970
      * GMT.  Actions that your application takes, such as getting or setting
      * a value associated with the session, do not affect the access time.
+     * This one gets updated whenever a request starts.
+     */
+    public long getThisAccessedTime() {
+
+        if (!isValidInternal()) {
+            throw new IllegalStateException
+                (sm.getString("standardSession.getThisAccessedTime.ise"));
+        }
+
+        return (this.thisAccessedTime);
+    }
+
+    /**
+     * Return the last client access time without invalidation check
+     * @see #getThisAccessedTime().
+     */
+    public long getThisAccessedTimeInternal() {
+        return (this.thisAccessedTime);
+    }
+
+    /**
+     * Return the last time the client sent a request associated with this
+     * session, as the number of milliseconds since midnight, January 1, 1970
+     * GMT.  Actions that your application takes, such as getting or setting
+     * a value associated with the session, do not affect the access time.
+     * This one gets updated whenever a request finishes.
      */
     public long getLastAccessedTime() {
 



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


Mime
View raw message