类 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 forWebSocketHandlerRegistrationsthat gathers all the configuration options but allows sub-classes to put together the actual HTTP request mappings.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Sebastien Deleuze
构造器概要
构造器 构造器 说明 AbstractWebSocketHandlerRegistration()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 WebSocketHandlerRegistrationaddHandler(WebSocketHandler handler, String... paths)Add more handlers that will share the same configuration (interceptors, SockJS config, etc).WebSocketHandlerRegistrationaddInterceptors(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 McreateMappings()protected HandshakeHandlergetHandshakeHandler()protected HandshakeInterceptor[]getInterceptors()protected MgetMappings()protected SockJsServiceRegistrationgetSockJsServiceRegistration()Expose theSockJsServiceRegistration-- if SockJS is enabled ornullotherwise -- so that it can be configured with a TaskScheduler if the application did not provide one.WebSocketHandlerRegistrationsetAllowedOrigins(String... allowedOrigins)Configure allowedOriginheader values.WebSocketHandlerRegistrationsetHandshakeHandler(HandshakeHandler handshakeHandler)Configure the HandshakeHandler to use.SockJsServiceRegistrationwithSockJS()Enable SockJS fallback options.
构造器详细资料
AbstractWebSocketHandlerRegistration
public AbstractWebSocketHandlerRegistration()
方法详细资料
addHandler
public WebSocketHandlerRegistration addHandler(WebSocketHandler handler, String... paths)
从接口复制的说明:WebSocketHandlerRegistrationAdd more handlers that will share the same configuration (interceptors, SockJS config, etc).- 指定者:
addHandler在接口中WebSocketHandlerRegistration
setHandshakeHandler
public WebSocketHandlerRegistration setHandshakeHandler(@Nullable HandshakeHandler handshakeHandler)
从接口复制的说明:WebSocketHandlerRegistrationConfigure the HandshakeHandler to use.
getHandshakeHandler
@Nullable protected HandshakeHandler getHandshakeHandler()
addInterceptors
public WebSocketHandlerRegistration addInterceptors(HandshakeInterceptor... interceptors)
从接口复制的说明:WebSocketHandlerRegistrationConfigure interceptors for the handshake request.
setAllowedOrigins
public WebSocketHandlerRegistration setAllowedOrigins(String... allowedOrigins)
从接口复制的说明:WebSocketHandlerRegistrationConfigure 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 (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()
从接口复制的说明:WebSocketHandlerRegistrationEnable SockJS fallback options.- 指定者:
withSockJS在接口中WebSocketHandlerRegistration
getInterceptors
protected HandshakeInterceptor[] getInterceptors()
getSockJsServiceRegistration
@Nullable protected SockJsServiceRegistration getSockJsServiceRegistration()
Expose 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
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)