mirror of https://gitee.com/y_project/RuoYi.git
检查属性是否改变修改为克隆方式(防止热部署出现强转异常)
parent
c3417792d9
commit
e5ab665c57
|
@ -14,6 +14,8 @@ import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.ruoyi.common.constant.ShiroConstants;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSession;
|
||||
import com.ruoyi.system.domain.SysUserOnline;
|
||||
|
@ -34,8 +36,8 @@ public class OnlineWebSessionManager extends DefaultWebSessionManager
|
|||
super.setAttribute(sessionKey, attributeKey, value);
|
||||
if (value != null && needMarkAttributeChanged(attributeKey))
|
||||
{
|
||||
OnlineSession s = (OnlineSession) doGetSession(sessionKey);
|
||||
s.markAttributeChanged();
|
||||
OnlineSession session = getOnlineSession(sessionKey);
|
||||
session.markAttributeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,13 +70,25 @@ public class OnlineWebSessionManager extends DefaultWebSessionManager
|
|||
Object removed = super.removeAttribute(sessionKey, attributeKey);
|
||||
if (removed != null)
|
||||
{
|
||||
OnlineSession s = (OnlineSession) doGetSession(sessionKey);
|
||||
OnlineSession s = getOnlineSession(sessionKey);
|
||||
s.markAttributeChanged();
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
public OnlineSession getOnlineSession(SessionKey sessionKey)
|
||||
{
|
||||
OnlineSession session = null;
|
||||
Object obj = doGetSession(sessionKey);
|
||||
if (StringUtils.isNotNull(obj))
|
||||
{
|
||||
session = new OnlineSession();
|
||||
BeanUtils.copyBeanProp(session, obj);
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证session是否有效 用于删除过期session
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue