Top Fields Constructors Methods
org.eclipse.jetty.ee10.websocket.jakarta.common

public Class JakartaWebSocketFrameHandler

extends Object
implements FrameHandler
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.websocket.core.FrameHandler, org.eclipse.jetty.websocket.core.IncomingFrames
Imports
java.lang.invoke.MethodHandle, .MethodType, java.nio.ByteBuffer, java.util.HashMap, .Map, .Optional, .Set, java.util.concurrent.atomic.AtomicBoolean, java.util.stream.Collectors, jakarta.websocket.ClientEndpointConfig, .CloseReason, .Decoder, .EndpointConfig, .MessageHandler, .PongMessage, jakarta.websocket.server.ServerEndpointConfig, org.eclipse.jetty.ee10.websocket.jakarta.common.decoders.AvailableDecoders, .RegisteredDecoder, org.eclipse.jetty.ee10.websocket.jakarta.common.messages.DecodedBinaryMessageSink, .DecodedBinaryStreamMessageSink, .DecodedTextMessageSink, .DecodedTextStreamMessageSink, org.eclipse.jetty.util.BufferUtil, .Callback, org.eclipse.jetty.util.thread.AutoLock, org.eclipse.jetty.websocket.core.CloseStatus, .CoreSession, .Frame, .FrameHandler, .OpCode, org.eclipse.jetty.websocket.core.exception.ProtocolException, .WebSocketException, org.eclipse.jetty.websocket.core.messages.MessageSink, .PartialByteArrayMessageSink, .PartialByteBufferMessageSink, .PartialStringMessageSink, org.eclipse.jetty.websocket.core.util.InvokerUtils, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private MessageSink
private JakartaWebSocketMessageMetadata
private MessageSink
private MethodHandle
private final AtomicBoolean
private final JakartaWebSocketContainer
private CoreSession
protected byte
private EndpointConfig
private final Object
private MethodHandle
private final AutoLock
private final Logger
private final Map<Byte, RegisteredMessageHandler>
private MethodHandle
private MethodHandle
private JakartaWebSocketSession
private JakartaWebSocketMessageMetadata
private MessageSink
private final UpgradeRequest

Constructor Summary

AccessConstructor and Description
public
JakartaWebSocketFrameHandler(JakartaWebSocketContainer container, UpgradeRequest upgradeRequest, Object endpointInstance, MethodHandle openHandle, MethodHandle closeHandle, MethodHandle errorHandle, JakartaWebSocketMessageMetadata textMetadata, JakartaWebSocketMessageMetadata binaryMetadata, MethodHandle pongHandle, EndpointConfig endpointConfig)

Method Summary

Modifier and TypeMethod and Description
private void
acceptMessage(Frame frame, Callback callback)

public <T> void
public <T> void
private void
assertBasicTypeNotRegistered(byte basicWebSocketType, MessageHandler replacement)

private void
public JakartaWebSocketMessageMetadata
public Object
public EndpointConfig
public Map<Byte, RegisteredMessageHandler>
public Set<MessageHandler>
public JakartaWebSocketSession
public JakartaWebSocketMessageMetadata
public UpgradeRequest
private EndpointConfig
private void
notifyOnClose(CloseStatus closeStatus, Callback callback)

public void
onBinary(Frame frame, Callback callback)

public void
onClose(Frame frame, Callback callback)

public void
onClosed(CloseStatus
the close status received from the remote peer, or generated locally in the case of abnormal closures.
closeStatus
,
Callback
the callback to indicate success or failure of the processing of this event.
callback
)

Implements org.eclipse.jetty.websocket.core.FrameHandler.onClosed.

Invoked when a WebSocket close event happened.

public void
onContinuation(Frame frame, Callback callback)

public void
onError(Throwable
the error cause
cause
,
Callback
the callback to indicate success or failure of the processing of this event.
callback
)

Implements org.eclipse.jetty.websocket.core.FrameHandler.onError.

Invoked when an error has occurred or has been detected.

