public abstract class AbstractWebSocketHandlerRegistration<M> extends Object implements WebSocketHandlerRegistration
WebSocketHandlerRegistrations that gathers all the configuration
options but allows sub-classes to put together the actual HTTP request mappings.| Constructor and Description |
|---|
AbstractWebSocketHandlerRegistration(TaskScheduler defaultTaskScheduler) |
| Modifier and Type | Method and Description |
|---|---|
WebSocketHandlerRegistration |
addHandler(WebSocketHandler handler,
String... paths)
Add more handlers that will share the same configuration (interceptors, SockJS
config, etc)
|
WebSocketHandlerRegistration |
addInterceptors(HandshakeInterceptor... interceptors)
Configure interceptors for the handshake request.
|
protected abstract void |
addSockJsServiceMapping(M mappings,
SockJsService sockJsService,
WebSocketHandler handler,
String pathPattern) |
protected abstract void |
addWebSocketHandlerMapping(M mappings,
WebSocketHandler wsHandler,
HandshakeHandler handshakeHandler,
HandshakeInterceptor[] interceptors,
String path) |
protected abstract M |
createMappings() |
protected HandshakeHandler |
getHandshakeHandler() |
protected HandshakeInterceptor[] |
getInterceptors() |
protected M |
getMappings() |
WebSocketHandlerRegistration |
setAllowedOrigins(String... origins)
Configure allowed
Origin header values. |
WebSocketHandlerRegistration |
setHandshakeHandler(HandshakeHandler handshakeHandler)
Configure the HandshakeHandler to use.
|
SockJsServiceRegistration |
withSockJS()
Enable SockJS fallback options.
|
public AbstractWebSocketHandlerRegistration(TaskScheduler defaultTaskScheduler)
public WebSocketHandlerRegistration addHandler(WebSocketHandler handler, String... paths)
WebSocketHandlerRegistrationaddHandler in interface WebSocketHandlerRegistrationpublic WebSocketHandlerRegistration setHandshakeHandler(HandshakeHandler handshakeHandler)
WebSocketHandlerRegistrationsetHandshakeHandler in interface WebSocketHandlerRegistrationprotected HandshakeHandler getHandshakeHandler()
public WebSocketHandlerRegistration addInterceptors(HandshakeInterceptor... interceptors)
WebSocketHandlerRegistrationaddInterceptors in interface WebSocketHandlerRegistrationpublic WebSocketHandlerRegistration setAllowedOrigins(String... origins)
WebSocketHandlerRegistrationOrigin header values. This check is mostly designed for browser
clients. There is noting preventing other types of client to modify the Origin header value.
When SockJS is enabled and allowed origins are restricted, transport types that do not
use Origin headers for cross origin requests (jsonp-polling, iframe-xhr-polling,
iframe-eventsource and iframe-htmlfile) are disabled. As a consequence, IE6/IE7 won't be
supported anymore and IE8/IE9 will only be supported without cookies.
By default, all origins are allowed.
setAllowedOrigins in interface WebSocketHandlerRegistrationpublic SockJsServiceRegistration withSockJS()
WebSocketHandlerRegistrationwithSockJS in interface WebSocketHandlerRegistrationprotected HandshakeInterceptor[] getInterceptors()
protected final M getMappings()
protected abstract M createMappings()
protected abstract void addSockJsServiceMapping(M mappings, SockJsService sockJsService, WebSocketHandler handler, String pathPattern)
protected abstract void addWebSocketHandlerMapping(M mappings, WebSocketHandler wsHandler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path)