org.springframework.web.reactive.socket.server.upgrade

## Class JettyRequestUpgradeStrategy

- java.lang.Object
- - org.springframework.web.reactive.socket.server.upgrade.JettyRequestUpgradeStrategy

All Implemented Interfaces:
  org.springframework.context.Lifecycle, RequestUpgradeStrategy

    public class JettyRequestUpgradeStrategy
    extends Object
    implements RequestUpgradeStrategy, org.springframework.context.Lifecycle

A `RequestUpgradeStrategy` for use with Jetty.

Since:
  5.0
Author:
  Violeta Georgieva, Rossen Stoyanchev

### Constructor Summary

Constructors
Constructor and Description
`JettyRequestUpgradeStrategy()`

### Method Summary

All Methods Instance Methods Concrete Methods
`org.eclipse.jetty.websocket.api.WebSocketPolicy` `getWebSocketPolicy()` Return the configured `WebSocketPolicy`, if any.
`boolean` `isRunning()`
`void` `setWebSocketPolicy(org.eclipse.jetty.websocket.api.WebSocketPolicy webSocketPolicy)` Configure a `WebSocketPolicy` to use to initialize `WebSocketServerFactory`.
`void` `start()`
`void` `stop()`
`reactor.core.publisher.Mono<Void>` `upgrade(org.springframework.web.server.ServerWebExchange exchange, WebSocketHandler handler, String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory)` Upgrade to a WebSocket session and handle it with the given handler.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.web.reactive.socket.server.RequestUpgradeStrategy

`upgrade`

### Constructor Detail

#### JettyRequestUpgradeStrategy

    public JettyRequestUpgradeStrategy()

### Method Detail

#### setWebSocketPolicy

    public void setWebSocketPolicy(org.eclipse.jetty.websocket.api.WebSocketPolicy webSocketPolicy)

Configure a `WebSocketPolicy` to use to initialize `WebSocketServerFactory`.

Parameters:
  `webSocketPolicy` - the WebSocket settings

#### getWebSocketPolicy

    @Nullable
    public org.eclipse.jetty.websocket.api.WebSocketPolicy getWebSocketPolicy()

Return the configured `WebSocketPolicy`, if any.

#### start

    public void start()

Specified by:
  `start` in interface `org.springframework.context.Lifecycle`

#### stop

    public void stop()

Specified by:
  `stop` in interface `org.springframework.context.Lifecycle`

#### isRunning

    public boolean isRunning()

Specified by:
  `isRunning` in interface `org.springframework.context.Lifecycle`

#### upgrade

    public reactor.core.publisher.Mono<Void> upgrade(org.springframework.web.server.ServerWebExchange exchange,
                                                     WebSocketHandler handler,
                                                     @Nullable
                                                     String subProtocol,
                                                     Supplier<HandshakeInfo> handshakeInfoFactory)

Description copied from interface: `RequestUpgradeStrategy`
Upgrade to a WebSocket session and handle it with the given handler.

Specified by:
  `upgrade` in interface `RequestUpgradeStrategy`
Parameters:
  `exchange` - the current exchange
  `handler` - handler for the WebSocket session
  `subProtocol` - the selected sub-protocol got the handler
  `handshakeInfoFactory` - factory to create HandshakeInfo for the WebSocket session
Returns:
  completion `Mono<Void>` to indicate the outcome of the WebSocket session handling.