public void
onFrame(Frame
the WebSocket frame.
frame
,
Callback
the callback to indicate success or failure of the processing of this event.
callback
)

Implements org.eclipse.jetty.websocket.core.FrameHandler.onFrame.

Invoked when a WebSocket frame is received.

public void
onOpen(CoreSession
the session associated with this connection.
coreSession
,
Callback
the callback to indicate success or failure of the processing of this event.
callback
)

Implements org.eclipse.jetty.websocket.core.FrameHandler.onOpen.

Invoked when the WebSocket connection is opened.

public void
onPing(Frame frame, Callback callback)

public void
onPong(Frame frame, Callback callback)

public void
onText(Frame frame, Callback callback)

private void
registerMessageHandler(Class<?> clazz, MessageHandler handler, byte basicMessageType, JakartaWebSocketMessageMetadata metadata)

private <T> MessageSink
registerMessageHandler(byte basicWebSocketMessageType, Class<T> handlerType, MessageHandler handler, MessageSink messageSink)

public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

activeMessageSinkback to summary
private MessageSink activeMessageSink
binaryMetadataback to summary
private JakartaWebSocketMessageMetadata binaryMetadata
binarySinkback to summary
private MessageSink binarySink
closeHandleback to summary
private MethodHandle closeHandle
closeNotifiedback to summary
private final AtomicBoolean closeNotified
containerback to summary
private final JakartaWebSocketContainer container
coreSessionback to summary
private CoreSession coreSession
dataTypeback to summary
protected byte dataType
endpointConfigback to summary
private EndpointConfig endpointConfig
endpointInstanceback to summary
private final Object endpointInstance
errorHandleback to summary
private MethodHandle errorHandle
lockback to summary
private final AutoLock lock
loggerback to summary
private final Logger logger
messageHandlerMapback to summary
private final Map<Byte, RegisteredMessageHandler> messageHandlerMap
openHandleback to summary
private MethodHandle openHandle
pongHandleback to summary
private MethodHandle pongHandle
sessionback to summary
private JakartaWebSocketSession session
textMetadataback to summary
private JakartaWebSocketMessageMetadata textMetadata
textSinkback to summary
private MessageSink textSink
upgradeRequestback to summary
private final UpgradeRequest upgradeRequest

Constructor Detail

JakartaWebSocketFrameHandlerback to summary
public JakartaWebSocketFrameHandler(JakartaWebSocketContainer container, UpgradeRequest upgradeRequest, Object endpointInstance, MethodHandle openHandle, MethodHandle closeHandle, MethodHandle errorHandle, JakartaWebSocketMessageMetadata textMetadata, JakartaWebSocketMessageMetadata binaryMetadata, MethodHandle pongHandle, EndpointConfig endpointConfig)

Method Detail

acceptMessageback to summary
private void acceptMessage(Frame frame, Callback callback)
addMessageHandlerback to summary
public <T> void addMessageHandler(Class<T> clazz, MessageHandler.Partial<T> handler)
addMessageHandlerback to summary
public <T> void addMessageHandler(Class<T> clazz, MessageHandler.Whole<T> handler)
assertBasicTypeNotRegisteredback to summary
private void assertBasicTypeNotRegistered(byte basicWebSocketType, MessageHandler replacement)
configListenerback to summary
private void configListener(String key, Object value)
getBinaryMetadataback to summary
public JakartaWebSocketMessageMetadata getBinaryMetadata()
getEndpointback to summary
public Object getEndpoint()
getEndpointConfigback to summary
public EndpointConfig getEndpointConfig()
getMessageHandlerMapback to summary
public Map<Byte, RegisteredMessageHandler> getMessageHandlerMap()
getMessageHandlersback to summary
public Set<MessageHandler> getMessageHandlers()
getSessionback to summary
public JakartaWebSocketSession getSession()
getTextMetadataback to summary
public JakartaWebSocketMessageMetadata getTextMetadata()
getUpgradeRequestback to summary
public UpgradeRequest getUpgradeRequest()
getWrappedEndpointConfigback to summary
private EndpointConfig getWrappedEndpointConfig()
notifyOnCloseback to summary
private void notifyOnClose(CloseStatus closeStatus, Callback callback)
onBinaryback to summary
public void onBinary(Frame frame, Callback callback)
onCloseback to summary
public void onClose(Frame frame, Callback callback)
onClosedback to summary
public void onClosed(CloseStatus closeStatus, Callback callback)

