Package ninja.websockets
Class AbstractWebSocketHandshake
- java.lang.Object
-
- ninja.websockets.AbstractWebSocketHandshake
-
- All Implemented Interfaces:
WebSocketHandshake
public abstract class AbstractWebSocketHandshake extends Object implements WebSocketHandshake
-
-
Constructor Summary
Constructors Constructor Description AbstractWebSocketHandshake()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>getRequestedProtocols()The sub protocols requested by the client.StringgetSelectedProtocol()Gets the current selected sub protocol out of the requested sub protocols.booleanselectProtocol(String subprotocol)Selects the first matching supported sub protocol out of the requested sub protocols.voidsetRequestedProtocols(Set<String> requestedProtocols)
-
-
-
Method Detail
-
getRequestedProtocols
public Set<String> getRequestedProtocols()
Description copied from interface:WebSocketHandshakeThe sub protocols requested by the client. Will be ordered to match the order sent by the client.- Specified by:
getRequestedProtocolsin interfaceWebSocketHandshake- Returns:
- The set of sub protocols requested by the client or null if the header was empty or never sent by the client.
-
getSelectedProtocol
public String getSelectedProtocol()
Description copied from interface:WebSocketHandshakeGets the current selected sub protocol out of the requested sub protocols.- Specified by:
getSelectedProtocolin interfaceWebSocketHandshake- Returns:
- The selected sub protocol or null if none are selected
-
selectProtocol
public boolean selectProtocol(String subprotocol)
Description copied from interface:WebSocketHandshakeSelects the first matching supported sub protocol out of the requested sub protocols. Most browsers and WebSocket implementations require a match from the list supplied by the client or the handshake will fail.- Specified by:
selectProtocolin interfaceWebSocketHandshake- Returns:
- True if selected or false if none matched
-
-