Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_57962205
redisson
提交
b2d40e43
R
redisson
项目概览
weixin_57962205
/
redisson
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redisson
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b2d40e43
编写于
2月 21, 2018
作者:
N
Nikita
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed - tomcat session renewal. #1311
上级
2e7dc273
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
166 addition
and
4 deletion
+166
-4
redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSession.java
...-6/src/main/java/org/redisson/tomcat/RedissonSession.java
+4
-0
redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java
...main/java/org/redisson/tomcat/RedissonSessionManager.java
+3
-0
redisson-tomcat/redisson-tomcat-6/src/test/java/org/redisson/tomcat/RedissonSessionManagerTest.java
.../java/org/redisson/tomcat/RedissonSessionManagerTest.java
+33
-0
redisson-tomcat/redisson-tomcat-6/src/test/webapp/WEB-INF/web.xml
...-tomcat/redisson-tomcat-6/src/test/webapp/WEB-INF/web.xml
+1
-1
redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSession.java
...-7/src/main/java/org/redisson/tomcat/RedissonSession.java
+4
-0
redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java
...main/java/org/redisson/tomcat/RedissonSessionManager.java
+3
-0
redisson-tomcat/redisson-tomcat-7/src/test/java/org/redisson/tomcat/RedissonSessionManagerTest.java
.../java/org/redisson/tomcat/RedissonSessionManagerTest.java
+33
-0
redisson-tomcat/redisson-tomcat-7/src/test/webapp/WEB-INF/web.xml
...-tomcat/redisson-tomcat-7/src/test/webapp/WEB-INF/web.xml
+1
-1
redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSession.java
...-8/src/main/java/org/redisson/tomcat/RedissonSession.java
+4
-0
redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java
...main/java/org/redisson/tomcat/RedissonSessionManager.java
+3
-0
redisson-tomcat/redisson-tomcat-8/src/test/java/org/redisson/tomcat/RedissonSessionManagerTest.java
.../java/org/redisson/tomcat/RedissonSessionManagerTest.java
+34
-0
redisson-tomcat/redisson-tomcat-8/src/test/webapp/WEB-INF/web.xml
...-tomcat/redisson-tomcat-8/src/test/webapp/WEB-INF/web.xml
+1
-1
redisson-tomcat/redisson-tomcat-9/src/main/java/org/redisson/tomcat/RedissonSession.java
...-9/src/main/java/org/redisson/tomcat/RedissonSession.java
+4
-0
redisson-tomcat/redisson-tomcat-9/src/main/java/org/redisson/tomcat/RedissonSessionManager.java
...main/java/org/redisson/tomcat/RedissonSessionManager.java
+3
-0
redisson-tomcat/redisson-tomcat-9/src/test/java/org/redisson/tomcat/RedissonSessionManagerTest.java
.../java/org/redisson/tomcat/RedissonSessionManagerTest.java
+35
-1
未找到文件。
redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSession.java
浏览文件 @
b2d40e43
...
...
@@ -192,6 +192,10 @@ public class RedissonSession extends StandardSession {
if
(
lastAccessedTime
!=
null
)
{
this
.
lastAccessedTime
=
lastAccessedTime
;
}
Integer
maxInactiveInterval
=
(
Integer
)
attrs
.
remove
(
"session:maxInactiveInterval"
);
if
(
maxInactiveInterval
!=
null
)
{
this
.
maxInactiveInterval
=
maxInactiveInterval
;
}
Long
thisAccessedTime
=
(
Long
)
attrs
.
remove
(
"session:thisAccessedTime"
);
if
(
thisAccessedTime
!=
null
)
{
this
.
thisAccessedTime
=
thisAccessedTime
;
...
...
redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java
浏览文件 @
b2d40e43
...
...
@@ -152,6 +152,9 @@ public class RedissonSessionManager extends ManagerBase implements Lifecycle {
session
.
endAccess
();
return
session
;
}
result
.
access
();
result
.
endAccess
();
return
result
;
}
...
...
redisson-tomcat/redisson-tomcat-6/src/test/java/org/redisson/tomcat/RedissonSessionManagerTest.java
浏览文件 @
b2d40e43
...
...
@@ -18,6 +18,33 @@ import org.redisson.config.Config;
public
class
RedissonSessionManagerTest
{
@Test
public
void
testExpiration
()
throws
Exception
{
TomcatServer
server1
=
new
TomcatServer
(
"myapp"
,
8080
,
"/src/test/"
);
server1
.
start
();
Executor
executor
=
Executor
.
newInstance
();
BasicCookieStore
cookieStore
=
new
BasicCookieStore
();
executor
.
use
(
cookieStore
);
write
(
executor
,
"test"
,
"1234"
);
TomcatServer
server2
=
new
TomcatServer
(
"myapp"
,
8081
,
"/src/test/"
);
server2
.
start
();
Thread
.
sleep
(
30000
);
read
(
8081
,
executor
,
"test"
,
"1234"
);
Thread
.
sleep
(
40000
);
read
(
executor
,
"test"
,
"1234"
);
Executor
.
closeIdleConnections
();
server1
.
stop
();
server2
.
stop
();
}
@Test
public
void
testSwitchServer
()
throws
LifecycleException
,
InterruptedException
,
ClientProtocolException
,
IOException
{
// start the server at http://localhost:8080/myapp
...
...
@@ -144,6 +171,12 @@ public class RedissonSessionManagerTest {
String
response
=
executor
.
execute
(
Request
.
Get
(
url
)).
returnContent
().
asString
();
Assert
.
assertEquals
(
value
,
response
);
}
private
void
read
(
int
port
,
Executor
executor
,
String
key
,
String
value
)
throws
IOException
,
ClientProtocolException
{
String
url
=
"http://localhost:"
+
port
+
"/myapp/read?key="
+
key
;
String
response
=
executor
.
execute
(
Request
.
Get
(
url
)).
returnContent
().
asString
();
Assert
.
assertEquals
(
value
,
response
);
}
private
void
remove
(
Executor
executor
,
String
key
,
String
value
)
throws
IOException
,
ClientProtocolException
{
String
url
=
"http://localhost:8080/myapp/remove?key="
+
key
;
...
...
redisson-tomcat/redisson-tomcat-6/src/test/webapp/WEB-INF/web.xml
浏览文件 @
b2d40e43
...
...
@@ -16,7 +16,7 @@
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
<session-timeout>
1
</session-timeout>
</session-config>
</web-app>
redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSession.java
浏览文件 @
b2d40e43
...
...
@@ -197,6 +197,10 @@ public class RedissonSession extends StandardSession {
if
(
lastAccessedTime
!=
null
)
{
this
.
lastAccessedTime
=
lastAccessedTime
;
}
Integer
maxInactiveInterval
=
(
Integer
)
attrs
.
remove
(
"session:maxInactiveInterval"
);
if
(
maxInactiveInterval
!=
null
)
{
this
.
maxInactiveInterval
=
maxInactiveInterval
;
}
Long
thisAccessedTime
=
(
Long
)
attrs
.
remove
(
"session:thisAccessedTime"
);
if
(
thisAccessedTime
!=
null
)
{
this
.
thisAccessedTime
=
thisAccessedTime
;
...
...
redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java
浏览文件 @
b2d40e43
...
...
@@ -132,6 +132,9 @@ public class RedissonSessionManager extends ManagerBase {
return
session
;
}
result
.
access
();
result
.
endAccess
();
return
result
;
}
...
...
redisson-tomcat/redisson-tomcat-7/src/test/java/org/redisson/tomcat/RedissonSessionManagerTest.java
浏览文件 @
b2d40e43
...
...
@@ -17,6 +17,33 @@ import org.redisson.config.Config;
public
class
RedissonSessionManagerTest
{
@Test
public
void
testExpiration
()
throws
Exception
{
TomcatServer
server1
=
new
TomcatServer
(
"myapp"
,
8080
,
"src/test/"
);
server1
.
start
();
Executor
executor
=
Executor
.
newInstance
();
BasicCookieStore
cookieStore
=
new
BasicCookieStore
();
executor
.
use
(
cookieStore
);
write
(
executor
,
"test"
,
"1234"
);
TomcatServer
server2
=
new
TomcatServer
(
"myapp"
,
8081
,
"src/test/"
);
server2
.
start
();
Thread
.
sleep
(
30000
);
read
(
8081
,
executor
,
"test"
,
"1234"
);
Thread
.
sleep
(
40000
);
read
(
executor
,
"test"
,
"1234"
);
Executor
.
closeIdleConnections
();
server1
.
stop
();
server2
.
stop
();
}
@Test
public
void
testSwitchServer
()
throws
Exception
{
// start the server at http://localhost:8080/myapp
...
...
@@ -138,6 +165,12 @@ public class RedissonSessionManagerTest {
Assert
.
assertEquals
(
"OK"
,
response
);
}
private
void
read
(
int
port
,
Executor
executor
,
String
key
,
String
value
)
throws
IOException
,
ClientProtocolException
{
String
url
=
"http://localhost:"
+
port
+
"/myapp/read?key="
+
key
;
String
response
=
executor
.
execute
(
Request
.
Get
(
url
)).
returnContent
().
asString
();
Assert
.
assertEquals
(
value
,
response
);
}
private
void
read
(
Executor
executor
,
String
key
,
String
value
)
throws
IOException
,
ClientProtocolException
{
String
url
=
"http://localhost:8080/myapp/read?key="
+
key
;
String
response
=
executor
.
execute
(
Request
.
Get
(
url
)).
returnContent
().
asString
();
...
...
redisson-tomcat/redisson-tomcat-7/src/test/webapp/WEB-INF/web.xml
浏览文件 @
b2d40e43
...
...
@@ -16,7 +16,7 @@
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
<session-timeout>
1
</session-timeout>
</session-config>
</web-app>
redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSession.java
浏览文件 @
b2d40e43
...
...
@@ -197,6 +197,10 @@ public class RedissonSession extends StandardSession {
if
(
lastAccessedTime
!=
null
)
{
this
.
lastAccessedTime
=
lastAccessedTime
;
}
Integer
maxInactiveInterval
=
(
Integer
)
attrs
.
remove
(
"session:maxInactiveInterval"
);
if
(
maxInactiveInterval
!=
null
)
{
this
.
maxInactiveInterval
=
maxInactiveInterval
;
}
Long
thisAccessedTime
=
(
Long
)
attrs
.
remove
(
"session:thisAccessedTime"
);
if
(
thisAccessedTime
!=
null
)
{
this
.
thisAccessedTime
=
thisAccessedTime
;
...
...
redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java
浏览文件 @
b2d40e43
...
...
@@ -131,6 +131,9 @@ public class RedissonSessionManager extends ManagerBase {
session
.
endAccess
();
return
session
;
}
result
.
access
();
result
.
endAccess
();
return
result
;
}
...
...
redisson-tomcat/redisson-tomcat-8/src/test/java/org/redisson/tomcat/RedissonSessionManagerTest.java
浏览文件 @
b2d40e43
...
...
@@ -17,6 +17,34 @@ import org.redisson.config.Config;
public
class
RedissonSessionManagerTest
{
@Test
public
void
testExpiration
()
throws
Exception
{
TomcatServer
server1
=
new
TomcatServer
(
"myapp"
,
8080
,
"src/test/"
);
server1
.
start
();
Executor
executor
=
Executor
.
newInstance
();
BasicCookieStore
cookieStore
=
new
BasicCookieStore
();
executor
.
use
(
cookieStore
);
write
(
executor
,
"test"
,
"1234"
);
TomcatServer
server2
=
new
TomcatServer
(
"myapp"
,
8081
,
"src/test/"
);
server2
.
start
();
Thread
.
sleep
(
30000
);
read
(
8081
,
executor
,
"test"
,
"1234"
);
Thread
.
sleep
(
40000
);
executor
.
use
(
cookieStore
);
read
(
executor
,
"test"
,
"1234"
);
Executor
.
closeIdleConnections
();
server1
.
stop
();
server2
.
stop
();
}
@Test
public
void
testSwitchServer
()
throws
Exception
{
// start the server at http://localhost:8080/myapp
...
...
@@ -138,6 +166,12 @@ public class RedissonSessionManagerTest {
Assert
.
assertEquals
(
"OK"
,
response
);
}
private
void
read
(
int
port
,
Executor
executor
,
String
key
,
String
value
)
throws
IOException
,
ClientProtocolException
{
String
url
=
"http://localhost:"
+
port
+
"/myapp/read?key="
+
key
;
String
response
=
executor
.
execute
(
Request
.
Get
(
url
)).
returnContent
().
asString
();
Assert
.
assertEquals
(
value
,
response
);
}
private
void
read
(
Executor
executor
,
String
key
,
String
value
)
throws
IOException
,
ClientProtocolException
{
String
url
=
"http://localhost:8080/myapp/read?key="
+
key
;
String
response
=
executor
.
execute
(
Request
.
Get
(
url
)).
returnContent
().
asString
();
...
...
redisson-tomcat/redisson-tomcat-8/src/test/webapp/WEB-INF/web.xml
浏览文件 @
b2d40e43
...
...
@@ -16,7 +16,7 @@
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
<session-timeout>
1
</session-timeout>
</session-config>
</web-app>
redisson-tomcat/redisson-tomcat-9/src/main/java/org/redisson/tomcat/RedissonSession.java
浏览文件 @
b2d40e43
...
...
@@ -197,6 +197,10 @@ public class RedissonSession extends StandardSession {
if
(
lastAccessedTime
!=
null
)
{
this
.
lastAccessedTime
=
lastAccessedTime
;
}
Integer
maxInactiveInterval
=
(
Integer
)
attrs
.
remove
(
"session:maxInactiveInterval"
);
if
(
maxInactiveInterval
!=
null
)
{
this
.
maxInactiveInterval
=
maxInactiveInterval
;
}
Long
thisAccessedTime
=
(
Long
)
attrs
.
remove
(
"session:thisAccessedTime"
);
if
(
thisAccessedTime
!=
null
)
{
this
.
thisAccessedTime
=
thisAccessedTime
;
...
...
redisson-tomcat/redisson-tomcat-9/src/main/java/org/redisson/tomcat/RedissonSessionManager.java
浏览文件 @
b2d40e43
...
...
@@ -132,6 +132,9 @@ public class RedissonSessionManager extends ManagerBase {
return
session
;
}
result
.
access
();
result
.
endAccess
();
return
result
;
}
...
...
redisson-tomcat/redisson-tomcat-9/src/test/java/org/redisson/tomcat/RedissonSessionManagerTest.java
浏览文件 @
b2d40e43
...
...
@@ -17,10 +17,38 @@ import org.redisson.config.Config;
public
class
RedissonSessionManagerTest
{
@Test
public
void
testExpiration
()
throws
Exception
{
TomcatServer
server1
=
new
TomcatServer
(
"myapp"
,
8080
,
"src/test/"
);
server1
.
start
();
Executor
executor
=
Executor
.
newInstance
();
BasicCookieStore
cookieStore
=
new
BasicCookieStore
();
executor
.
use
(
cookieStore
);
write
(
executor
,
"test"
,
"1234"
);
TomcatServer
server2
=
new
TomcatServer
(
"myapp"
,
8081
,
"src/test/"
);
server2
.
start
();
Thread
.
sleep
(
30000
);
read
(
8081
,
executor
,
"test"
,
"1234"
);
Thread
.
sleep
(
40000
);
executor
.
use
(
cookieStore
);
read
(
executor
,
"test"
,
"1234"
);
Executor
.
closeIdleConnections
();
server1
.
stop
();
server2
.
stop
();
}
@Test
public
void
testSwitchServer
()
throws
Exception
{
// start the server at http://localhost:8080/myapp
TomcatServer
server
=
new
TomcatServer
(
"
/
myapp"
,
8080
,
"src/test/"
);
TomcatServer
server
=
new
TomcatServer
(
"myapp"
,
8080
,
"src/test/"
);
server
.
start
();
Executor
executor
=
Executor
.
newInstance
();
...
...
@@ -138,6 +166,12 @@ public class RedissonSessionManagerTest {
Assert
.
assertEquals
(
"OK"
,
response
);
}
private
void
read
(
int
port
,
Executor
executor
,
String
key
,
String
value
)
throws
IOException
,
ClientProtocolException
{
String
url
=
"http://localhost:"
+
port
+
"/myapp/read?key="
+
key
;
String
response
=
executor
.
execute
(
Request
.
Get
(
url
)).
returnContent
().
asString
();
Assert
.
assertEquals
(
value
,
response
);
}
private
void
read
(
Executor
executor
,
String
key
,
String
value
)
throws
IOException
,
ClientProtocolException
{
String
url
=
"http://localhost:8080/myapp/read?key="
+
key
;
String
response
=
executor
.
execute
(
Request
.
Get
(
url
)).
returnContent
().
asString
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录