public abstract class Handshake extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean | allowExtensions |
protected Set<ExtensionHandshake> | availableExtensions |
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 |
---|---|
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 |
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 WebSocketHttpExchange |
void | handshake(WebSocketHttpExchange exchange) Issue the WebSocket upgrade |
protected abstract void | handshakeInternal(WebSocketHttpExchange exchange) |
protected 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 List<WebSocketExtension> | selectedExtension(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 String | supportedSubprotols(String[] requestedSubprotocolArray) |
protected void | upgradeChannel(WebSocketHttpExchange exchange, byte[] data) |
protected Set<ExtensionHandshake> availableExtensions
protected boolean allowExtensions
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)
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 List<WebSocketExtension> selectedExtension(List<WebSocketExtension> extensionList)
public final void addExtension(ExtensionHandshake extension)
extension
- a new ExtensionHandshake
protected final 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 © 2015 JBoss by Red Hat. All rights reserved.