public class WebSocketHandlerAdapter extends java.lang.Object implements HandlerAdapter
HandlerAdapter that allows using a WebSocketHandler with the
generic DispatcherHandler mapping URLs directly to such handlers.
Requests are handled by delegating to the configured WebSocketService
which by default is HandshakeWebSocketService.| Constructor and Description |
|---|
WebSocketHandlerAdapter()
Default constructor that creates and uses a
HandshakeWebSocketService. |
WebSocketHandlerAdapter(WebSocketService webSocketService)
Alternative constructor with the
WebSocketService to use. |
| Modifier and Type | Method and Description |
|---|---|
WebSocketService |
getWebSocketService() |
reactor.core.publisher.Mono<HandlerResult> |
handle(ServerWebExchange exchange,
java.lang.Object handler)
Handle the request with the given handler.
|
boolean |
supports(java.lang.Object handler)
Whether this
HandlerAdapter supports the given handler. |
public WebSocketHandlerAdapter()
HandshakeWebSocketService.public WebSocketHandlerAdapter(WebSocketService webSocketService)
WebSocketService to use.public WebSocketService getWebSocketService()
public boolean supports(java.lang.Object handler)
HandlerAdapterHandlerAdapter supports the given handler.supports in interface HandlerAdapterhandler - handler object to checkpublic reactor.core.publisher.Mono<HandlerResult> handle(ServerWebExchange exchange, java.lang.Object handler)
HandlerAdapterImplementations are encouraged to handle exceptions resulting from the invocation of a handler in order and if necessary to return an alternate result that represents an error response.
Furthermore since an async HandlerResult may produce an error
later during result handling implementations are also encouraged to
set an exception
handler on the HandlerResult so that may also be applied later
after result handling.
handle in interface HandlerAdapterexchange - current server exchangehandler - the selected handler which must have been previously
checked via HandlerAdapter.supports(Object)Mono that emits a single HandlerResult or none if
the request has been fully handled and doesn't require further handling.