Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
6eea4ad6
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 搜索 >>
提交
6eea4ad6
编写于
7月 17, 2013
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Upgrade websocket module to servlet api 3.1.0
上级
7823c5d6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
8 deletion
+10
-8
build.gradle
build.gradle
+1
-1
spring-websocket/src/main/java/org/springframework/web/socket/server/support/GlassFishRequestUpgradeStrategy.java
...ocket/server/support/GlassFishRequestUpgradeStrategy.java
+9
-7
未找到文件。
build.gradle
浏览文件 @
6eea4ad6
...
...
@@ -493,7 +493,7 @@ project("spring-websocket") {
compile
(
project
(
":spring-core"
))
compile
(
project
(
":spring-context"
))
compile
(
project
(
":spring-web"
))
optional
(
"javax.servlet:javax.servlet-api:3.1
-b09
"
)
optional
(
"javax.servlet:javax.servlet-api:3.1
.0
"
)
optional
(
"javax.websocket:javax.websocket-api:1.0"
)
optional
(
"org.apache.tomcat:tomcat-websocket:8.0-SNAPSHOT"
)
{
exclude
group:
"org.apache.tomcat"
,
module:
"tomcat-websocket-api"
...
...
spring-websocket/src/main/java/org/springframework/web/socket/server/support/GlassFishRequestUpgradeStrategy.java
浏览文件 @
6eea4ad6
...
...
@@ -37,6 +37,7 @@ import org.glassfish.tyrus.server.TyrusEndpoint;
import
org.glassfish.tyrus.servlet.TyrusHttpUpgradeHandler
;
import
org.glassfish.tyrus.websockets.Connection
;
import
org.glassfish.tyrus.websockets.Version
;
import
org.glassfish.tyrus.websockets.WebSocketApplication
;
import
org.glassfish.tyrus.websockets.WebSocketEngine
;
import
org.glassfish.tyrus.websockets.WebSocketEngine.WebSocketHolderListener
;
import
org.springframework.http.HttpHeaders
;
...
...
@@ -80,28 +81,28 @@ public class GlassFishRequestUpgradeStrategy extends AbstractStandardUpgradeStra
HttpServletResponse
servletResponse
=
((
ServletServerHttpResponse
)
response
).
getServletResponse
();
servletResponse
=
new
AlreadyUpgradedResponseWrapper
(
servletResponse
);
TyrusEndpoint
tyrusEndpoint
=
createTyrusEndpoint
(
servletRequest
,
endpoint
,
selectedProtocol
);
WebSocketApplication
wsApp
=
createTyrusEndpoint
(
servletRequest
,
endpoint
,
selectedProtocol
);
WebSocketEngine
engine
=
WebSocketEngine
.
getEngine
();
try
{
engine
.
register
(
tyrusEndpoint
);
engine
.
register
(
wsApp
);
}
catch
(
DeploymentException
ex
)
{
throw
new
HandshakeFailureException
(
"Failed to deploy endpoint in GlassFish"
,
ex
);
}
try
{
if
(!
performUpgrade
(
servletRequest
,
servletResponse
,
request
.
getHeaders
(),
tyrusEndpoint
))
{
if
(!
performUpgrade
(
servletRequest
,
servletResponse
,
request
.
getHeaders
(),
wsApp
))
{
throw
new
HandshakeFailureException
(
"Failed to upgrade HttpServletRequest"
);
}
}
finally
{
engine
.
unregister
(
tyrusEndpoint
);
engine
.
unregister
(
wsApp
);
}
}
private
boolean
performUpgrade
(
HttpServletRequest
request
,
HttpServletResponse
response
,
HttpHeaders
headers
,
TyrusEndpoint
tyrusEndpoint
)
throws
IOException
{
HttpHeaders
headers
,
WebSocketApplication
wsApp
)
throws
IOException
{
final
TyrusHttpUpgradeHandler
upgradeHandler
;
try
{
...
...
@@ -114,7 +115,7 @@ public class GlassFishRequestUpgradeStrategy extends AbstractStandardUpgradeStra
Connection
connection
=
createConnection
(
upgradeHandler
,
response
);
RequestContext
wsRequest
=
RequestContext
.
Builder
.
create
()
.
requestURI
(
URI
.
create
(
tyrusEndpoint
.
getPath
())).
requestPath
(
tyrusEndpoint
.
getPath
())
.
requestURI
(
URI
.
create
(
wsApp
.
getPath
())).
requestPath
(
wsApp
.
getPath
())
.
connection
(
connection
).
secure
(
request
.
isSecure
()).
build
();
for
(
String
header
:
headers
.
keySet
())
{
...
...
@@ -129,7 +130,8 @@ public class GlassFishRequestUpgradeStrategy extends AbstractStandardUpgradeStra
});
}
private
TyrusEndpoint
createTyrusEndpoint
(
HttpServletRequest
request
,
Endpoint
endpoint
,
String
selectedProtocol
)
{
private
WebSocketApplication
createTyrusEndpoint
(
HttpServletRequest
request
,
Endpoint
endpoint
,
String
selectedProtocol
)
{
// Use randomized path
String
requestUri
=
request
.
getRequestURI
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录