Class WebMvcStompWebSocketEndpointRegistration
- java.lang.Object
- org.springframework.web.socket.config.annotation.WebMvcStompWebSocketEndpointRegistration
- All Implemented Interfaces:
StompWebSocketEndpointRegistration
public class WebMvcStompWebSocketEndpointRegistration extends Object implements StompWebSocketEndpointRegistration
An abstract base class for configuring STOMP over WebSocket/SockJS endpoints.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description WebMvcStompWebSocketEndpointRegistration(String[] paths, WebSocketHandler webSocketHandler, TaskScheduler sockJsTaskScheduler)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StompWebSocketEndpointRegistrationaddInterceptors(HandshakeInterceptor... interceptors)Configure the HandshakeInterceptor's to use.protected HandshakeInterceptor[]getInterceptors()MultiValueMap<HttpRequestHandler,String>getMappings()StompWebSocketEndpointRegistrationsetAllowedOrigins(String... allowedOrigins)Configure allowedOriginheader values.StompWebSocketEndpointRegistrationsetHandshakeHandler(HandshakeHandler handshakeHandler)Configure the HandshakeHandler to use.SockJsServiceRegistrationwithSockJS()Enable SockJS fallback options.
Constructor Detail
WebMvcStompWebSocketEndpointRegistration
public WebMvcStompWebSocketEndpointRegistration(String[] paths, WebSocketHandler webSocketHandler, TaskScheduler sockJsTaskScheduler)
Method Detail
setHandshakeHandler
public StompWebSocketEndpointRegistration setHandshakeHandler(HandshakeHandler handshakeHandler)
Description copied from interface:StompWebSocketEndpointRegistrationConfigure the HandshakeHandler to use.- Specified by:
setHandshakeHandlerin interfaceStompWebSocketEndpointRegistration
addInterceptors
public StompWebSocketEndpointRegistration addInterceptors(HandshakeInterceptor... interceptors)
Description copied from interface:StompWebSocketEndpointRegistrationConfigure the HandshakeInterceptor's to use.- Specified by:
addInterceptorsin interfaceStompWebSocketEndpointRegistration
setAllowedOrigins
public StompWebSocketEndpointRegistration setAllowedOrigins(String... allowedOrigins)
Description copied from interface:StompWebSocketEndpointRegistrationConfigure allowedOriginheader values. This check is mostly designed for browser clients. There is nothing preventing other types of client to modify theOriginheader value.When SockJS is enabled and origins are restricted, transport types that do not allow to check request origin (JSONP and Iframe based transports) are disabled. As a consequence, IE 6 to 9 are not supported when origins are restricted.
Each provided allowed origin must start by "http://", "https://" or be "*" (means that all origins are allowed). By default, only same origin requests are allowed (empty list).
- Specified by:
setAllowedOriginsin interfaceStompWebSocketEndpointRegistration- See Also:
- RFC 6454: The Web Origin Concept, SockJS supported transports by browser
withSockJS
public SockJsServiceRegistration withSockJS()
Description copied from interface:StompWebSocketEndpointRegistrationEnable SockJS fallback options.- Specified by:
withSockJSin interfaceStompWebSocketEndpointRegistration
getInterceptors
protected HandshakeInterceptor[] getInterceptors()
getMappings
public final MultiValueMap<HttpRequestHandler,String> getMappings()