Class ExceptionWebSocketHandlerDecorator
java.lang.Object
org.springframework.web.socket.handler.WebSocketHandlerDecorator
org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator
- All Implemented Interfaces:
WebSocketHandler
An exception handling
WebSocketHandlerDecorator.
Traps all Throwable instances that escape from the decorated
handler and closes the session with CloseStatus.SERVER_ERROR.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred.voidInvoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.voidhandleMessage(WebSocketSession session, WebSocketMessage<?> message) Invoked when a new WebSocket message arrives.voidhandleTransportError(WebSocketSession session, Throwable exception) Handle an error from the underlying WebSocket message transport.static voidtryCloseWithError(WebSocketSession session, Throwable exception, org.apache.commons.logging.Log logger) Methods inherited from class WebSocketHandlerDecorator
getDelegate, getLastHandler, supportsPartialMessages, toString, unwrap
-
Constructor Details
-
ExceptionWebSocketHandlerDecorator
-
-
Method Details
-
afterConnectionEstablished
Description copied from interface:WebSocketHandlerInvoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.- Specified by:
afterConnectionEstablishedin interfaceWebSocketHandler- Overrides:
afterConnectionEstablishedin classWebSocketHandlerDecorator
-
handleMessage
Description copied from interface:WebSocketHandlerInvoked when a new WebSocket message arrives.- Specified by:
handleMessagein interfaceWebSocketHandler- Overrides:
handleMessagein classWebSocketHandlerDecorator
-
handleTransportError
Description copied from interface:WebSocketHandlerHandle an error from the underlying WebSocket message transport.- Specified by:
handleTransportErrorin interfaceWebSocketHandler- Overrides:
handleTransportErrorin classWebSocketHandlerDecorator
-
afterConnectionClosed
Description copied from interface:WebSocketHandlerInvoked 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.- Specified by:
afterConnectionClosedin interfaceWebSocketHandler- Overrides:
afterConnectionClosedin classWebSocketHandlerDecorator
-
tryCloseWithError
public static void tryCloseWithError(WebSocketSession session, Throwable exception, org.apache.commons.logging.Log logger)
-