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


Java ValidatingSession类代码示例

本文整理汇总了Java中org.apache.shiro.session.mgt.ValidatingSession的典型用法代码示例。如果您正苦于以下问题:Java ValidatingSession类的具体用法?Java ValidatingSession怎么用?Java ValidatingSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ValidatingSession类属于org.apache.shiro.session.mgt包,在下文中一共展示了ValidatingSession类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doUpdate

import org.apache.shiro.session.mgt.ValidatingSession; //导入依赖的package包/类
@Override
protected void doUpdate(Session session) {
    // 如果会话过期/停止 没必要再更新了
    if(session instanceof ValidatingSession && !((ValidatingSession)session).isValid()) {
        return;
    }
    // 更新session的最后一次访问时间
    UpmsSession upmsSession = (UpmsSession) session;
    UpmsSession cacheUpmsSession = (UpmsSession) doReadSession(session.getId());
    if (null != cacheUpmsSession) {
        upmsSession.setStatus(cacheUpmsSession.getStatus());
        upmsSession.setAttribute("FORCE_LOGOUT", cacheUpmsSession.getAttribute("FORCE_LOGOUT"));
    }
    RedisUtil.set(ZHENG_UPMS_SHIRO_SESSION_ID + "_" + session.getId(), SerializableUtil.serialize(session), (int) session.getTimeout() / 1000);
    // 更新ZHENG_UPMS_SERVER_SESSION_ID、ZHENG_UPMS_SERVER_CODE过期时间 TODO
    _log.debug("doUpdate >>>>> sessionId={}", session.getId());
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:18,代码来源:UpmsSessionDao.java

示例2: doUpdate

import org.apache.shiro.session.mgt.ValidatingSession; //导入依赖的package包/类
@Override
protected void doUpdate(Session session) {
    // 如果会话过期/停止 没必要再更新了
    if(session instanceof ValidatingSession && !((ValidatingSession)session).isValid()) {
        return;
    }
    // 更新session的最后一次访问时间
    UpmsSession upmsSession = (UpmsSession) session;
    UpmsSession cacheUpmsSession = (UpmsSession) doReadSession(session.getId());
    if (null != cacheUpmsSession) {
        upmsSession.setStatus(cacheUpmsSession.getStatus());
        upmsSession.setAttribute("FORCE_LOGOUT", cacheUpmsSession.getAttribute("FORCE_LOGOUT"));
    }
    RedisUtil.set(LAMBO_UPMS_SHIRO_SESSION_ID + "_" + session.getId(), SerializableUtil.serialize(session), (int) session.getTimeout() / 1000);
    // 更新LAMBO_UPMS_SERVER_SESSION_ID、LAMBO_UPMS_SERVER_CODE过期时间 TODO
    _log.debug("doUpdate >>>>> sessionId={}", session.getId());
}
 
开发者ID:sunzhen086,项目名称:lambo,代码行数:18,代码来源:UpmsSessionDao.java

示例3: doUpdate

import org.apache.shiro.session.mgt.ValidatingSession; //导入依赖的package包/类
@Override
protected void doUpdate(Session session) {
    // 如果会话过期/停止 没必要再更新了
    if(session instanceof ValidatingSession && !((ValidatingSession)session).isValid()) {
        return;
    }
    // 更新session的最后一次访问时间
    UpmsSession upmsSession = (UpmsSession) session;
    UpmsSession cacheUpmsSession = (UpmsSession) doReadSession(session.getId());
    if (null != cacheUpmsSession) {
        upmsSession.setStatus(cacheUpmsSession.getStatus());
        upmsSession.setAttribute("FORCE_LOGOUT", cacheUpmsSession.getAttribute("FORCE_LOGOUT"));
    }
    RedisUtil.set(ZHENG_UPMS_SHIRO_SESSION_ID + "_" + session.getId(), SerializableUtil.serialize(session), (int) session.getTimeout() / 1000);
    // 更新ZHENG_UPMS_SERVER_SESSION_ID、ZHENG_UPMS_SERVER_CODE过期时间 TODO
    LOGGER.debug("doUpdate >>>>> sessionId={}", session.getId());
}
 
开发者ID:ChangyiHuang,项目名称:shuzheng,代码行数:18,代码来源:UpmsSessionDao.java

示例4: update

import org.apache.shiro.session.mgt.ValidatingSession; //导入依赖的package包/类
@Override
	public void update(Session session) {
		if (session instanceof ValidatingSession && !((ValidatingSession) session).isValid()) {
			return; // 如果会话过期/停止 没必要再更新了
		}
		super.update(session);
		RedisClientSupport jedis = SpringBeanUtil.getRedisClientSupport();
		if (jedis != null) {
			String key = RedisKeyConfig.getShiroSessionCacheKey(session.getId());
//			String value = JSON.toJSONString(session);
			String value = SerializableUtils.serialize(session);
			try {
				jedis.putValue(key, value,session.getTimeout()/1000,TimeUnit.SECONDS);
			} catch (InvalidSessionException | CacheAccessException e) {
			}
		}
	}
 
开发者ID:leiyong0326,项目名称:phone,代码行数:18,代码来源:ShiroSessionDAO.java

示例5: validationSession

import org.apache.shiro.session.mgt.ValidatingSession; //导入依赖的package包/类
protected boolean validationSession(final String sessionSerail) {
    final Session session = SerializableUtils.decode(sessionSerail);
    if(session instanceof ValidatingSession) {
        if(!((ValidatingSession) session).isValid()) {
            return false;
        }
    }
    
    for(Object attributeKey : session.getAttributeKeys()) {
        if(!validationSession0(session, attributeKey)) {
            return false;
        }
    }
    
    accessSession(session);
    return true;
}
 
开发者ID:nano-projects,项目名称:nano-framework,代码行数:18,代码来源:AbstractSSOComponent.java

示例6: doUpdate

import org.apache.shiro.session.mgt.ValidatingSession; //导入依赖的package包/类
@Override
protected void doUpdate(Session session) {
    if (session instanceof ValidatingSession && !((ValidatingSession) session).isValid()) {
        return;
    }

    initRedisClient();
    RedisClient client = sessions.values().iterator().next();
    switch (persistType) {
        case SET:
            String id;
            client.set((id = sessionName + session.getId()), SerializableUtils.encode(session));
            client.expire(id, sessionExpire);
            break;

        case HSET:
            client.hset(sessionName, (String) session.getId(), SerializableUtils.encode(session));
            break;
    }
}
 
开发者ID:nano-projects,项目名称:nano-framework,代码行数:21,代码来源:RedisSessionDAO.java

示例7: update

import org.apache.shiro.session.mgt.ValidatingSession; //导入依赖的package包/类
/**
 * Updates the state of the given session to the EIS by first delegating to
 * {@link #doUpdate(org.apache.shiro.session.Session)}.  If the session is a {@link ValidatingSession}, it will
 * be added to the cache only if it is {@link ValidatingSession#isValid()} and if invalid, will be removed from the
 * cache.  If it is not a {@code ValidatingSession} instance, it will be added to the cache in any event.
 *
 * @param session the session object to update in the EIS.
 * @throws UnknownSessionException if no existing EIS session record exists with the
 *                                 identifier of {@link Session#getId() session.getId()}
 */
public void update(Session session) throws UnknownSessionException {
    doUpdate(session);
    if (session instanceof ValidatingSession) {
        if (((ValidatingSession) session).isValid()) {
            cache(session, session.getId());
        } else {
            uncache(session);
        }
    } else {
        cache(session, session.getId());
    }
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:23,代码来源:CachingSessionDAO.java


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