public class ExceptionWebSocketHandlerDecorator extends WebSocketHandlerDecorator
WebSocketHandlerDecorator
. Traps all Throwable
instances that escape from the decorated handler and closes the session with
CloseStatus.SERVER_ERROR
.Modifier and Type | Field and Description |
---|---|
private Log |
logger |
Constructor and Description |
---|
ExceptionWebSocketHandlerDecorator(WebSocketHandler delegate) |
Modifier and Type | Method and Description |
---|---|
void |
afterConnectionClosed(WebSocketSession session,
CloseStatus closeStatus)
Invoked after the WebSocket connection has been closed by either side, or after a
transport error has occurred.
|
void |
afterConnectionEstablished(WebSocketSession session)
Invoked after WebSocket negotiation has succeeded and the WebSocket connection is
opened and ready for use.
|
void |
handleMessage(WebSocketSession session,
WebSocketMessage<?> message)
Invoked when a new WebSocket message arrives.
|
void |
handleTransportError(WebSocketSession session,
java.lang.Throwable exception)
Handle an error from the underlying WebSocket message transport.
|
static void |
tryCloseWithError(WebSocketSession session,
java.lang.Throwable exception,
Log logger) |
getDelegate, supportsPartialMessages, toString
public ExceptionWebSocketHandlerDecorator(WebSocketHandler delegate)
public void afterConnectionEstablished(WebSocketSession session)
WebSocketHandler
afterConnectionEstablished
in interface WebSocketHandler
afterConnectionEstablished
in class WebSocketHandlerDecorator
public static void tryCloseWithError(WebSocketSession session, java.lang.Throwable exception, Log logger)
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message)
WebSocketHandler
handleMessage
in interface WebSocketHandler
handleMessage
in class WebSocketHandlerDecorator
public void handleTransportError(WebSocketSession session, java.lang.Throwable exception)
WebSocketHandler
handleTransportError
in interface WebSocketHandler
handleTransportError
in class WebSocketHandlerDecorator
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)
WebSocketHandler
afterConnectionClosed
in interface WebSocketHandler
afterConnectionClosed
in class WebSocketHandlerDecorator