当前位置: 首页>>代码示例>>Java>>正文


Java Session.getMaxInactiveInterval方法代码示例

本文整理汇总了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;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:22,代码来源:PersistentValve.java

示例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;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:22,代码来源:PersistentValve.java

示例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;
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:SessionUtils.java

示例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);
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:49,代码来源:SingleSignOn.java

示例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;
}
  }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:SessionUtils.java

示例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);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:SingleSignOn.java

示例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;
 
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:PersistentValve.java

示例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;

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:20,代码来源:PersistentManagerBase.java

示例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;
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:11,代码来源:SessionUtils.java

示例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);
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:48,代码来源:SingleSignOn.java


注:本文中的org.apache.catalina.Session.getMaxInactiveInterval方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。