本文整理汇总了Java中org.apache.catalina.Session.getLastAccessedTime方法的典型用法代码示例。如果您正苦于以下问题:Java Session.getLastAccessedTime方法的具体用法?Java Session.getLastAccessedTime怎么用?Java Session.getLastAccessedTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.Session
的用法示例。
在下文中一共展示了Session.getLastAccessedTime方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDisplayLastAccessedTimeForSession
import org.apache.catalina.Session; //导入方法依赖的package包/类
public static String getDisplayLastAccessedTimeForSession(Session in_session) {
try {
if (in_session.getLastAccessedTime() == 0) {
return "";
}
DateFormat formatter = new SimpleDateFormat(DATE_TIME_FORMAT);
return formatter.format(new Date(in_session.getLastAccessedTime()));
} catch (IllegalStateException ise) {
//ignore: invalidated session
return "";
}
}
示例2: getUsedTimeForSession
import org.apache.catalina.Session; //导入方法依赖的package包/类
public static long getUsedTimeForSession(Session in_session) {
try {
long diffMilliSeconds = in_session.getLastAccessedTime() - in_session.getCreationTime();
return diffMilliSeconds;
} catch (IllegalStateException ise) {
//ignore: invalidated session
return -1;
}
}
示例3: getTTLForSession
import org.apache.catalina.Session; //导入方法依赖的package包/类
public static long getTTLForSession(Session in_session) {
try {
long diffMilliSeconds = (1000*in_session.getMaxInactiveInterval()) - (System.currentTimeMillis() - in_session.getLastAccessedTime());
return diffMilliSeconds;
} catch (IllegalStateException ise) {
//ignore: invalidated session
return -1;
}
}
示例4: getInactiveTimeForSession
import org.apache.catalina.Session; //导入方法依赖的package包/类
public static long getInactiveTimeForSession(Session in_session) {
try {
long diffMilliSeconds = System.currentTimeMillis() - in_session.getLastAccessedTime();
return diffMilliSeconds;
} catch (IllegalStateException ise) {
//ignore: invalidated session
return -1;
}
}
示例5: isSessionStale
import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
* Indicate whether the session has been idle for longer
* than its expiration date as of the supplied time.
*
* FIXME: Probably belongs in the Session class.
*/
protected boolean isSessionStale(Session session, long timeNow) {
int maxInactiveInterval = session.getMaxInactiveInterval();
if (maxInactiveInterval >= 0) {
int timeIdle = // Truncate, do not round up
(int) ((timeNow - session.getLastAccessedTime()) / 1000L);
if (timeIdle >= maxInactiveInterval)
return true;
}
return false;
}
示例6: isSessionStale
import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
* Indicate whether the session has been idle for longer
* than its expiration date as of the supplied time.
*
* FIXME: Probably belongs in the Session class.
*/
protected boolean isSessionStale(Session session, long timeNow) {
int maxInactiveInterval = session.getMaxInactiveInterval();
if (maxInactiveInterval >= 0) {
int timeIdle = // Truncate, do not round up
(int) ((timeNow - session.getLastAccessedTime()) / 1000L);
if (timeIdle >= maxInactiveInterval)
return true;
}
return false;
}
示例7: getDisplayLastAccessedTimeForSession
import org.apache.catalina.Session; //导入方法依赖的package包/类
public static String getDisplayLastAccessedTimeForSession(Session in_session) {
try {
if (in_session.getLastAccessedTime() == 0) {
return "";
}
DateFormat formatter = new SimpleDateFormat(DATE_TIME_FORMAT);
return formatter.format(new Date(in_session.getLastAccessedTime()));
} catch (IllegalStateException ise) {
// ignore: invalidated session
return "";
}
}
示例8: getLastAccessedTimestamp
import org.apache.catalina.Session; //导入方法依赖的package包/类
public long getLastAccessedTimestamp( String sessionId ) {
Session s=sessions.get(sessionId);
if(s== null)
return -1 ;
return s.getLastAccessedTime();
}
示例9: getLastAccessedTimestamp
import org.apache.catalina.Session; //导入方法依赖的package包/类
public long getLastAccessedTimestamp(String sessionId) {
Session s = sessions.get(sessionId);
if (s == null)
return -1;
return s.getLastAccessedTime();
}