Package org.glassfish.tyrus.core
Class ProtocolHandler
java.lang.Object
org.glassfish.tyrus.core.ProtocolHandler
Tyrus protocol handler.
Responsible for framing and unframing raw websocket frames. Tyrus creates exactly one instance per Session.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionhandshake
(TyrusEndpointWrapper endpointWrapper, UpgradeRequest request, UpgradeResponse response, ExtendedExtension.ExtensionContext extensionContext) Server side handshake processing.boolean
Returns true when current connection has some negotiated extension.void
process
(Frame frame, TyrusWebSocket socket) TODO.send
(byte[] data) Deprecated.void
send
(byte[] data, SendHandler handler) Deprecated.void
send
(byte[] data, SendHandler handler, WriterInfo writerInfo) send
(byte[] data, WriterInfo writerInfo) Deprecated.void
send
(String data, SendHandler handler) Deprecated.void
send
(String data, SendHandler handler, WriterInfo writerInfo) send
(String data, WriterInfo writerInfo) sendRawFrame
(ByteBuffer data) Raw frame is always whole (not partial).void
setExtensionContext
(ExtendedExtension.ExtensionContext extensionContext) Client side.void
setExtensions
(List<Extension> extensions) Client side.void
setMessageEventListener
(MessageEventListener messageEventListener) Set message event listener.void
setWebSocket
(TyrusWebSocket webSocket) Client side.void
SetWriter
instance.stream
(boolean last, byte[] bytes, int off, int len) Deprecated.stream
(boolean last, byte[] bytes, int off, int len, WriterInfo writerInfo) Deprecated.stream
(boolean last, String fragment, WriterInfo writerInfo) unframe
(ByteBuffer buffer) TODO!
-
Field Details
-
MASK_SIZE
public static final int MASK_SIZERFC 6455- See Also:
-
-
Method Details
-
setWriter
SetWriter
instance.The set instance is used for "sending" all outgoing WebSocket frames.
- Parameters:
writer
-Writer
to be set.
-
hasExtensions
public boolean hasExtensions()Returns true when current connection has some negotiated extension.- Returns:
true
if there is at least one negotiated extension associated to this connection,false
otherwise.
-
handshake
public Handshake handshake(TyrusEndpointWrapper endpointWrapper, UpgradeRequest request, UpgradeResponse response, ExtendedExtension.ExtensionContext extensionContext) throws HandshakeException Server side handshake processing.- Parameters:
endpointWrapper
- endpoint related to the handshake (path is already matched).request
- handshake request.response
- handshake response.extensionContext
- extension context.- Returns:
- server handshake object.
- Throws:
HandshakeException
- when there is problem with receivedUpgradeRequest
.
-
setExtensions
Client side. Set extensions negotiated for this WebSocket session/connection.- Parameters:
extensions
- list of negotiated extensions. Can benull
.
-
setWebSocket
Client side. Set WebSocket.- Parameters:
webSocket
- client WebSocket connection.
-
setExtensionContext
Client side. Set extension context.- Parameters:
extensionContext
- extension context.
-
setMessageEventListener
Set message event listener.- Parameters:
messageEventListener
- message event listener.
-
send
Deprecated. -
send
-
send
Deprecated. -
send
-
send
Deprecated. -
send
-
send
Deprecated. -
send
-
sendRawFrame
Raw frame is always whole (not partial).- Parameters:
data
- serialized frame.- Returns:
- send future.
-
stream
Deprecated. -
stream
-
stream
Deprecated. -
stream
-
close
-
unframe
TODO!- Parameters:
buffer
- TODO.- Returns:
- TODO.
-
process
TODO.called after Extension execution.
validates frame + processes its content
- Parameters:
frame
- TODO.socket
- TODO.
-