Implements org.eclipse.jetty.websocket.core.FrameHandler.onClosed.

Doc from org.eclipse.jetty.websocket.core.FrameHandler.onClosed.

Invoked when a WebSocket close event happened.

The WebSocket connection is closed, no reading or writing is possible anymore.

Implementations of this method may cleanup resources that have been allocated.

This method will not be called more than once.

Parameters
closeStatus:CloseStatus

the close status received from the remote peer, or generated locally in the case of abnormal closures.

callback:Callback

the callback to indicate success or failure of the processing of this event.

Annotations
@Override
onContinuationback to summary
public void onContinuation(Frame frame, Callback callback)
onErrorback to summary
public void onError(Throwable cause, Callback callback)

Implements org.eclipse.jetty.websocket.core.FrameHandler.onError.

Doc from org.eclipse.jetty.websocket.core.FrameHandler.onError.

Invoked when an error has occurred or has been detected.

A call to this method will be followed by a call to onClosed(CloseStatus, Callback) with the close status derived from the error.

This method will not be called more than once, onClosed(CloseStatus, Callback) will be called on the callback completion.

Parameters
cause:Throwable

the error cause

callback:Callback

the callback to indicate success or failure of the processing of this event.

Annotations
@Override
onFrameback to summary
public void onFrame(Frame frame, Callback callback)

Implements org.eclipse.jetty.websocket.core.FrameHandler.onFrame.

Doc from org.eclipse.jetty.websocket.core.FrameHandler.onFrame.

Invoked when a WebSocket frame is received.

This method will never be called concurrently for the same session; will be called sequentially to satisfy the outstanding demand signaled by calls to CoreSession#demand().

Both control and data frames are passed to this method.

CLOSE frames may be responded from this method, but if they are not responded, then the implementation will respond when the callback is completed.

The callback argument must be completed to indicate that the buffers associated with the frame can be recycled.

Additional WebSocket frames (of any type, including CLOSE frames) cannot be received until a call to CoreSession#demand() is made.

Parameters
frame:Frame

the WebSocket frame.

callback:Callback

the callback to indicate success or failure of the processing of this event.

Annotations
@Override
onOpenback to summary
public void onOpen(CoreSession coreSession, Callback callback)

Implements org.eclipse.jetty.websocket.core.FrameHandler.onOpen.

Doc from org.eclipse.jetty.websocket.core.FrameHandler.onOpen.

Invoked when the WebSocket connection is opened.

It is allowed to send WebSocket frames via CoreSession#sendFrame(Frame, Callback, boolean).

WebSocket frames cannot be received until a call to CoreSession#demand() is made.

If the callback argument is failed, the implementation sends a CLOSE frame with CloseStatus#SERVER_ERROR, and the connection will be closed.

Parameters
coreSession:CoreSession

the session associated with this connection.

callback:Callback

the callback to indicate success or failure of the processing of this event.

Annotations
@Override
onPingback to summary
public void onPing(Frame frame, Callback callback)
onPongback to summary
public void onPong(Frame frame, Callback callback)
onTextback to summary
public void onText(Frame frame, Callback callback)
registerMessageHandlerback to summary
private void registerMessageHandler(Class<?> clazz, MessageHandler handler, byte basicMessageType, JakartaWebSocketMessageMetadata metadata)
registerMessageHandlerback to summary
private <T> MessageSink registerMessageHandler(byte basicWebSocketMessageType, Class<T> handlerType, MessageHandler handler, MessageSink messageSink)
removeMessageHandlerback to summary
public void removeMessageHandler(MessageHandler handler)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object