Commit Graph

231 Commits

Author SHA1 Message Date
Rossen Stoyanchev
8200601ace Tighten up exception handling strategy
WebSocketHandler implementations:
- methods must deal with exceptions locally
- uncaught runtime exceptions are handled by ending the session
- transport errors (websocket engine) are passed into handleError

WebSocketSession methods may raise IOException

SockJS implementation of WebSocketHandler:
- delegate SockJS transport errors into handleError
- stop runtime exceptions from user WebSocketHandler and end session

SockJsServce and TransportHandlers:
- raise IOException or TransportErrorException

HandshakeHandler:
- raise IOException
2013-04-25 18:31:07 -04:00
Rossen Stoyanchev
34c95034d8 Fix minor issue and polish 2013-04-24 13:29:08 -04:00
Rossen Stoyanchev
36148b7cb1 Switch DefaultSockJsService to constructor DI
DefaultSockJsService now relies on constructors and requires a
TaskScheduler at a minimum. It no longer needs lifecycle methods.
2013-04-23 21:35:24 -04:00
Rossen Stoyanchev
c28ce0e2bd Ensure WebSocketHandlerEndpoint can connect only once
WebSocketHandlerEndpoint and SockJsWebSocketHandler are stateful
wrappers that are not intended to be used with one client connection.
2013-04-23 17:44:53 -04:00
Phillip Webb
db4de526d2 Minor polish and FIXMEs 2013-04-23 13:47:52 -07:00
Phillip Webb
ff2e9aa5bc Minor tweaks to WebSocketMessage
- payload is now required
- byte data is obtained and stored only once (allowing multiple calls)
- minor formatting polish
2013-04-23 13:47:52 -07:00
Phillip Webb
a14161f0ca JettyRequestUpgradeStrategy 2013-04-23 13:47:43 -07:00
Rossen Stoyanchev
3cd4909ba3 Minor fix 2013-04-23 11:56:57 -04:00
Rossen Stoyanchev
84089bf396 Add HandlerProvider interface
HandlerProvider is now an interface that can be used to plug in
WebSocket handlers with per-connection scope semantics. There are two
implementations, of the interface, one simple and a second that creates
handler instances through AutowireCapableBeanFactory.

HandlerProvider also provides a destroy method that is used to
apply a destroy callback whenever a client connection closes.
2013-04-23 11:48:10 -04:00
Rossen Stoyanchev
f9078c947f Add WebSocketMessage and WebSocketHandler sub-interfcs
There is now a WebSocketMessage type with TextMessage and BinaryMessage
sub-types. WebSocketHandler is also sub-divided into TextMessageHandler
and BinaryMessageHandler, so that applications can choose to handle
text, binary, or both.

Also in this commit, the SockJsHandler and SockJsSession interfaces
have been removed. SockJsService now accepts WebSocketHandler.
2013-04-22 17:59:19 -04:00
Rossen Stoyanchev
2046629945 Add WebSocketClient and WebSocketConnectionManager
This change adds a WebSocketClient abstraction and enables the use of
WebSocketHandler on the client side.
2013-04-21 10:04:44 -04:00
Rossen Stoyanchev
ab5d60d343 Improve APIs for WebSocket and SockJS messages 2013-04-18 22:04:18 -04:00
Rossen Stoyanchev
6273fc41f1 Rename SockJS session type to include "SockJs" 2013-04-17 11:26:20 -04:00
Rossen Stoyanchev
2794224b28 Add onClosed to SockJsSessionSupport sub-classes
As opposed to close(), which actively closes the session, the
onClosed method is called when the underlying connection has been
closed or disconnected.
2013-04-17 11:19:28 -04:00
Rossen Stoyanchev
f056f7e2ad Init and destroy internally created SockJS schedulers 2013-04-15 15:28:06 -04:00
Rossen Stoyanchev
177e082172 Refactor SockJS and WebSocket layer configuration
Add HandlerProvider<T> class
Modify HandshakeHandler to accept + adapt WebSocketHandler at runtime
Modify SockJsService to accept + adapt SockJsHandler at runtime
2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
71e82069ce Add SockJsSessionFactory 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
3a2c15b0fd Add flush method to ServerHttpResponse
This is useful to make sure response headers are written to the
underlying response. It is also useful in conjunction with long
running, async requests and HTTP streaming, to ensure the Servlet
response buffer is sent to the client without additional delay and
also causes an IOException to be raised if the client has gone away.
2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
db6f8f2d4b Add package-info, javadoc, and update package names 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
592da431a8 Add Glassfish request upgrade strategy 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
6bd6311214 Refactor SockJS code
- configure SockJS handler by type (as well as by instance)
- add method to obtain SockJS handler instance via SockJsConfiguration
- detect presense of jsr-356 and use it if available
2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
4ad6091510 Debug and test SockJS server support 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
41153efd03 Polish in EndpointRegistration 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
6cf17449fa Add endpoint connection manager 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
914e969ac3 Add support for @ServerEndpoint annotated classes 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
88447e503b Add first cut of SockJS server support 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
30ab5953f9 Add EndpointRequestUpgradeStrategy
Now there is just one EndpointHandshakeRequestHandler that works on
different runtimes.
2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
741927664c Update package structure 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
715018fe75 Add handshake request handler abstraction 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
cdd7d7bd88 Add javax.websocket.Endpoint configuration support 2013-04-15 11:03:24 -04:00
Rossen Stoyanchev
4e67f809fb Add spring-websocket module 2013-04-15 11:03:23 -04:00