# Class WsHttpUpgradeHandler

java.lang.Object
org.apache.tomcat.websocket.server.WsHttpUpgradeHandler

All Implemented Interfaces:
  `HttpUpgradeHandler, InternalHttpUpgradeHandler`

public class WsHttpUpgradeHandler extends Object implements InternalHttpUpgradeHandler
Servlet 3.1 HTTP upgrade handler for WebSocket connections.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WsHttpUpgradeHandler()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `destroy()`
  This method is called after the upgraded connection has been closed.
  `UpgradeInfo`
  `getUpgradeInfo()`
  Returns the associated upgrade information used to collect statistics for the connection.
  `void`
  `init(WebConnection connection)`
  This method is called once the request/response pair where `HttpServletRequest.upgrade(Class)` is called has completed processing and is the point where control of the connection passes from the container to the `HttpUpgradeHandler`.
  `void`
  `pause()`
  Pause processing for the connection.
  `void`
  `preInit(ServerEndpointConfig serverEndpointConfig, WsServerContainer wsc, WsHandshakeRequest handshakeRequest, List<Extension> negotiatedExtensionsPhase2, String subProtocol, Transformation transformation, Map<String,String> pathParameters, boolean secure)`
  Performs initialization before the WebSocket handshake is completed.
  `void`
  `setSocketWrapper(SocketWrapperBase<?> socketWrapper)`
  Associate with the specified socket.
  `void`
  `setSslSupport(SSLSupport sslSupport)`
  Associate with the specified SSL support.
  `void`
  `timeoutAsync(long now)`
  Check for a possible timeout.
  `AbstractEndpoint.Handler.SocketState`
  `upgradeDispatch(SocketEvent status)`
  Process the specified event.

  ### Methods inherited from class Object

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

  ### Methods inherited from interface InternalHttpUpgradeHandler

  `hasAsyncIO`

- ## Constructor Details

  - ### WsHttpUpgradeHandler

    public WsHttpUpgradeHandler()
    Default constructor.

- ## Method Details

  - ### setSocketWrapper

    public void setSocketWrapper(SocketWrapperBase<?> socketWrapper)
    Description copied from interface: `InternalHttpUpgradeHandler`
    Associate with the specified socket.
    Specified by:
      `setSocketWrapper` in interface `InternalHttpUpgradeHandler`
    Parameters:
      `socketWrapper` - the socket

  - ### preInit

    public void preInit(ServerEndpointConfig serverEndpointConfig, WsServerContainer wsc, WsHandshakeRequest handshakeRequest, List<Extension> negotiatedExtensionsPhase2, String subProtocol, Transformation transformation, Map<String,String> pathParameters, boolean secure)
    Performs initialization before the WebSocket handshake is completed.
    Parameters:
      `serverEndpointConfig` - the endpoint configuration
      `wsc` - the WebSocket server container
      `handshakeRequest` - the handshake request
      `negotiatedExtensionsPhase2` - negotiated extensions
      `subProtocol` - the negotiated sub-protocol
      `transformation` - the data transformation
      `pathParameters` - the path parameters
      `secure` - whether the connection is secure

  - ### init

    public void init(WebConnection connection)
    Description copied from interface: `jakarta.servlet.http.HttpUpgradeHandler`
    This method is called once the request/response pair where `HttpServletRequest.upgrade(Class)` is called has completed processing and is the point where control of the connection passes from the container to the `HttpUpgradeHandler`.
    Specified by:
      `init` in interface `HttpUpgradeHandler`
    Parameters:
      `connection` - The connection that has been upgraded

  - ### getUpgradeInfo

    public UpgradeInfo getUpgradeInfo()
    Description copied from interface: `InternalHttpUpgradeHandler`
    Returns the associated upgrade information used to collect statistics for the connection.
    Specified by:
      `getUpgradeInfo` in interface `InternalHttpUpgradeHandler`
    Returns:
      the associated upgrade information used to collect statistics for the connection

  - ### upgradeDispatch

    public AbstractEndpoint.Handler.SocketState upgradeDispatch(SocketEvent status)
    Description copied from interface: `InternalHttpUpgradeHandler`
    Process the specified event.
    Specified by:
      `upgradeDispatch` in interface `InternalHttpUpgradeHandler`
    Parameters:
      `status` - the event
    Returns:
      the status following the event

  - ### timeoutAsync

    public void timeoutAsync(long now)
    Description copied from interface: `InternalHttpUpgradeHandler`
    Check for a possible timeout.
    Specified by:
      `timeoutAsync` in interface `InternalHttpUpgradeHandler`
    Parameters:
      `now` - the time to use for the timeout check

  - ### pause

    public void pause()
    Description copied from interface: `InternalHttpUpgradeHandler`
    Pause processing for the connection.
    Specified by:
      `pause` in interface `InternalHttpUpgradeHandler`

  - ### destroy

    public void destroy()
    Description copied from interface: `jakarta.servlet.http.HttpUpgradeHandler`
    This method is called after the upgraded connection has been closed.
    Specified by:
      `destroy` in interface `HttpUpgradeHandler`

  - ### setSslSupport

    public void setSslSupport(SSLSupport sslSupport)
    Description copied from interface: `InternalHttpUpgradeHandler`
    Associate with the specified SSL support.
    Specified by:
      `setSslSupport` in interface `InternalHttpUpgradeHandler`
    Parameters:
      `sslSupport` - the SSL support