WebSocketService implementation that handles a WebSocket HTTP
handshake request by delegating to a RequestUpgradeStrategy which
is either auto-detected (no-arg constructor) from the classpath but can
also be explicitly configured.
| Modifier and Type | Class and Description |
|---|---|
| private static class | HandshakeWebSocketService.
Inner class to avoid a reachable dependency on Reactor Netty API. |
| Modifier and Type | Field and Description |
|---|---|
| private static final Mono | |
| private static final boolean | |
| private static final Log | |
| private static final boolean | |
| private static final boolean | |
| private volatile boolean | |
| private static final String | |
| private static final String | |
| private Predicate | |
| private static final boolean | |
| private static final boolean | |
| private final RequestUpgradeStrategy |
| Access | Constructor and Description |
|---|---|
| public | HandshakeWebSocketService()
Default constructor automatic, classpath detection based discovery of the
|
| public | HandshakeWebSocketService(RequestUpgradeStrategy
the strategy to use upgradeStrategy)Alternative constructor with the |
| Modifier and Type | Method and Description |
|---|---|
| private HandshakeInfo | createHandshakeInfo(ServerWebExchange exchange, ServerHttpRequest request, String protocol, Map<String, Object> attributes)
|
| protected void | |
| protected void | |
| public Predicate | getSessionAttributePredicate()
Return the configured predicate for initialization WebSocket session
attributes from |
| public RequestUpgradeStrategy | |
| private Mono | |
| public Mono | handleRequest(ServerWebExchange
the current exchange exchange, WebSocketHandler handler for WebSocket session handler)Implements org. Handle the request with the given |
| private Mono | |
| pack-priv static RequestUpgradeStrategy | |
| public boolean | isRunning()
Implements org. Check whether this component is currently running. |
| private String | |
| public void | setSessionAttributePredicate(Predicate<String>
the predicate predicate)Configure a predicate to use to extract
|
| public void | |
| public void | stop()
Implements org. Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method. |
| EMPTY_ATTRIBUTES | back to summary |
|---|---|
| private static final Mono<Map<String, Object>> EMPTY_ATTRIBUTES | |
| jettyWsPresent | back to summary |
|---|---|
| private static final boolean jettyWsPresent | |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| reactorNetty2Present | back to summary |
|---|---|
| private static final boolean reactorNetty2Present | |
| reactorNettyPresent | back to summary |
|---|---|
| private static final boolean reactorNettyPresent | |
| running | back to summary |
|---|---|
| private volatile boolean running | |
| SEC_WEBSOCKET_KEY | back to summary |
|---|---|
| private static final String SEC_WEBSOCKET_KEY | |
| SEC_WEBSOCKET_PROTOCOL | back to summary |
|---|---|
| private static final String SEC_WEBSOCKET_PROTOCOL | |
| sessionAttributePredicate | back to summary |
|---|---|
| private Predicate<String> sessionAttributePredicate
| |
| tomcatWsPresent | back to summary |
|---|---|
| private static final boolean tomcatWsPresent | |
| undertowWsPresent | back to summary |
|---|---|
| private static final boolean undertowWsPresent | |
| upgradeStrategy | back to summary |
|---|---|
| private final RequestUpgradeStrategy upgradeStrategy | |
| HandshakeWebSocketService | back to summary |
|---|---|
| public HandshakeWebSocketService() Default constructor automatic, classpath detection based discovery of the
| |
| HandshakeWebSocketService | back to summary |
|---|---|
| public HandshakeWebSocketService(RequestUpgradeStrategy upgradeStrategy) Alternative constructor with the
| |
| createHandshakeInfo | back to summary |
|---|---|
| private HandshakeInfo createHandshakeInfo(ServerWebExchange exchange, ServerHttpRequest request, String protocol, Map<String, Object> attributes) | |
| doStart | back to summary |
|---|---|
| protected void doStart() | |
| doStop | back to summary |
|---|---|
| protected void doStop() | |
| getSessionAttributePredicate | back to summary |
|---|---|
| public Predicate Return the configured predicate for initialization WebSocket session
attributes from
| |
| getUpgradeStrategy | back to summary |
|---|---|
| public RequestUpgradeStrategy getUpgradeStrategy() Return the | |
| handleBadRequest | back to summary |
|---|---|
| private Mono | |
| handleRequest | back to summary |
|---|---|
| public Mono Implements org. Doc from org. Handle the request with the given
| |
| initAttributes | back to summary |
|---|---|
| private Mono | |
| initUpgradeStrategy | back to summary |
|---|---|
| pack-priv static RequestUpgradeStrategy initUpgradeStrategy() | |
| isRunning | back to summary |
|---|---|
| public boolean isRunning() Implements org. Doc from org. Check whether this component is currently running. In the case of a container, this will return
| |
| selectProtocol | back to summary |
|---|---|
private String selectProtocol(HttpHeaders headers, WebSocketHandler handler)
| |
| setSessionAttributePredicate | back to summary |
|---|---|
| public void setSessionAttributePredicate(Predicate<String> predicate) Configure a predicate to use to extract
By default this is not set in which case no attributes are passed. | |
| start | back to summary |
|---|---|
| public void start() Implements org. Doc from org. Start this component. Should not throw an exception if the component is already running. In the case of a container, this will propagate the start signal to all components that apply.
| |
| stop | back to summary |
|---|---|
| public void stop() Implements org. Doc from org. Stop this component, typically in a synchronous fashion, such that the component is
fully stopped upon return of this method. Consider implementing Note that this stop notification is not guaranteed to come before destruction:
On regular shutdown, Should not throw an exception if the component is not running (not started yet). In the case of a container, this will propagate the stop signal to all components that apply.
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static RequestUpgradeStrategy | |
| public static RequestUpgradeStrategy |
| ReactorNettyStrategyDelegate | back to summary |
|---|---|
| private ReactorNettyStrategyDelegate() | |
| forReactorNetty1 | back to summary |
|---|---|
| public static RequestUpgradeStrategy forReactorNetty1() | |
| forReactorNetty2 | back to summary |
|---|---|
| public static RequestUpgradeStrategy forReactorNetty2() | |