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 Handshake
createClientHandshake
(RequestContext webSocketRequest) Client-side handshake.Client side only - get theUpgradeRequest
.Client side only - compose theUpgradeRequest
and store it for further use.void
setExtensions
(List<Extension> extensions) Client side only - set the list of supported extensions.void
setSubProtocols
(List<String> subProtocols) Client side only - set the list of supported subprotocols.static void
updateHostAndOrigin
(UpgradeRequest upgradeRequest) Client side only - Generate host and origin header and put them to the upgrade request headers.void
validateServerResponse
(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:
UpgradeRequest
created 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 theUpgradeRequest
and 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.
-