Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
e60e8dc5
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e60e8dc5
编写于
9月 30, 2013
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix issue with getting SockJS path
Issue: SPR-10923
上级
6ddacdc0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
2 deletion
+13
-2
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java
...work/web/socket/sockjs/support/AbstractSockJsService.java
+1
-1
spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/AbstractSockJsServiceTests.java
...web/socket/sockjs/support/AbstractSockJsServiceTests.java
+12
-1
未找到文件。
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java
浏览文件 @
e60e8dc5
...
...
@@ -374,7 +374,7 @@ public abstract class AbstractSockJsService implements SockJsService {
// Try SockJS prefix hints
if
(!
this
.
validSockJsPrefixes
.
isEmpty
())
{
for
(
String
prefix
:
this
.
validSockJsPrefixes
)
{
int
index
=
path
.
i
ndexOf
(
prefix
);
int
index
=
path
.
lastI
ndexOf
(
prefix
);
if
(
index
!=
-
1
)
{
this
.
knownSockJsPrefixes
.
add
(
path
.
substring
(
0
,
index
+
prefix
.
length
()));
return
path
.
substring
(
index
+
prefix
.
length
());
...
...
spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/AbstractSockJsServiceTests.java
浏览文件 @
e60e8dc5
...
...
@@ -113,6 +113,17 @@ public class AbstractSockJsServiceTests extends AbstractHttpRequestTests {
assertSame
(
this
.
handler
,
this
.
service
.
handler
);
}
// SPR-10923
@Test
public
void
getSockJsPathWithPartlyMatchingServletPath
()
throws
Exception
{
this
.
service
.
setValidSockJsPrefixes
(
"/snake"
);
handleRequest
(
"GET"
,
"/snakedemo/snake/info"
,
HttpStatus
.
OK
);
assertTrue
(
this
.
servletResponse
.
getContentAsString
().
startsWith
(
"{\"entropy\":"
));
}
@Test
public
void
validateRequest
()
throws
Exception
{
...
...
@@ -146,7 +157,7 @@ public class AbstractSockJsServiceTests extends AbstractHttpRequestTests {
String
body
=
this
.
servletResponse
.
getContentAsString
();
assertEquals
(
"{\"entropy\""
,
body
.
substring
(
0
,
body
.
indexOf
(
':'
)));
assertEquals
(
",\"origins\":[\"*:*\"],\"cookie_needed\":
fals
e,\"websocket\":true}"
,
assertEquals
(
",\"origins\":[\"*:*\"],\"cookie_needed\":
tru
e,\"websocket\":true}"
,
body
.
substring
(
body
.
indexOf
(
','
)));
this
.
service
.
setSessionCookieNeeded
(
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录