Class WsHttpUpgradeHandler
java.lang.Object
org.apache.tomcat.websocket.server.WsHttpUpgradeHandler
- All Implemented Interfaces:
HttpUpgradeHandler, InternalHttpUpgradeHandler
Servlet 3.1 HTTP upgrade handler for WebSocket connections.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()This method is called after the upgraded connection has been closed.Returns the associated upgrade information used to collect statistics for the connection.voidinit(WebConnection connection) This method is called once the request/response pair whereHttpServletRequest.upgrade(Class)is called has completed processing and is the point where control of the connection passes from the container to theHttpUpgradeHandler.voidpause()Pause processing for the connection.voidpreInit(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.voidsetSocketWrapper(SocketWrapperBase<?> socketWrapper) Associate with the specified socket.voidsetSslSupport(SSLSupport sslSupport) Associate with the specified SSL support.voidtimeoutAsync(long now) Check for a possible timeout.upgradeDispatch(SocketEvent status) Process the specified event.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface InternalHttpUpgradeHandler
hasAsyncIO
-
Constructor Details
-
WsHttpUpgradeHandler
public WsHttpUpgradeHandler()Default constructor.
-
-
Method Details
-
setSocketWrapper
Description copied from interface:InternalHttpUpgradeHandlerAssociate with the specified socket.- Specified by:
setSocketWrapperin interfaceInternalHttpUpgradeHandler- 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 configurationwsc- the WebSocket server containerhandshakeRequest- the handshake requestnegotiatedExtensionsPhase2- negotiated extensionssubProtocol- the negotiated sub-protocoltransformation- the data transformationpathParameters- the path parameterssecure- whether the connection is secure
-
init
Description copied from interface:jakarta.servlet.http.HttpUpgradeHandlerThis method is called once the request/response pair whereHttpServletRequest.upgrade(Class)is called has completed processing and is the point where control of the connection passes from the container to theHttpUpgradeHandler.- Specified by:
initin interfaceHttpUpgradeHandler- Parameters:
connection- The connection that has been upgraded
-
getUpgradeInfo
Description copied from interface:InternalHttpUpgradeHandlerReturns the associated upgrade information used to collect statistics for the connection.- Specified by:
getUpgradeInfoin interfaceInternalHttpUpgradeHandler- Returns:
- the associated upgrade information used to collect statistics for the connection
-
upgradeDispatch
Description copied from interface:InternalHttpUpgradeHandlerProcess the specified event.- Specified by:
upgradeDispatchin interfaceInternalHttpUpgradeHandler- Parameters:
status- the event- Returns:
- the status following the event
-
timeoutAsync
public void timeoutAsync(long now) Description copied from interface:InternalHttpUpgradeHandlerCheck for a possible timeout.- Specified by:
timeoutAsyncin interfaceInternalHttpUpgradeHandler- Parameters:
now- the time to use for the timeout check
-
pause
public void pause()Description copied from interface:InternalHttpUpgradeHandlerPause processing for the connection.- Specified by:
pausein interfaceInternalHttpUpgradeHandler
-
destroy
public void destroy()Description copied from interface:jakarta.servlet.http.HttpUpgradeHandlerThis method is called after the upgraded connection has been closed.- Specified by:
destroyin interfaceHttpUpgradeHandler
-
setSslSupport
Description copied from interface:InternalHttpUpgradeHandlerAssociate with the specified SSL support.- Specified by:
setSslSupportin interfaceInternalHttpUpgradeHandler- Parameters:
sslSupport- the SSL support
-