Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yaru
fgqyxxlr
Commits
e5ab665c
Commit
e5ab665c
authored
Aug 04, 2019
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
检查属性是否改变修改为克隆方式(防止热部署出现强转异常)
parent
c3417792
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java
+18
-4
No files found.
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java
View file @
e5ab665c
...
...
@@ -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
;
...
...
@@ -27,15 +29,15 @@ import com.ruoyi.system.service.ISysUserOnlineService;
public
class
OnlineWebSessionManager
extends
DefaultWebSessionManager
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
OnlineWebSessionManager
.
class
);
@Override
public
void
setAttribute
(
SessionKey
sessionKey
,
Object
attributeKey
,
Object
value
)
throws
InvalidSessionException
{
super
.
setAttribute
(
sessionKey
,
attributeKey
,
value
);
if
(
value
!=
null
&&
needMarkAttributeChanged
(
attributeKey
))
{
OnlineSession
s
=
(
OnlineSession
)
doGet
Session
(
sessionKey
);
s
.
markAttributeChanged
();
OnlineSession
s
ession
=
getOnline
Session
(
sessionKey
);
s
ession
.
markAttributeChanged
();
}
}
...
...
@@ -68,13 +70,25 @@ public class OnlineWebSessionManager extends DefaultWebSessionManager
Object
removed
=
super
.
removeAttribute
(
sessionKey
,
attributeKey
);
if
(
removed
!=
null
)
{
OnlineSession
s
=
(
OnlineSession
)
doGet
Session
(
sessionKey
);
OnlineSession
s
=
getOnline
Session
(
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
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment