Class JakartaWebSocketFrameHandler
java.lang.Object
org.eclipse.jetty.websocket.jakarta.common.JakartaWebSocketFrameHandler
- All Implemented Interfaces:
FrameHandler
,IncomingFrames
-
Field Summary
-
Constructor Summary
ConstructorDescriptionJakartaWebSocketFrameHandler
(JakartaWebSocketContainer container, UpgradeRequest upgradeRequest, Object endpointInstance, MethodHandle openHandle, MethodHandle closeHandle, MethodHandle errorHandle, JakartaWebSocketMessageMetadata textMetadata, JakartaWebSocketMessageMetadata binaryMetadata, MethodHandle pongHandle, jakarta.websocket.EndpointConfig endpointConfig) -
Method Summary
Modifier and TypeMethodDescription<T> void
addMessageHandler
(Class<T> clazz, jakarta.websocket.MessageHandler.Partial<T> handler) <T> void
addMessageHandler
(Class<T> clazz, jakarta.websocket.MessageHandler.Whole<T> handler) jakarta.websocket.EndpointConfig
Set<jakarta.websocket.MessageHandler>
boolean
Does the FrameHandler manage it's own demand?void
void
void
onClosed
(CloseStatus closeStatus, Callback callback) This is the Close Handshake Complete event.void
onContinuation
(Frame frame, Callback callback) void
An error has occurred or been detected in websocket-core and being reported to FrameHandler.void
Receiver of all Frames.void
onOpen
(CoreSession coreSession, Callback callback) Async notification that Connection is being opened.void
void
void
void
removeMessageHandler
(jakarta.websocket.MessageHandler handler) toString()
-
Field Details
-
dataType
protected byte dataType
-
-
Constructor Details
-
JakartaWebSocketFrameHandler
public JakartaWebSocketFrameHandler(JakartaWebSocketContainer container, UpgradeRequest upgradeRequest, Object endpointInstance, MethodHandle openHandle, MethodHandle closeHandle, MethodHandle errorHandle, JakartaWebSocketMessageMetadata textMetadata, JakartaWebSocketMessageMetadata binaryMetadata, MethodHandle pongHandle, jakarta.websocket.EndpointConfig endpointConfig)
-
-
Method Details
-
getEndpoint
-
getEndpointConfig
public jakarta.websocket.EndpointConfig getEndpointConfig() -
getSession
-
onOpen
Description copied from interface:FrameHandler
Async notification that Connection is being opened.FrameHandler can write during this call, but can not receive frames until the callback is succeeded.
If the FrameHandler succeeds the callback we transition to OPEN state and can now receive frames if not demanding, or can now call
CoreSession.demand(long)
to receive frames if demanding. If the FrameHandler fails the callback a close frame will be sent withCloseStatus.SERVER_ERROR
and the connection will be closed.
- Specified by:
onOpen
in interfaceFrameHandler
- Parameters:
coreSession
- the session associated with this connection.callback
- the callback to indicate success in processing (or failure)
-
onFrame
Description copied from interface:FrameHandler
Receiver of all Frames. This method will never be called in parallel for the same session and will be called sequentially to satisfy all outstanding demand signaled by calls toCoreSession.demand(long)
. Control and Data frames are passed to this method. Close frames may be responded to by the handler, but if an appropriate close response is not sent once the callback is succeeded, then a response close will be generated and sent.- Specified by:
onFrame
in interfaceFrameHandler
- Specified by:
onFrame
in interfaceIncomingFrames
- Parameters:
frame
- the raw framecallback
- the callback to indicate success in processing frame (or failure)
-
onClose
-
onClosed
Description copied from interface:FrameHandler
This is the Close Handshake Complete event.The connection is now closed, no reading or writing is possible anymore. Implementations of FrameHandler can cleanup their resources for this connection now. This method will be called only once.
- Specified by:
onClosed
in interfaceFrameHandler
- Parameters:
closeStatus
- the close status received from remote, or in the case of abnormal closure from local.callback
- the callback to indicate success in processing (or failure)
-
onError
Description copied from interface:FrameHandler
An error has occurred or been detected in websocket-core and being reported to FrameHandler. A call to onError will be followed by a call toFrameHandler.onClosed(CloseStatus, Callback)
giving the close status derived from the error. This will not be called more than once,FrameHandler.onClosed(CloseStatus, Callback)
will be called on the callback completion.- Specified by:
onError
in interfaceFrameHandler
- Parameters:
cause
- the reason for the errorcallback
- the callback to indicate success in processing (or failure)
-
isDemanding
public boolean isDemanding()Description copied from interface:FrameHandler
Does the FrameHandler manage it's own demand?- Specified by:
isDemanding
in interfaceFrameHandler
- Returns:
- true iff the FrameHandler will manage its own flow control by calling
CoreSession.demand(long)
when it is willing to receive new Frames. Otherwise the demand will be managed by an automatic call to demand(1) after every succeeded callback passed toFrameHandler.onFrame(Frame, Callback)
.
-
getMessageHandlers
-
getMessageHandlerMap
-
getBinaryMetadata
-
getTextMetadata
-
addMessageHandler
public <T> void addMessageHandler(Class<T> clazz, jakarta.websocket.MessageHandler.Partial<T> handler) -
addMessageHandler
public <T> void addMessageHandler(Class<T> clazz, jakarta.websocket.MessageHandler.Whole<T> handler) -
removeMessageHandler
public void removeMessageHandler(jakarta.websocket.MessageHandler handler) -
toString
-
onPing
-
onPong
-
onText
-
onBinary
-
onContinuation
-
getUpgradeRequest
-