Hybi07Handshake
public abstract class Handshake
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
allowExtensions |
|
protected java.util.Set<ExtensionHandshake> |
availableExtensions |
|
protected java.util.Set<java.lang.String> |
subprotocols |
Modifier | Constructor | Description |
---|---|---|
protected |
Handshake(WebSocketVersion version,
java.lang.String hashAlgorithm,
java.lang.String magicNumber,
java.util.Set<java.lang.String> subprotocols) |
Modifier and Type | Method | Description |
---|---|---|
void |
addExtension(ExtensionHandshake extension) |
Add a new WebSocket Extension handshake to the list of available extensions.
|
abstract WebSocketChannel |
createChannel(WebSocketHttpExchange exchange,
org.xnio.StreamConnection channel,
ByteBufferPool pool) |
Create the
WebSocketChannel from the WebSocketHttpExchange |
java.lang.String |
getHashAlgorithm() |
Return the algorithm that is used to hash during the handshake
|
java.lang.String |
getMagicNumber() |
Return the magic number which will be mixed in
|
WebSocketVersion |
getVersion() |
Return the version for which the
Handshake can be used. |
protected static java.lang.String |
getWebSocketLocation(WebSocketHttpExchange exchange) |
Return the full url of the websocket location of the given
WebSocketHttpExchange |
void |
handshake(WebSocketHttpExchange exchange) |
Issue the WebSocket upgrade
|
protected abstract void |
handshakeInternal(WebSocketHttpExchange exchange) |
|
protected java.util.List<ExtensionFunction> |
initExtensions(WebSocketHttpExchange exchange) |
Create the
ExtensionFunction list associated with the negotiated extensions defined in the exchange's response. |
abstract boolean |
matches(WebSocketHttpExchange exchange) |
Return
true if this implementation can be used to issue a handshake. |
protected void |
performUpgrade(WebSocketHttpExchange exchange) |
Perform the upgrade using no payload
|
protected void |
performUpgrade(WebSocketHttpExchange exchange,
byte[] data) |
convenience method to perform the upgrade
|
protected java.util.List<WebSocketExtension> |
selectedExtension(java.util.List<WebSocketExtension> extensionList) |
|
protected void |
selectExtensions(WebSocketHttpExchange exchange) |
|
protected void |
selectSubprotocol(WebSocketHttpExchange exchange) |
Selects the first matching supported sub protocol and add it the the headers of the exchange.
|
protected java.lang.String |
supportedSubprotols(java.lang.String[] requestedSubprotocolArray) |
|
protected void |
upgradeChannel(WebSocketHttpExchange exchange,
byte[] data) |
protected final java.util.Set<java.lang.String> subprotocols
protected java.util.Set<ExtensionHandshake> availableExtensions
protected boolean allowExtensions
protected Handshake(WebSocketVersion version, java.lang.String hashAlgorithm, java.lang.String magicNumber, java.util.Set<java.lang.String> subprotocols)
public WebSocketVersion getVersion()
Handshake
can be used.public java.lang.String getHashAlgorithm()
public java.lang.String getMagicNumber()
protected static java.lang.String getWebSocketLocation(WebSocketHttpExchange exchange)
WebSocketHttpExchange
public final void handshake(WebSocketHttpExchange exchange)
exchange
- The WebSocketHttpExchange
for which the handshake and upgrade should occur.protected abstract void handshakeInternal(WebSocketHttpExchange exchange)
public abstract boolean matches(WebSocketHttpExchange exchange)
true
if this implementation can be used to issue a handshake.public abstract WebSocketChannel createChannel(WebSocketHttpExchange exchange, org.xnio.StreamConnection channel, ByteBufferPool pool)
WebSocketChannel
from the WebSocketHttpExchange
protected final void performUpgrade(WebSocketHttpExchange exchange, byte[] data)
protected void upgradeChannel(WebSocketHttpExchange exchange, byte[] data)
protected final void performUpgrade(WebSocketHttpExchange exchange)
protected final void selectSubprotocol(WebSocketHttpExchange exchange)
protected final void selectExtensions(WebSocketHttpExchange exchange)
protected java.lang.String supportedSubprotols(java.lang.String[] requestedSubprotocolArray)
protected java.util.List<WebSocketExtension> selectedExtension(java.util.List<WebSocketExtension> extensionList)
public final void addExtension(ExtensionHandshake extension)
extension
- a new ExtensionHandshake
protected final java.util.List<ExtensionFunction> initExtensions(WebSocketHttpExchange exchange)
ExtensionFunction
list associated with the negotiated extensions defined in the exchange's response.exchange
- the exchange used to retrieve negotiated extensionsExtensionFunction
with the implementation of the extensionsCopyright © 2018. All rights reserved.