Package org.glassfish.tyrus.core
Class Handshake
java.lang.Object
org.glassfish.tyrus.core.Handshake
Class responsible for performing and validating handshake.
- Author:
- Justin Lee, Pavel Bucek
-
Method Summary
Modifier and TypeMethodDescriptionstatic HandshakecreateClientHandshake(RequestContext webSocketRequest) Client-side handshake.Client side only - get theUpgradeRequest.Client side only - compose theUpgradeRequestand store it for further use.voidsetExtensions(List<Extension> extensions) Client side only - set the list of supported extensions.voidsetSubProtocols(List<String> subProtocols) Client side only - set the list of supported subprotocols.static voidupdateHostAndOrigin(UpgradeRequest upgradeRequest) Client side only - Generate host and origin header and put them to the upgrade request headers.voidvalidateServerResponse(UpgradeResponse response) Client side only - validate server response.
-
Method Details
-
createClientHandshake
Client-side handshake.- Parameters:
webSocketRequest- request representation to be modified for use as WebSocket handshake request.- Returns:
- handshake instance.
-
getRequest
Client side only - get theUpgradeRequest.- Returns:
UpgradeRequestcreated on this HandShake.
-
setSubProtocols
Client side only - set the list of supported subprotocols.- Parameters:
subProtocols- list of supported subprotocol.
-
setExtensions
Client side only - set the list of supported extensions.- Parameters:
extensions- list of supported extensions.
-
prepareRequest
Client side only - compose theUpgradeRequestand store it for further use.- Returns:
- composed
UpgradeRequest.
-
validateServerResponse
Client side only - validate server response.- Parameters:
response- response to be validated.- Throws:
HandshakeException- when HTTP Status of received response is not 101 - Switching protocols.
-
updateHostAndOrigin
Client side only - Generate host and origin header and put them to the upgrade request headers.- Parameters:
upgradeRequest- upgrade request to be updated.
-