Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
7651f83b
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,发现更多精彩内容 >>
提交
7651f83b
编写于
3月 23, 2014
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish
上级
cbd5af3a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
28 deletion
+39
-28
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractHttpSockJsSession.java
...t/sockjs/transport/session/AbstractHttpSockJsSession.java
+39
-28
未找到文件。
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractHttpSockJsSession.java
浏览文件 @
7651f83b
...
@@ -48,17 +48,6 @@ import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
...
@@ -48,17 +48,6 @@ import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
*/
*/
public
abstract
class
AbstractHttpSockJsSession
extends
AbstractSockJsSession
{
public
abstract
class
AbstractHttpSockJsSession
extends
AbstractSockJsSession
{
private
final
Queue
<
String
>
messageCache
;
private
volatile
ServerHttpResponse
response
;
private
volatile
ServerHttpAsyncRequestControl
asyncRequestControl
;
private
volatile
SockJsFrameFormat
frameFormat
;
private
volatile
boolean
requestInitialized
;
private
volatile
URI
uri
;
private
volatile
URI
uri
;
...
@@ -73,6 +62,18 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
...
@@ -73,6 +62,18 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
private
volatile
String
acceptedProtocol
;
private
volatile
String
acceptedProtocol
;
private
volatile
ServerHttpResponse
response
;
private
volatile
ServerHttpAsyncRequestControl
asyncRequestControl
;
private
volatile
SockJsFrameFormat
frameFormat
;
private
volatile
boolean
requestInitialized
;
private
final
Queue
<
String
>
messageCache
;
public
AbstractHttpSockJsSession
(
String
id
,
SockJsServiceConfig
config
,
public
AbstractHttpSockJsSession
(
String
id
,
SockJsServiceConfig
config
,
WebSocketHandler
wsHandler
,
Map
<
String
,
Object
>
attributes
)
{
WebSocketHandler
wsHandler
,
Map
<
String
,
Object
>
attributes
)
{
...
@@ -107,9 +108,9 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
...
@@ -107,9 +108,9 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
}
}
/**
/**
* Unlike WebSocket where sub-protocol negotiation is part of the
* Unlike WebSocket where sub-protocol negotiation is part of the
initial
*
initial handshake, in HTTP transports the same negotiation must
*
handshake, in HTTP transports the same negotiation must be emulated and
*
be emulated and
the selected protocol set through this setter.
* the selected protocol set through this setter.
* @param protocol the sub-protocol to set
* @param protocol the sub-protocol to set
*/
*/
public
void
setAcceptedProtocol
(
String
protocol
)
{
public
void
setAcceptedProtocol
(
String
protocol
)
{
...
@@ -123,6 +124,30 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
...
@@ -123,6 +124,30 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
return
this
.
acceptedProtocol
;
return
this
.
acceptedProtocol
;
}
}
/**
* Return response for the current request, or {@code null} if between requests.
*/
protected
ServerHttpResponse
getResponse
()
{
return
this
.
response
;
}
/**
* Return the SockJS buffer for messages stored transparently between polling
* requests. If the polling request takes longer than 5 seconds, the session
* will be closed.
*
* @see org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService
*/
protected
Queue
<
String
>
getMessageCache
()
{
return
this
.
messageCache
;
}
@Override
public
boolean
isActive
()
{
ServerHttpAsyncRequestControl
control
=
this
.
asyncRequestControl
;
return
(
control
!=
null
&&
!
control
.
isCompleted
());
}
@Override
@Override
public
List
<
WebSocketExtension
>
getExtensions
()
{
public
List
<
WebSocketExtension
>
getExtensions
()
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
...
@@ -246,20 +271,6 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
...
@@ -246,20 +271,6 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
}
}
}
}
@Override
public
boolean
isActive
()
{
ServerHttpAsyncRequestControl
control
=
this
.
asyncRequestControl
;
return
(
control
!=
null
&&
!
control
.
isCompleted
());
}
protected
Queue
<
String
>
getMessageCache
()
{
return
this
.
messageCache
;
}
protected
ServerHttpResponse
getResponse
()
{
return
this
.
response
;
}
@Override
@Override
protected
final
void
sendMessageInternal
(
String
message
)
throws
SockJsTransportFailureException
{
protected
final
void
sendMessageInternal
(
String
message
)
throws
SockJsTransportFailureException
{
this
.
messageCache
.
add
(
message
);
this
.
messageCache
.
add
(
message
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录