接口 WebSocketHandlerRegistration
public interface WebSocketHandlerRegistration
Provides methods for configuring a WebSocket handler.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 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.WebSocketHandlerRegistration
setAllowedOrigins(String... origins)
Configure allowedOrigin
header values.WebSocketHandlerRegistration
setHandshakeHandler(HandshakeHandler handshakeHandler)
Configure the HandshakeHandler to use.SockJsServiceRegistration
withSockJS()
Enable SockJS fallback options.
方法详细资料
addHandler
WebSocketHandlerRegistration addHandler(WebSocketHandler handler, String... paths)
Add more handlers that will share the same configuration (interceptors, SockJS config, etc)
setHandshakeHandler
WebSocketHandlerRegistration setHandshakeHandler(HandshakeHandler handshakeHandler)
Configure the HandshakeHandler to use.
addInterceptors
WebSocketHandlerRegistration addInterceptors(HandshakeInterceptor... interceptors)
Configure interceptors for the handshake request.
setAllowedOrigins
WebSocketHandlerRegistration setAllowedOrigins(String... origins)
Configure allowedOrigin
header values. This check is mostly designed for browser clients. There is nothing preventing other types of client to modify theOrigin
header 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).
- 从以下版本开始:
- 4.1.2
- 另请参阅:
- RFC 6454: The Web Origin Concept, SockJS supported transports by browser
withSockJS
SockJsServiceRegistration withSockJS()
Enable SockJS fallback options.