Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
4de40fad
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,发现更多精彩内容 >>
提交
4de40fad
编写于
5月 30, 2013
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor STOMP package and class names
上级
2b5acbda
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
18 addition
and
28 deletion
+18
-28
build.gradle
build.gradle
+1
-1
spring-websocket/src/main/java/org/springframework/web/messaging/MessageType.java
...n/java/org/springframework/web/messaging/MessageType.java
+3
-6
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/service/RelayStompService.java
...mework/web/messaging/stomp/service/RelayStompService.java
+2
-3
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/service/SimpleStompService.java
...ework/web/messaging/stomp/service/SimpleStompService.java
+1
-1
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/socket/AbstractStompWebSocketHandler.java
...messaging/stomp/socket/AbstractStompWebSocketHandler.java
+5
-10
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/socket/DefaultStompWebSocketHandler.java
.../messaging/stomp/socket/DefaultStompWebSocketHandler.java
+5
-6
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/socket/WebSocketStompSession.java
...ork/web/messaging/stomp/socket/WebSocketStompSession.java
+1
-1
未找到文件。
build.gradle
浏览文件 @
4de40fad
...
...
@@ -490,7 +490,7 @@ project("spring-websocket") {
repositories
{
maven
{
url
"https://repository.apache.org/content/repositories/snapshots"
}
// tomcat-websocket-* snapshots
maven
{
url
"https://maven.java.net/content/repositories/releases"
}
// javax.websocket, tyrus
maven
{
url
'http://repo.springsource.org/
libs-
snapshot'
}
// reactor
maven
{
url
'http://repo.springsource.org/snapshot'
}
// reactor
}
}
...
...
spring-websocket/src/main/java/org/springframework/web/messaging/
stomp/adapter/StompMessageHandler
.java
→
spring-websocket/src/main/java/org/springframework/web/messaging/
MessageType
.java
浏览文件 @
4de40fad
...
...
@@ -14,18 +14,15 @@
* limitations under the License.
*/
package
org.springframework.web.messaging.stomp.adapter
;
import
org.springframework.web.messaging.stomp.StompMessage
;
import
org.springframework.web.messaging.stomp.StompSession
;
package
org.springframework.web.messaging
;
/**
* @author Rossen Stoyanchev
* @since 4.0
*/
public
interface
StompMessageHandler
{
public
enum
MessageType
{
void
handleMessage
(
StompSession
stompSession
,
StompMessage
message
);
CONNECT
,
SUBSCRIBE
,
UNSUBSCRIBE
,
SEND
,
NONE
}
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/serv
er
/RelayStompService.java
→
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/serv
ice
/RelayStompService.java
浏览文件 @
4de40fad
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package
org.springframework.web.messaging.stomp.serv
er
;
package
org.springframework.web.messaging.stomp.serv
ice
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
...
...
@@ -63,7 +63,7 @@ public class RelayStompService {
public
RelayStompService
(
Reactor
reactor
,
TaskExecutor
executor
)
{
this
.
reactor
=
reactor
;
this
.
taskExecutor
=
executor
;
// For now, a naive
ly
way to manage socket reading
this
.
taskExecutor
=
executor
;
// For now, a naive way to manage socket reading
this
.
reactor
.
on
(
Fn
.
$
(
StompCommand
.
CONNECT
),
new
ConnectConsumer
());
this
.
reactor
.
on
(
Fn
.
$
(
StompCommand
.
SUBSCRIBE
),
new
RelayConsumer
());
...
...
@@ -228,7 +228,6 @@ public class RelayStompService {
relayStompMessage
(
session
,
stompMessage
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
clearRelaySession
(
stompMessage
.
getStompSessionId
());
}
...
...
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/serv
er
/SimpleStompService.java
→
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/serv
ice
/SimpleStompService.java
浏览文件 @
4de40fad
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package
org.springframework.web.messaging.stomp.serv
er
;
package
org.springframework.web.messaging.stomp.serv
ice
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/
adapter/
StompWebSocketHandler.java
→
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/
socket/Abstract
StompWebSocketHandler.java
浏览文件 @
4de40fad
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.messaging.stomp.
adapter
;
package
org.springframework.web.messaging.stomp.
socket
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -34,20 +34,13 @@ import org.springframework.web.socket.adapter.TextWebSocketHandlerAdapter;
* @author Rossen Stoyanchev
* @since 4.0
*/
public
class
StompWebSocketHandler
extends
TextWebSocketHandlerAdapter
{
private
final
StompMessageHandler
messageHandler
;
public
abstract
class
AbstractStompWebSocketHandler
extends
TextWebSocketHandlerAdapter
{
private
final
StompMessageConverter
messageConverter
=
new
StompMessageConverter
();
private
final
Map
<
String
,
WebSocketStompSession
>
sessions
=
new
ConcurrentHashMap
<
String
,
WebSocketStompSession
>();
public
StompWebSocketHandler
(
StompMessageHandler
messageHandler
)
{
this
.
messageHandler
=
messageHandler
;
}
@Override
public
void
afterConnectionEstablished
(
WebSocketSession
session
)
throws
Exception
{
WebSocketStompSession
stompSession
=
new
WebSocketStompSession
(
session
,
this
.
messageConverter
);
...
...
@@ -67,7 +60,7 @@ public class StompWebSocketHandler extends TextWebSocketHandlerAdapter {
// TODO: validate size limits
// http://stomp.github.io/stomp-specification-1.2.html#Size_Limits
this
.
messageHandler
.
handle
Message
(
stompSession
,
stompMessage
);
handleStomp
Message
(
stompSession
,
stompMessage
);
// TODO: send RECEIPT message if incoming message has "receipt" header
// http://stomp.github.io/stomp-specification-1.2.html#Header_receipt
...
...
@@ -86,6 +79,8 @@ public class StompWebSocketHandler extends TextWebSocketHandlerAdapter {
}
}
protected
abstract
void
handleStompMessage
(
StompSession
stompSession
,
StompMessage
stompMessage
);
@Override
public
void
afterConnectionClosed
(
WebSocketSession
session
,
CloseStatus
status
)
throws
Exception
{
WebSocketStompSession
stompSession
=
this
.
sessions
.
remove
(
session
.
getId
());
...
...
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/s
erver/ServerStompMessage
Handler.java
→
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/s
ocket/DefaultStompWebSocket
Handler.java
浏览文件 @
4de40fad
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.messaging.stomp.s
erver
;
package
org.springframework.web.messaging.stomp.s
ocket
;
import
java.io.IOException
;
import
java.util.ArrayList
;
...
...
@@ -30,7 +30,6 @@ import org.springframework.web.messaging.stomp.StompException;
import
org.springframework.web.messaging.stomp.StompHeaders
;
import
org.springframework.web.messaging.stomp.StompMessage
;
import
org.springframework.web.messaging.stomp.StompSession
;
import
org.springframework.web.messaging.stomp.adapter.StompMessageHandler
;
import
reactor.Fn
;
import
reactor.core.Reactor
;
...
...
@@ -43,9 +42,9 @@ import reactor.fn.Registration;
* @author Rossen Stoyanchev
* @since 4.0
*/
public
class
ServerStompMessageHandler
implements
StompMessage
Handler
{
public
class
DefaultStompWebSocketHandler
extends
AbstractStompWebSocket
Handler
{
private
static
Log
logger
=
LogFactory
.
getLog
(
ServerStompMessage
Handler
.
class
);
private
static
Log
logger
=
LogFactory
.
getLog
(
DefaultStompWebSocket
Handler
.
class
);
private
final
Reactor
reactor
;
...
...
@@ -54,11 +53,11 @@ public class ServerStompMessageHandler implements StompMessageHandler {
new
ConcurrentHashMap
<
String
,
List
<
Registration
<?>>>();
public
ServerStompMessage
Handler
(
Reactor
reactor
)
{
public
DefaultStompWebSocket
Handler
(
Reactor
reactor
)
{
this
.
reactor
=
reactor
;
}
public
void
handleMessage
(
StompSession
session
,
StompMessage
message
)
{
public
void
handle
Stomp
Message
(
StompSession
session
,
StompMessage
message
)
{
try
{
StompCommand
command
=
message
.
getCommand
();
if
(
StompCommand
.
CONNECT
.
equals
(
command
)
||
StompCommand
.
STOMP
.
equals
(
command
))
{
...
...
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/
adapter
/WebSocketStompSession.java
→
spring-websocket/src/main/java/org/springframework/web/messaging/stomp/
socket
/WebSocketStompSession.java
浏览文件 @
4de40fad
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package
org.springframework.web.messaging.stomp.
adapter
;
package
org.springframework.web.messaging.stomp.
socket
;
import
java.io.IOException
;
import
java.util.ArrayList
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录