Top Description Fields Constructors Methods
org.springframework.web.socket.handler

public Class ExceptionWebSocketHandlerDecorator

extends WebSocketHandlerDecorator
Class Inheritance
Imports
org.apache.commons.logging.Log, .LogFactory, org.springframework.web.socket.CloseStatus, .WebSocketHandler, .WebSocketMessage, .WebSocketSession

An exception handling WebSocketHandlerDecorator. Traps all Throwable instances that escape from the decorated handler and closes the session with CloseStatus#SERVER_ERROR.
Author
Rossen Stoyanchev
Since
4.0

Field Summary

Modifier and TypeField and Description
private static final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)

Overrides org.springframework.web.socket.handler.WebSocketHandlerDecorator.afterConnectionClosed.

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionClosed.

Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred.

public void
afterConnectionEstablished(WebSocketSession session)

Overrides org.springframework.web.socket.handler.WebSocketHandlerDecorator.afterConnectionEstablished.

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished.

Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.

public void
public void
public static void
tryCloseWithError(WebSocketSession session, Throwable exception, Log logger)

Inherited from org.springframework.web.socket.handler.WebSocketHandlerDecorator:
getDelegategetLastHandlersupportsPartialMessagestoStringunwrap

Field Detail

loggerback to summary
private static final Log logger

Constructor Detail

ExceptionWebSocketHandlerDecoratorback to summary
public ExceptionWebSocketHandlerDecorator(WebSocketHandler delegate)

Method Detail

afterConnectionClosedback to summary
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)

Overrides org.springframework.web.socket.handler.WebSocketHandlerDecorator.afterConnectionClosed.

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionClosed.

Doc from org.springframework.web.socket.WebSocketHandler.afterConnectionClosed.

Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred. Although the session may technically still be open, depending on the underlying implementation, sending messages at this point is discouraged and most likely will not succeed.

Annotations
@Override
afterConnectionEstablishedback to summary
public void afterConnectionEstablished(WebSocketSession session)

Overrides org.springframework.web.socket.handler.WebSocketHandlerDecorator.afterConnectionEstablished.

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished.

Doc from org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished.

Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.

Annotations
@Override
handleMessageback to summary
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message)

Overrides org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage.

Implements org.springframework.web.socket.WebSocketHandler.handleMessage.

Doc from org.springframework.web.socket.WebSocketHandler.handleMessage.

Invoked when a new WebSocket message arrives.

Annotations
@Override
handleTransportErrorback to summary
public void handleTransportError(WebSocketSession session, Throwable exception)

Overrides org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleTransportError.

Implements org.springframework.web.socket.WebSocketHandler.handleTransportError.

Doc from org.springframework.web.socket.WebSocketHandler.handleTransportError.

Handle an error from the underlying WebSocket message transport.

Annotations
@Override
tryCloseWithErrorback to summary
public static void tryCloseWithError(WebSocketSession session, Throwable exception, Log logger)