本文整理汇总了Java中org.apache.catalina.Session.getMaxInactiveInterval方法的典型用法代码示例。如果您正苦于以下问题:Java Session.getMaxInactiveInterval方法的具体用法?Java Session.getMaxInactiveInterval怎么用?Java Session.getMaxInactiveInterval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.Session
的用法示例。
在下文中一共展示了Session.getMaxInactiveInterval方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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) {
if (session != null) {
int maxInactiveInterval = session.getMaxInactiveInterval();
if (maxInactiveInterval >= 0) {
int timeIdle = // Truncate, do not round up
(int) ((timeNow - session.getThisAccessedTime()) / 1000L);
if (timeIdle >= maxInactiveInterval) {
return true;
}
}
}
return false;
}
示例2: 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) {
if (session != null) {
int maxInactiveInterval = session.getMaxInactiveInterval();
if (maxInactiveInterval >= 0) {
int timeIdle = // Truncate, do not round up
(int) ((timeNow - session.getThisAccessedTime()) / 1000L);
if (timeIdle >= maxInactiveInterval) {
return true;
}
}
}
return false;
}
示例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.getThisAccessedTime());
return diffMilliSeconds;
} catch (IllegalStateException ise) {
//ignore: invalidated session
return -1;
}
}
示例4: sessionDestroyed
import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
* Process a session destroyed event by removing references to that session
* from the caches and - if the session destruction is the result of a
* logout - destroy the associated SSO session.
*
* @param ssoId The ID of the SSO session which which the destroyed
* session was associated
* @param session The session that has been destroyed
*/
public void sessionDestroyed(String ssoId, Session session) {
if (!getState().isAvailable()) {
return;
}
// Was the session destroyed as the result of a timeout or context stop?
// If so, we'll just remove the expired session from the SSO. If the
// session was logged out, we'll log out of all session associated with
// the SSO.
if (((session.getMaxInactiveInterval() > 0)
&& (System.currentTimeMillis() - session.getThisAccessedTimeInternal() >=
session.getMaxInactiveInterval() * 1000))
|| (!((Context)session.getManager().getContainer()).getState().isAvailable())) {
if (containerLog.isDebugEnabled()) {
containerLog.debug(sm.getString("singleSignOn.debug.sessionTimeout",
ssoId, session));
}
removeSession(ssoId, session);
} else {
// The session was logged out.
// Deregister this single session id, invalidating
// associated sessions
if (containerLog.isDebugEnabled()) {
containerLog.debug(sm.getString("singleSignOn.debug.sessionLogout",
ssoId, session));
}
// First remove the session that we know has expired / been logged
// out since it has already been removed from its Manager and, if
// we don't remove it first, deregister() will log a warning that it
// can't be found
removeSession(ssoId, session);
// If the SSO session was only associated with one web app the call
// above will have removed the SSO session from the cache
if (cache.containsKey(ssoId)) {
deregister(ssoId);
}
}
}
示例5: 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;
}
}
示例6: sessionEvent
import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
* Acknowledge the occurrence of the specified event.
*
* @param event SessionEvent that has occurred
*/
public void sessionEvent(SessionEvent event) {
// We only care about session destroyed events
if (!Session.SESSION_DESTROYED_EVENT.equals(event.getType())
&& (!Session.SESSION_PASSIVATED_EVENT.equals(event.getType())))
return;
// Look up the single session id associated with this session (if any)
Session session = event.getSession();
String ssoId = null;
synchronized (reverse) {
ssoId = (String) reverse.get(session);
}
if (ssoId == null)
return;
// Was the session destroyed as the result of a timeout?
// If so, we'll just remove the expired session from the
// SSO. If the session was logged out, we'll log out
// of all session associated with the SSO.
if (((session.getMaxInactiveInterval() > 0)
&& (System.currentTimeMillis() - session.getLastAccessedTimeInternal() >=
session.getMaxInactiveInterval() * 1000))
|| (Session.SESSION_PASSIVATED_EVENT.equals(event.getType()))) {
removeSession(ssoId, session);
} else {
// The session was logged out.
// Deregister this single session id, invalidating
// associated sessions
deregister(ssoId);
}
}
示例7: 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;
}
示例8: 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;
}
示例9: 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.getThisAccessedTime());
return diffMilliSeconds;
} catch (IllegalStateException ise) {
// ignore: invalidated session
return -1;
}
}
示例10: sessionDestroyed
import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
* Process a session destroyed event by removing references to that session
* from the caches and - if the session destruction is the result of a
* logout - destroy the associated SSO session.
*
* @param ssoId
* The ID of the SSO session which which the destroyed session
* was associated
* @param session
* The session that has been destroyed
*/
public void sessionDestroyed(String ssoId, Session session) {
if (!getState().isAvailable()) {
return;
}
// Was the session destroyed as the result of a timeout or context stop?
// If so, we'll just remove the expired session from the SSO. If the
// session was logged out, we'll log out of all session associated with
// the SSO.
if (((session.getMaxInactiveInterval() > 0) && (System.currentTimeMillis()
- session.getThisAccessedTimeInternal() >= session.getMaxInactiveInterval() * 1000))
|| (!((Context) session.getManager().getContainer()).getState().isAvailable())) {
if (containerLog.isDebugEnabled()) {
containerLog.debug(sm.getString("singleSignOn.debug.sessionTimeout", ssoId, session));
}
removeSession(ssoId, session);
} else {
// The session was logged out.
// Deregister this single session id, invalidating
// associated sessions
if (containerLog.isDebugEnabled()) {
containerLog.debug(sm.getString("singleSignOn.debug.sessionLogout", ssoId, session));
}
// First remove the session that we know has expired / been logged
// out since it has already been removed from its Manager and, if
// we don't remove it first, deregister() will log a warning that it
// can't be found
removeSession(ssoId, session);
// If the SSO session was only associated with one web app the call
// above will have removed the SSO session from the cache
if (cache.containsKey(ssoId)) {
deregister(ssoId);
}
}
}