java.lang.Object
io.helidon.webserver.websocket.WsUpgrader
All Implemented Interfaces:
Http1Upgrader
Direct Known Subclasses:
TyrusUpgrader

public class WsUpgrader extends Object implements Http1Upgrader
Http1Upgrader implementation to upgrade from HTTP/1.1 to WebSocket.
  • Field Details

    • WS_KEY

      public static final HeaderName WS_KEY
      Websocket key header name.
    • WS_VERSION

      public static final HeaderName WS_VERSION
      Websocket version header name.
    • PROTOCOL

      public static final HeaderName PROTOCOL
      Websocket protocol header name.
    • EXTENSIONS

      public static final HeaderName EXTENSIONS
      Websocket protocol header name.
    • SWITCHING_PROTOCOL_PREFIX

      protected static final String SWITCHING_PROTOCOL_PREFIX
      Switching response prefix.
      See Also:
    • SWITCHING_PROTOCOLS_SUFFIX

      protected static final String SWITCHING_PROTOCOLS_SUFFIX
      Switching response suffix.
      See Also:
    • SUPPORTED_VERSION

      protected static final String SUPPORTED_VERSION
      Supported version.
      See Also:
    • SUPPORTED_VERSION_HEADER

      protected static final Header SUPPORTED_VERSION_HEADER
      Supported version header.
  • Constructor Details

    • WsUpgrader

      protected WsUpgrader(WsConfig wsConfig)
  • Method Details

    • create

      public static WsUpgrader create(WsConfig config)
      WebSocket upgrader for HTTP/1.
      Parameters:
      config - configuration of web socket protocol
      Returns:
      a new upgrader
    • supportedProtocol

      public String supportedProtocol()
      Description copied from interface: Http1Upgrader
      Expected value of the protocol upgrade, such as h2c, or websocket. If an implementation supports multiple protocols, please implement this selector for each protocol
      Specified by:
      supportedProtocol in interface Http1Upgrader
      Returns:
      supported protocol
    • upgrade

      public ServerConnection upgrade(ConnectionContext ctx, HttpPrologue prologue, WritableHeaders<?> headers)
      Description copied from interface: Http1Upgrader
      Upgrade connection.
      Specified by:
      upgrade in interface Http1Upgrader
      Parameters:
      ctx - connection context
      prologue - http prologue of the upgrade request
      headers - http headers of the upgrade request
      Returns:
      a new connection to use instead of the original Http1Connection, or null if the connection cannot be upgraded
    • anyOrigin

      protected boolean anyOrigin()
    • origins

      protected Set<String> origins()
    • hash

      protected String hash(ConnectionContext ctx, String wsKey)