类 AbstractWebSocketHandlerRegistration<M>
- java.lang.Object
- org.springframework.web.socket.config.annotation.AbstractWebSocketHandlerRegistration<M>
- 类型参数:
M
- the mappings type
- 所有已实现的接口:
WebSocketHandlerRegistration
public abstract class AbstractWebSocketHandlerRegistration<M> extends Object implements WebSocketHandlerRegistration
Base class forWebSocketHandlerRegistrations
that gathers all the configuration options but allows sub-classes to put together the actual HTTP request mappings.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Sebastien Deleuze
构造器概要
构造器 构造器 说明 AbstractWebSocketHandlerRegistration()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 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()
protected SockJsServiceRegistration
getSockJsServiceRegistration()
Expose theSockJsServiceRegistration
-- if SockJS is enabled ornull
otherwise -- so that it can be configured with a TaskScheduler if the application did not provide one.WebSocketHandlerRegistration
setAllowedOrigins(String... allowedOrigins)
Configure allowedOrigin
header values.WebSocketHandlerRegistration
setHandshakeHandler(HandshakeHandler handshakeHandler)
Configure the HandshakeHandler to use.SockJsServiceRegistration
withSockJS()
Enable SockJS fallback options.
构造器详细资料
AbstractWebSocketHandlerRegistration
public AbstractWebSocketHandlerRegistration()
方法详细资料
addHandler
public WebSocketHandlerRegistration addHandler(WebSocketHandler handler, String... paths)
从接口复制的说明:WebSocketHandlerRegistration
Add more handlers that will share the same configuration (interceptors, SockJS config, etc).- 指定者:
addHandler
在接口中WebSocketHandlerRegistration
setHandshakeHandler
public WebSocketHandlerRegistration setHandshakeHandler(@Nullable HandshakeHandler handshakeHandler)
从接口复制的说明:WebSocketHandlerRegistration
Configure the HandshakeHandler to use.
getHandshakeHandler
@Nullable protected HandshakeHandler getHandshakeHandler()
addInterceptors
public WebSocketHandlerRegistration addInterceptors(HandshakeInterceptor... interceptors)
从接口复制的说明:WebSocketHandlerRegistration
Configure interceptors for the handshake request.
setAllowedOrigins
public WebSocketHandlerRegistration setAllowedOrigins(String... allowedOrigins)
从接口复制的说明:WebSocketHandlerRegistration
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 (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).
withSockJS
public SockJsServiceRegistration withSockJS()
从接口复制的说明:WebSocketHandlerRegistration
Enable SockJS fallback options.- 指定者:
withSockJS
在接口中WebSocketHandlerRegistration
getInterceptors
protected HandshakeInterceptor[] getInterceptors()
getSockJsServiceRegistration
@Nullable protected SockJsServiceRegistration getSockJsServiceRegistration()
Expose theSockJsServiceRegistration
-- if SockJS is enabled ornull
otherwise -- so that it can be configured with a TaskScheduler if the application did not provide one. This should be done prior to callinggetMappings()
.
getMappings
protected final M getMappings()
createMappings
protected abstract M createMappings()
addSockJsServiceMapping
protected abstract void addSockJsServiceMapping(M mappings, SockJsService sockJsService, WebSocketHandler handler, String pathPattern)
addWebSocketHandlerMapping
protected abstract void addWebSocketHandlerMapping(M mappings, WebSocketHandler wsHandler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path)