Class AbstractWebSocketHandlerRegistration<M>
java.lang.Object
org.springframework.web.socket.config.annotation.AbstractWebSocketHandlerRegistration<M>
- Type Parameters:
- M- the mappings type
- All Implemented Interfaces:
- WebSocketHandlerRegistration
- Direct Known Subclasses:
- ServletWebSocketHandlerRegistration
public abstract class AbstractWebSocketHandlerRegistration<M>
extends Object
implements WebSocketHandlerRegistration
Base class for 
WebSocketHandlerRegistrations that gathers all the configuration
options but allows subclasses to put together the actual HTTP request mappings.- Since:
- 4.0
- Author:
- Rossen Stoyanchev, Sebastien Deleuze
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddHandler(WebSocketHandler handler, String... paths) Add more handlers that will share the same configuration (interceptors, SockJS config, etc).addInterceptors(HandshakeInterceptor... interceptors) Configure interceptors for the handshake request.protected abstract voidaddSockJsServiceMapping(M mappings, SockJsService sockJsService, WebSocketHandler handler, String pathPattern) protected abstract voidaddWebSocketHandlerMapping(M mappings, WebSocketHandler wsHandler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path) protected abstract Mprotected @Nullable HandshakeHandlerprotected HandshakeInterceptor[]protected final Mprotected @Nullable SockJsServiceRegistrationExpose theSockJsServiceRegistration-- if SockJS is enabled ornullotherwise -- so that it can be configured with a TaskScheduler if the application did not provide one.setAllowedOriginPatterns(String... allowedOriginPatterns) Alternative toWebSocketHandlerRegistration.setAllowedOrigins(String...)that supports more flexible patterns for specifying the origins for which cross-origin requests are allowed from a browser.setAllowedOrigins(String... allowedOrigins) Set the origins for which cross-origin requests are allowed from a browser.setHandshakeHandler(@Nullable HandshakeHandler handshakeHandler) Configure the HandshakeHandler to use.Enable SockJS fallback options.
- 
Constructor Details- 
AbstractWebSocketHandlerRegistrationpublic AbstractWebSocketHandlerRegistration()
 
- 
- 
Method Details- 
addHandlerDescription copied from interface:WebSocketHandlerRegistrationAdd more handlers that will share the same configuration (interceptors, SockJS config, etc).- Specified by:
- addHandlerin interface- WebSocketHandlerRegistration
 
- 
setHandshakeHandlerpublic WebSocketHandlerRegistration setHandshakeHandler(@Nullable HandshakeHandler handshakeHandler) Description copied from interface:WebSocketHandlerRegistrationConfigure the HandshakeHandler to use.- Specified by:
- setHandshakeHandlerin interface- WebSocketHandlerRegistration
 
- 
getHandshakeHandler
- 
addInterceptorsDescription copied from interface:WebSocketHandlerRegistrationConfigure interceptors for the handshake request.- Specified by:
- addInterceptorsin interface- WebSocketHandlerRegistration
 
- 
setAllowedOriginsDescription copied from interface:WebSocketHandlerRegistrationSet the origins for which cross-origin requests are allowed from a browser. Please, refer toCorsConfiguration.setAllowedOrigins(List)for format details and considerations, and keep in mind that the CORS spec does not allow use of"*"withallowCredentials=true. For more flexible origin patterns useWebSocketHandlerRegistration.setAllowedOriginPatterns(String...)instead.By default, no origins are allowed. When allowedOriginPatternsis also set, then that takes precedence over this property.Note when SockJS is enabled and origins are restricted, transport types that do not allow to check request origin (Iframe based transports) are disabled. As a consequence, IE 6 to 9 are not supported when origins are restricted. - Specified by:
- setAllowedOriginsin interface- WebSocketHandlerRegistration
- See Also:
 
- 
setAllowedOriginPatternsDescription copied from interface:WebSocketHandlerRegistrationAlternative toWebSocketHandlerRegistration.setAllowedOrigins(String...)that supports more flexible patterns for specifying the origins for which cross-origin requests are allowed from a browser. Please, refer toCorsConfiguration.setAllowedOriginPatterns(List)for format details and other considerations.By default this is not set. - Specified by:
- setAllowedOriginPatternsin interface- WebSocketHandlerRegistration
 
- 
withSockJSDescription copied from interface:WebSocketHandlerRegistrationEnable SockJS fallback options.- Specified by:
- withSockJSin interface- WebSocketHandlerRegistration
 
- 
getInterceptors
- 
getSockJsServiceRegistrationExpose theSockJsServiceRegistration-- if SockJS is enabled ornullotherwise -- so that it can be configured with a TaskScheduler if the application did not provide one. This should be done prior to callinggetMappings().
- 
getMappings
- 
createMappings
- 
addSockJsServiceMappingprotected abstract void addSockJsServiceMapping(M mappings, SockJsService sockJsService, WebSocketHandler handler, String pathPattern) 
- 
addWebSocketHandlerMappingprotected abstract void addWebSocketHandlerMapping(M mappings, WebSocketHandler wsHandler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path) 
 
-