Top Description Fields Constructors Methods
org.springframework.web.socket.adapter.standard

public Class StandardWebSocketHandlerAdapter

extends Endpoint
Class Inheritance
Imports
java.nio.ByteBuffer, jakarta.websocket.CloseReason, .Endpoint, .EndpointConfig, .MessageHandler, org.apache.commons.logging.Log, .LogFactory, org.springframework.util.Assert, org.springframework.web.socket.BinaryMessage, .CloseStatus, .PongMessage, .TextMessage, .WebSocketHandler, org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator

Adapts a WebSocketHandler to the standard WebSocket for Java API.
Author
Rossen Stoyanchev
Since
4.0

Field Summary

Modifier and TypeField and Description
private final WebSocketHandler
private final Log
private final StandardWebSocketSession

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
handleBinaryMessage(Session session, ByteBuffer payload, boolean isLast)

private void
private void
handleTextMessage(Session session, String payload, boolean isLast)

public void
onClose(Session
The session
session
,
CloseReason
Why the session was closed
reason
)

Overrides jakarta.websocket.Endpoint.onClose.

Event that is triggered when a session has closed.

public void
onError(Session
The session.
session
,
Throwable
The exception.
exception
)

Overrides jakarta.websocket.Endpoint.onError.

Event that is triggered when a protocol error occurs.

public void
onOpen(final Session
The new session.
session
,
EndpointConfig
The configuration with which the Endpoint was configured.
config
)

Implements abstract jakarta.websocket.Endpoint.onOpen.

Event that is triggered when a new session starts.

Field Detail

handlerback to summary
private final WebSocketHandler handler
loggerback to summary
private final Log logger
wsSessionback to summary
private final StandardWebSocketSession wsSession

Constructor Detail

StandardWebSocketHandlerAdapterback to summary
public StandardWebSocketHandlerAdapter(WebSocketHandler handler, StandardWebSocketSession wsSession)

Method Detail

handleBinaryMessageback to summary
private void handleBinaryMessage(Session session, ByteBuffer payload, boolean isLast)
handlePongMessageback to summary
private void handlePongMessage(Session session, ByteBuffer payload)
handleTextMessageback to summary
private void handleTextMessage(Session session, String payload, boolean isLast)
onCloseback to summary
public void onClose(Session session, CloseReason reason)

Overrides jakarta.websocket.Endpoint.onClose.

Doc from jakarta.websocket.Endpoint.onClose.

Event that is triggered when a session has closed.

Parameters
session:Session

The session

reason:CloseReason

Why the session was closed

Annotations
@Override
onErrorback to summary
public void onError(Session session, Throwable exception)

Overrides jakarta.websocket.Endpoint.onError.

Doc from jakarta.websocket.Endpoint.onError.

Event that is triggered when a protocol error occurs.

Parameters
session:Session

The session.

exception:Throwable

The exception.

Annotations
@Override
onOpenback to summary
public void onOpen(final Session session, EndpointConfig config)

Implements abstract jakarta.websocket.Endpoint.onOpen.

Doc from jakarta.websocket.Endpoint.onOpen.

Event that is triggered when a new session starts.

Parameters
session:Session

The new session.

config:EndpointConfig

The configuration with which the Endpoint was configured.

Annotations
@Override