本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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) {
}
}
}
示例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;
}
示例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;
}
}
示例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());
}
}