public abstract class Handshake extends Object
Modifier and Type | Field and Description |
---|---|
protected Set<String> |
subprotocols |
Modifier | Constructor and Description |
---|---|
protected |
Handshake(WebSocketVersion version,
String hashAlgorithm,
String magicNumber,
Set<String> subprotocols) |
Modifier and Type | Method and Description |
---|---|
abstract WebSocketChannel |
createChannel(WebSocketHttpExchange exchange,
org.xnio.StreamConnection channel,
org.xnio.Pool<ByteBuffer> pool)
Create the
WebSocketChannel from the HttpServerExchange |
String |
getHashAlgorithm()
Return the algorithm that is used to hash during the handshake
|
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 String |
getWebSocketLocation(WebSocketHttpExchange exchange)
Return the full url of the websocket location of the given
HttpServerExchange |
void |
handshake(WebSocketHttpExchange exchange,
WebSocketConnectionCallback callback)
Issue the WebSocket upgrade
|
protected abstract void |
handshakeInternal(WebSocketHttpExchange exchange) |
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 void |
selectSubprotocol(WebSocketHttpExchange exchange)
Selects the first matching supported sub protocol and add it the the headers of the exchange.
|
protected String |
supportedSubprotols(String[] requestedSubprotocolArray) |
protected void |
upgradeChannel(WebSocketHttpExchange exchange,
byte[] data) |
protected Handshake(WebSocketVersion version, String hashAlgorithm, String magicNumber, Set<String> subprotocols)
public WebSocketVersion getVersion()
Handshake
can be used.public String getHashAlgorithm()
public String getMagicNumber()
protected static String getWebSocketLocation(WebSocketHttpExchange exchange)
HttpServerExchange
public final void handshake(WebSocketHttpExchange exchange, WebSocketConnectionCallback callback)
exchange
- The HttpServerExchange
for which the handshake and upgrade should occur.callback
- The callback to call once the exchange is upgradedprotected 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, org.xnio.Pool<ByteBuffer> pool)
WebSocketChannel
from the HttpServerExchange
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) throws WebSocketHandshakeException
WebSocketHandshakeException
- Get thrown if no subprotocol could be foundCopyright © 2013 JBoss by Red Hat. All Rights Reserved.