Package io.undertow.websockets.handshake
Class Handshake
java.lang.Object
io.undertow.websockets.handshake.Handshake
Abstract base class for doing a WebSocket Handshake.
- Author:
- Mike Brock
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHandshake(ConfiguredServerEndpoint config, Set<String> subprotocols, int maxFrameSize) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddExtension(io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandshaker extension) Add a new WebSocket Extension handshake to the list of available extensions.protected static StringgetWebSocketLocation(WebSocketHttpExchange exchange) Return the full url of the websocket location of the givenWebSocketHttpExchangefinal voidhandshake(WebSocketHttpExchange exchange, Consumer<io.netty.channel.ChannelHandlerContext> completeListener) Issue the WebSocket upgradeprotected voidhandshakeInternal(WebSocketHttpExchange exchange) protected final List<io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtension>initExtensions(WebSocketHttpExchange exchange) Create theExtensionFunctionlist associated with the negotiated extensions defined in the exchange's response.booleanmatches(WebSocketHttpExchange exchange) protected final voidperformUpgrade(WebSocketHttpExchange exchange) convenience method to perform the upgradeprotected List<io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtension>selectedExtension(List<io.netty.handler.codec.http.websocketx.extensions.WebSocketExtensionData> extensionList) protected final voidselectSubprotocol(WebSocketHttpExchange exchange) Selects the first matching supported sub protocol and add it the the headers of the exchange.protected final Stringprotected StringsupportedSubprotols(String[] requestedSubprotocolArray)
-
Field Details
-
MAGIC_NUMBER
- See Also:
-
SHA1
- See Also:
-
subprotocols
-
availableExtensions
protected Set<io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandshaker> availableExtensions -
allowExtensions
protected boolean allowExtensions
-
-
Constructor Details
-
Handshake
-
-
Method Details
-
getConfig
-
getWebSocketLocation
Return the full url of the websocket location of the givenWebSocketHttpExchange -
handshake
public final void handshake(WebSocketHttpExchange exchange, Consumer<io.netty.channel.ChannelHandlerContext> completeListener) Issue the WebSocket upgrade- Parameters:
exchange- TheWebSocketHttpExchangefor which the handshake and upgrade should occur.
-
handshakeInternal
-
performUpgrade
convenience method to perform the upgrade -
selectSubprotocol
Selects the first matching supported sub protocol and add it the the headers of the exchange. -
addExtension
public final void addExtension(io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandshaker extension) Add a new WebSocket Extension handshake to the list of available extensions.- Parameters:
extension- a newExtensionHandshake
-
initExtensions
protected final List<io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtension> initExtensions(WebSocketHttpExchange exchange) Create theExtensionFunctionlist associated with the negotiated extensions defined in the exchange's response.- Parameters:
exchange- the exchange used to retrieve negotiated extensions- Returns:
- a list of
ExtensionFunctionwith the implementation of the extensions
-
supportedSubprotols
-
selectedExtension
-
matches
-
solve
- Throws:
NoSuchAlgorithmException
-