Responsible for framing and unframing raw websocket frames. Tyrus creates exactly one instance per Session.
| Modifier and Type | Class and Description |
|---|---|
| private static class | ProtocolHandler.
Handler passed to the |
| private static class | |
| private static enum | ProtocolHandler.
Sending state. |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private static final WriterInfo | |
| private volatile ExtendedExtension. | |
| private volatile List | |
| private volatile boolean | |
| private final Condition | idleCondition
If partial message is being send and we want to send partial message with different type or other whole message, we need to wait until "idleCondition" is signalled. |
| private volatile byte | |
| private final Lock | lock
Synchronizes all public send* (including stream variants) methods. |
| private static final Logger | |
| public static final int | MASK_SIZE
RFC 6455 |
| private final MaskingKeyGenerator | |
| private volatile MessageEventListener | |
| private static final WriterInfo | |
| private volatile byte | |
| private final ProtocolHandler. | |
| private volatile boolean | |
| private volatile ByteBuffer | |
| private static final int | |
| private volatile ProtocolHandler. | |
| private volatile String | |
| private volatile TyrusWebSocket | |
| private volatile Writer |
| Access | Constructor and Description |
|---|---|
| pack-priv | ProtocolHandler(boolean
true when this instance is on client side, false when on server side.random number generator that will be used for generating masking keys. Masking keys
are required only on the client side and maskingKeyGenerator)maskingKeyGenerator should be null on the server side. If null on the client side, java. will be used by default.Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| private byte | |
| private void | |
| public synchronized Future | |
| private long | Returns: converted byte array.byte array to be converted. bytes)Convert a byte[] to a long. |
| pack-priv void | |
| private byte[] | Returns: the arraythe payload size length)Converts the length given to the appropriate framing data:
|
| pack-priv ByteBuffer | |
| pack-priv List | |
| pack-priv String | |
| public Handshake | Returns: server handshake object.endpoint related to the handshake (path is already matched). endpointWrapper, UpgradeRequest handshake request. request, UpgradeResponse handshake response. response, ExtendedExtension.extension context. extensionContextServer side handshake processing. |
| public boolean | Returns: true if there is at least one negotiated extension associated to this connection, false
otherwise.Returns true when current connection has some negotiated extension. |
| private boolean | |
| private boolean | |
| public void | |
| pack-priv final Future | |
| private Future | send(TyrusFrame frame, CompletionHandler<Frame> completionHandler, WriterInfo writerInfo, Boolean useTimeout)
|
| private Future | send(ByteBuffer frame, CompletionHandler<Frame> completionHandler, WriterInfo writerInfo, Boolean useTimeout)
|
| public Future | |
| public Future | |
| public void | |
| public void | |
| public Future | |
| public Future | |
| public void | |
| public void | |
| public Future | Returns: send future.serialized frame. data)Raw frame is always whole (not partial). |
| public void | setExtensionContext(ExtendedExtension.
extension context. extensionContextClient side. |
| public void | |
| public void | setMessageEventListener(MessageEventListener
message event listener. messageEventListener)Set message event listener. |
| public void | |
| public void | |
| public Future | |
| public Future | |
| public Future | |
| public Future | |
| public Frame | |
| private void | |
| private Future | write(final TyrusFrame frame, final CompletionHandler<Frame> completionHandler, WriterInfo data, boolean useTimeout)
|
| private Future | write(final ByteBuffer frame, final CompletionHandler<Frame> completionHandler, WriterInfo data, boolean useTimeout)
|
| client | back to summary |
|---|---|
| private final boolean client | |
| CLOSE | back to summary |
|---|---|
| private static final WriterInfo CLOSE | |
| extensionContext | back to summary |
|---|---|
| private volatile ExtendedExtension. | |
| extensions | back to summary |
|---|---|
| private volatile List<Extension> extensions | |
| hasExtensions | back to summary |
|---|---|
| private volatile boolean hasExtensions | |
| idleCondition | back to summary |
|---|---|
| private final Condition idleCondition If partial message is being send and we want to send partial message with different type or other whole message, we need to wait until "idleCondition" is signalled. | |
| inFragmentedType | back to summary |
|---|---|
| private volatile byte inFragmentedType | |
| lock | back to summary |
|---|---|
| private final Lock lock Synchronizes all public send* (including stream variants) methods. The reason for this lock is that we need to have consistent value in {#sendingFragment} field to be able to determine the sending state of this particular instance/session. | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| MASK_SIZE | back to summary |
|---|---|
| public static final int MASK_SIZE RFC 6455 | |
| maskingKeyGenerator | back to summary |
|---|---|
| private final MaskingKeyGenerator maskingKeyGenerator | |
| messageEventListener | back to summary |
|---|---|
| private volatile MessageEventListener messageEventListener | |
| NULL_INFO | back to summary |
|---|---|
| private static final WriterInfo NULL_INFO | |
| outFragmentedType | back to summary |
|---|---|
| private volatile byte outFragmentedType | |
| parsingState | back to summary |
|---|---|
| private final ProtocolHandler. | |
| processingFragment | back to summary |
|---|---|
| private volatile boolean processingFragment | |
| remainder | back to summary |
|---|---|
| private volatile ByteBuffer remainder | |
| SEND_TIMEOUT | back to summary |
|---|---|
| private static final int SEND_TIMEOUT | |
| sendingFragment | back to summary |
|---|---|
| private volatile ProtocolHandler. | |
| subProtocol | back to summary |
|---|---|
| private volatile String subProtocol | |
| webSocket | back to summary |
|---|---|
| private volatile TyrusWebSocket webSocket | |
| writer | back to summary |
|---|---|
| private volatile Writer writer | |
| ProtocolHandler | back to summary |
|---|---|
| pack-priv ProtocolHandler(boolean client, MaskingKeyGenerator maskingKeyGenerator) Constructor.
| |
| checkForLastFrame | back to summary |
|---|---|
| private byte checkForLastFrame(Frame frame) | |
| checkSendingFragment | back to summary |
|---|---|
| private void checkSendingFragment() Check whether current
If yes, wait for 3000 and if the message still cannot be sent, throw | |
| close | back to summary |
|---|---|
| public synchronized Future | |
| decodeLength | back to summary |
|---|---|
| private long decodeLength(byte[] bytes) Convert a byte[] to a long. Used for rebuilding payload length.
| |
| doClose | back to summary |
|---|---|
| pack-priv void doClose() | |
| encodeLength | back to summary |
|---|---|
| private byte[] encodeLength(final long length) Converts the length given to the appropriate framing data:
| |
| frame | back to summary |
|---|---|
| pack-priv ByteBuffer frame(Frame frame) | |
| getExtensions | back to summary |
|---|---|
| pack-priv List | |
| getSubProtocol | back to summary |
|---|---|
| pack-priv String getSubProtocol() | |
| handshake | back to summary |
|---|---|
| public Handshake handshake(TyrusEndpointWrapper endpointWrapper, UpgradeRequest request, UpgradeResponse response, ExtendedExtension. Server side handshake processing.
| |
| hasExtensions | back to summary |
|---|---|
| public boolean hasExtensions() Returns true when current connection has some negotiated extension.
| |
| isBitSet | back to summary |
|---|---|
| private boolean isBitSet(final byte b, int bit) | |
| isControlFrame | back to summary |
|---|---|
| private boolean isControlFrame(byte opcode) | |
| process | back to summary |
|---|---|
| public void process(Frame frame, TyrusWebSocket socket) TODO. called after Extension execution. validates frame + processes its content
| |
| send | back to summary |
|---|---|
| pack-priv final Future Not message frames - ping/pong/... | |
| send | back to summary |
|---|---|
| private Future | |
| send | back to summary |
|---|---|
| private Future | |
| send | back to summary |
|---|---|
| public Future Deprecated
| |
| send | back to summary |
|---|---|
| public Future | |
| send | back to summary |
|---|---|
| public void send(final byte[] data, final SendHandler handler)
Deprecated
| |
| send | back to summary |
|---|---|
| public void send(final byte[] data, final SendHandler handler, WriterInfo writerInfo) | |
| send | back to summary |
|---|---|
| public Future Deprecated
| |
| send | back to summary |
|---|---|
| public Future | |
| send | back to summary |
|---|---|
| public void send(final String data, final SendHandler handler)
Deprecated
| |
| send | back to summary |
|---|---|
| public void send(final String data, final SendHandler handler, WriterInfo writerInfo) | |
| sendRawFrame | back to summary |
|---|---|
| public Future Raw frame is always whole (not partial).
| |
| setExtensionContext | back to summary |
|---|---|
| public void setExtensionContext(ExtendedExtension. Client side. Set extension context.
| |
| setExtensions | back to summary |
|---|---|
| public void setExtensions(List<Extension> extensions) Client side. Set extensions negotiated for this WebSocket session/connection. | |
| setMessageEventListener | back to summary |
|---|---|
| public void setMessageEventListener(MessageEventListener messageEventListener) Set message event listener.
| |
| setWebSocket | back to summary |
|---|---|
| public void setWebSocket(TyrusWebSocket webSocket) Client side. Set WebSocket.
| |
| setWriter | back to summary |
|---|---|
| public void setWriter(Writer writer) Set The set instance is used for "sending" all outgoing WebSocket frames. | |
| stream | back to summary |
|---|---|
| public Future Deprecated
| |
| stream | back to summary |
|---|---|
| public Future | |
| stream | back to summary |
|---|---|
| public Future Deprecated
| |
| stream | back to summary |
|---|---|
| public Future | |
| unframe | back to summary |
|---|---|
| public Frame unframe(ByteBuffer buffer) TODO!
| |
| validate | back to summary |
|---|---|
| private void validate(final byte fragmentType, byte opcode) | |
| write | back to summary |
|---|---|
| private Future | |
| write | back to summary |
|---|---|
| private Future | |
org.glassfish.tyrus.spi.Writer .
| Modifier and Type | Field and Description |
|---|---|
| private final Frame | |
| private final CompletionHandler | |
| private final TyrusFuture |
| Access | Constructor and Description |
|---|---|
| private | CompletionHandlerWrapper(CompletionHandler<Frame> frameCompletionHandler, TyrusFuture<Frame> future, Frame frame)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | cancelled()
Overrides org. The operation was cancelled. |
| public void | completed(ByteBuffer
the operation result. result)Overrides org. The operation was completed. |
| public void | failed(Throwable
error, which occurred during operation execution. throwable)Overrides org. The operation was failed. |
| public void | updated(ByteBuffer
the current result. result)Overrides org. The callback method may be called, when there is some progress in operation execution, but it is still not completed. |
| frame | back to summary |
|---|---|
| private final Frame frame | |
| frameCompletionHandler | back to summary |
|---|---|
| private final CompletionHandler<Frame> frameCompletionHandler | |
| future | back to summary |
|---|---|
| private final TyrusFuture<Frame> future | |
| CompletionHandlerWrapper | back to summary |
|---|---|
| private CompletionHandlerWrapper(CompletionHandler<Frame> frameCompletionHandler, TyrusFuture<Frame> future, Frame frame) | |
| cancelled | back to summary |
|---|---|
| public void cancelled() Overrides org. Doc from org. The operation was cancelled.
| |
| completed | back to summary |
|---|---|
| public void completed(ByteBuffer result) Overrides org. Doc from org. The operation was completed.
| |
| failed | back to summary |
|---|---|
| public void failed(Throwable throwable) Overrides org. Doc from org. The operation was failed. | |
| updated | back to summary |
|---|---|
| public void updated(ByteBuffer result) Overrides org. Doc from org. The callback method may be called, when there is some progress in operation execution, but it is still not completed.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile boolean | |
| pack-priv volatile boolean | |
| pack-priv volatile long | |
| private volatile byte | |
| pack-priv volatile boolean | |
| pack-priv volatile Masker | |
| pack-priv volatile byte | |
| pack-priv final AtomicInteger |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void |
| controlFrame | back to summary |
|---|---|
| pack-priv volatile boolean controlFrame | |
| finalFragment | back to summary |
|---|---|
| pack-priv volatile boolean finalFragment | |
| length | back to summary |
|---|---|
| pack-priv volatile long length | |
| lengthCode | back to summary |
|---|---|
| private volatile byte lengthCode | |
| masked | back to summary |
|---|---|
| pack-priv volatile boolean masked | |
| masker | back to summary |
|---|---|
| pack-priv volatile Masker masker | |
| opcode | back to summary |
|---|---|
| pack-priv volatile byte opcode | |
| state | back to summary |
|---|---|
| pack-priv final AtomicInteger state | |
| ParsingState | back to summary |
|---|---|
| private ParsingState() | |
| recycle | back to summary |
|---|---|
| pack-priv void recycle() | |
| Modifier and Type | Field and Description |
|---|---|
| public static final ProtocolHandler. | IDLE
Session is idle - no partial message in progress. |
| public static final ProtocolHandler. | SENDING_BINARY
Sending partial binary message - final frame was not yet sent. |
| public static final ProtocolHandler. | SENDING_TEXT
Sending partial text message - final frame was not yet sent. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ProtocolHandler. | |
| public static ProtocolHandler. |
| IDLE | back to summary |
|---|---|
| public static final ProtocolHandler. Session is idle - no partial message in progress. | |
| SENDING_BINARY | back to summary |
|---|---|
| public static final ProtocolHandler. Sending partial binary message - final frame was not yet sent. | |
| SENDING_TEXT | back to summary |
|---|---|
| public static final ProtocolHandler. Sending partial text message - final frame was not yet sent. | |
| SendingFragmentState | back to summary |
|---|---|
| private SendingFragmentState() | |
| valueOf | back to summary |
|---|---|
| public static ProtocolHandler. | |
| values | back to summary |
|---|---|
| public static ProtocolHandler. | |