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

public Class JettyWebSocketFrameHandler

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, .MethodHandles, .MethodType, java.lang.reflect.InvocationTargetException, java.nio.ByteBuffer, java.nio.channels.ClosedChannelException, java.util.concurrent.CompletableFuture, java.util.concurrent.atomic.AtomicBoolean, org.eclipse.jetty.util.BufferUtil, .Callback, org.eclipse.jetty.websocket.api.UpgradeRequest, .UpgradeResponse, .WebSocketContainer, org.eclipse.jetty.websocket.core.CloseStatus, .CoreSession, .Frame, .FrameHandler, .OpCode, org.eclipse.jetty.websocket.core.exception.BadPayloadException, .CloseException, .InvalidSignatureException, .MessageTooLargeException, .ProtocolException, .UpgradeException, .WebSocketException, .WebSocketTimeoutException, org.eclipse.jetty.websocket.core.messages.MessageSink, org.eclipse.jetty.websocket.core.util.InvokerUtils, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private MessageSink
private MethodHandle
private MessageSink
private final Class<? extends MessageSink>
private MethodHandle
private final AtomicBoolean
private final WebSocketContainer
private final Object
private MethodHandle
private MethodHandle
private final Logger
private final JettyWebSocketFrameHandlerMetadata
private MethodHandle
private MethodHandle
private MethodHandle
private WebSocketSession
private MethodHandle
private MessageSink
private final Class<? extends MessageSink>
private UpgradeRequest
private UpgradeResponse

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

private void
public static Throwable
private static MessageSink
createMessageSink(Class<? extends MessageSink> sinkClass, WebSocketSession session, MethodHandle msgHandle, boolean autoDemanding)

public WebSocketSession
public UpgradeRequest
public UpgradeResponse
private void
pack-priv boolean
private void
notifyOnClose(CloseStatus closeStatus, Callback callback)

private void
onBinaryFrame(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.

private void
onCloseFrame(Frame frame, Callback callback)

private void
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.
coreCallback
)

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.

private void
onPingFrame(Frame frame, Callback callback)

private void
onPongFrame(Frame frame, Callback callback)

private void
onTextFrame(Frame frame, Callback callback)

public void
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
binaryHandleback to summary
private MethodHandle binaryHandle
binarySinkback to summary
private MessageSink binarySink
binarySinkClassback to summary
private final Class<? extends MessageSink> binarySinkClass
closeHandleback to summary
private MethodHandle closeHandle
closeNotifiedback to summary
private final AtomicBoolean closeNotified
containerback to summary
private final WebSocketContainer container
endpointInstanceback to summary
private final Object endpointInstance
errorHandleback to summary
private MethodHandle errorHandle
frameHandleback to summary
private MethodHandle frameHandle
logback to summary
private final Logger log
metadataback to summary
private final JettyWebSocketFrameHandlerMetadata metadata
openHandleback to summary
private MethodHandle openHandle
pingHandleback to summary
private MethodHandle pingHandle
pongHandleback to summary
private MethodHandle pongHandle
sessionback to summary
private WebSocketSession session
textHandleback to summary
private MethodHandle textHandle
textSinkback to summary
private MessageSink textSink
textSinkClassback to summary
private final Class<? extends MessageSink> textSinkClass
upgradeRequestback to summary
private UpgradeRequest upgradeRequest
upgradeResponseback to summary
private UpgradeResponse upgradeResponse

Constructor Detail

JettyWebSocketFrameHandlerback to summary
public JettyWebSocketFrameHandler(WebSocketContainer container, Object endpointInstance, JettyWebSocketFrameHandlerMetadata metadata)

Method Detail

acceptFrameback to summary
private void acceptFrame(Frame frame, Callback callback)
autoDemandback to summary
private void autoDemand()
convertCauseback to summary
public static Throwable convertCause(Throwable cause)
createMessageSinkback to summary
private static MessageSink createMessageSink(Class<? extends MessageSink> sinkClass, WebSocketSession session, MethodHandle msgHandle, boolean autoDemanding)
getSessionback to summary
public WebSocketSession getSession()
getUpgradeRequestback to summary
public UpgradeRequest getUpgradeRequest()
getUpgradeResponseback to summary
public UpgradeResponse getUpgradeResponse()
internalDemandback to summary
private void internalDemand()
isAutoDemandback to summary
pack-priv boolean isAutoDemand()
notifyOnCloseback to summary
private void notifyOnClose(CloseStatus closeStatus, Callback callback)
onBinaryFrameback to summary
private void onBinaryFrame(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
onCloseFrameback to summary
private void onCloseFrame(Frame frame, Callback callback)
onContinuationFrameback to summary
private void onContinuationFrame(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 coreCallback)

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.

coreCallback: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
onPingFrameback to summary
private void onPingFrame(Frame frame, Callback callback)
onPongFrameback to summary
private void onPongFrame(Frame frame, Callback callback)
onTextFrameback to summary
private void onTextFrame(Frame frame, Callback callback)
setUpgradeRequestback to summary
public void setUpgradeRequest(UpgradeRequest upgradeRequest)
setUpgradeResponseback to summary
public void setUpgradeResponse(UpgradeResponse upgradeResponse)
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