Package io.undertow.websockets
Class WebSocketProtocolHandshakeHandler
- java.lang.Object
-
- io.undertow.websockets.WebSocketProtocolHandshakeHandler
-
- All Implemented Interfaces:
HttpHandler
public class WebSocketProtocolHandshakeHandler extends java.lang.Object implements HttpHandler
HttpHandler
which will process theHttpServerExchange
and do the actual handshake/upgrade to WebSocket.- Author:
- Norman Maurer
-
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebSocketProtocolHandshakeHandler
addExtension(ExtensionHandshake extension)
Add a new WebSocket Extension into the handshakes defined in this handler.java.util.Set<WebSocketChannel>
getPeerConnections()
void
handleRequest(HttpServerExchange exchange)
Handle the request.
-
-
-
Constructor Detail
-
WebSocketProtocolHandshakeHandler
public WebSocketProtocolHandshakeHandler(WebSocketConnectionCallback callback)
Create a newWebSocketProtocolHandshakeHandler
- Parameters:
callback
- TheWebSocketConnectionCallback
which will be executed once the handshake was established
-
WebSocketProtocolHandshakeHandler
public WebSocketProtocolHandshakeHandler(WebSocketConnectionCallback callback, HttpHandler next)
Create a newWebSocketProtocolHandshakeHandler
- Parameters:
callback
- TheWebSocketConnectionCallback
which will be executed once the handshake was established
-
WebSocketProtocolHandshakeHandler
public WebSocketProtocolHandshakeHandler(java.util.Collection<Handshake> handshakes, WebSocketConnectionCallback callback)
Create a newWebSocketProtocolHandshakeHandler
- Parameters:
handshakes
- The supported handshake methodscallback
- TheWebSocketConnectionCallback
which will be executed once the handshake was established
-
WebSocketProtocolHandshakeHandler
public WebSocketProtocolHandshakeHandler(java.util.Collection<Handshake> handshakes, WebSocketConnectionCallback callback, HttpHandler next)
Create a newWebSocketProtocolHandshakeHandler
- Parameters:
handshakes
- The supported handshake methodscallback
- TheWebSocketConnectionCallback
which will be executed once the handshake was established
-
WebSocketProtocolHandshakeHandler
public WebSocketProtocolHandshakeHandler(HttpUpgradeListener callback)
Create a newWebSocketProtocolHandshakeHandler
- Parameters:
callback
- TheWebSocketConnectionCallback
which will be executed once the handshake was established
-
WebSocketProtocolHandshakeHandler
public WebSocketProtocolHandshakeHandler(HttpUpgradeListener callback, HttpHandler next)
Create a newWebSocketProtocolHandshakeHandler
- Parameters:
callback
- TheWebSocketConnectionCallback
which will be executed once the handshake was established
-
WebSocketProtocolHandshakeHandler
public WebSocketProtocolHandshakeHandler(java.util.Collection<Handshake> handshakes, HttpUpgradeListener callback)
Create a newWebSocketProtocolHandshakeHandler
- Parameters:
handshakes
- The supported handshake methodscallback
- TheWebSocketConnectionCallback
which will be executed once the handshake was established
-
WebSocketProtocolHandshakeHandler
public WebSocketProtocolHandshakeHandler(java.util.Collection<Handshake> handshakes, HttpUpgradeListener callback, HttpHandler next)
Create a newWebSocketProtocolHandshakeHandler
- Parameters:
handshakes
- The supported handshake methodscallback
- TheWebSocketConnectionCallback
which will be executed once the handshake was established
-
-
Method Detail
-
handleRequest
public void handleRequest(HttpServerExchange exchange) throws java.lang.Exception
Description copied from interface:HttpHandler
Handle the request.- Specified by:
handleRequest
in interfaceHttpHandler
- Parameters:
exchange
- the HTTP request/response exchange- Throws:
java.lang.Exception
-
getPeerConnections
public java.util.Set<WebSocketChannel> getPeerConnections()
-
addExtension
public WebSocketProtocolHandshakeHandler addExtension(ExtensionHandshake extension)
Add a new WebSocket Extension into the handshakes defined in this handler.- Parameters:
extension
- a newExtensionHandshake
instance- Returns:
- current handler
-
-