Top Description Fields Constructors Methods
org.springframework.web.reactive.socket.adapter

public final Class ContextWebSocketHandler

extends Object
implements WebSocketHandler
Class Inheritance
All Implemented Interfaces
org.springframework.web.reactive.socket.WebSocketHandler
Imports
java.util.List, reactor.core.publisher.Mono, reactor.util.context.ContextView, org.springframework.web.reactive.socket.WebSocketHandler, .WebSocketSession

WebSocketHandler decorator that enriches the context of the target handler.
Author
Rossen Stoyanchev
Since
5.3.3

Field Summary

Modifier and TypeField and Description
private final ContextView
private final WebSocketHandler

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static WebSocketHandler
decorate(WebSocketHandler handler, ContextView contextView)

Return the given handler, decorated to insert the given context, or the same handler instance when the context is empty.

public List<String>
getSubProtocols()

Overrides default org.springframework.web.reactive.socket.WebSocketHandler.getSubProtocols.

Return the list of sub-protocols supported by this handler.

public Mono<Void>
handle(WebSocketSession
the session to handle
session
)

Implements org.springframework.web.reactive.socket.WebSocketHandler.handle.

Invoked when a new WebSocket connection is established, and allows handling of the session.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextViewback to summary
private final ContextView contextView
delegateback to summary
private final WebSocketHandler delegate

Constructor Detail

ContextWebSocketHandlerback to summary
private ContextWebSocketHandler(WebSocketHandler delegate, ContextView contextView)

Method Detail

decorateback to summary
public static WebSocketHandler decorate(WebSocketHandler handler, ContextView contextView)

Return the given handler, decorated to insert the given context, or the same handler instance when the context is empty.

getSubProtocolsback to summary
public List<String> getSubProtocols()

Overrides default org.springframework.web.reactive.socket.WebSocketHandler.getSubProtocols.

Doc from org.springframework.web.reactive.socket.WebSocketHandler.getSubProtocols.

Return the list of sub-protocols supported by this handler.

By default an empty list is returned.

Annotations
@Override
handleback to summary
public Mono<Void> handle(WebSocketSession session)

Implements org.springframework.web.reactive.socket.WebSocketHandler.handle.

Doc from org.springframework.web.reactive.socket.WebSocketHandler.handle.

Invoked when a new WebSocket connection is established, and allows handling of the session.

See the class-level doc and the reference manual for more details and examples of how to handle the session.

Parameters
session:WebSocketSession

the session to handle

Returns:Mono<Void>

indicates when application handling of the session is complete, which should reflect the completion of the inbound message stream (i.e. connection closing) and possibly the completion of the outbound message stream and the writing of messages

Annotations
@Override