类 ExceptionWebSocketHandlerDecorator
- java.lang.Object
- org.springframework.web.socket.handler.WebSocketHandlerDecorator
- org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator
- 所有已实现的接口:
WebSocketHandler
public class ExceptionWebSocketHandlerDecorator extends WebSocketHandlerDecorator
An exception handlingWebSocketHandlerDecorator
. Traps allThrowable
instances that escape from the decorated handler and closes the session withCloseStatus.SERVER_ERROR
.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 ExceptionWebSocketHandlerDecorator(WebSocketHandler delegate)
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 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, Throwable exception)
Handle an error from the underlying WebSocket message transport.static void
tryCloseWithError(WebSocketSession session, Throwable exception, Log logger)
从类继承的方法 org.springframework.web.socket.handler.WebSocketHandlerDecorator
getDelegate, getLastHandler, supportsPartialMessages, toString, unwrap
构造器详细资料
ExceptionWebSocketHandlerDecorator
public ExceptionWebSocketHandlerDecorator(WebSocketHandler delegate)
方法详细资料
afterConnectionEstablished
public void afterConnectionEstablished(WebSocketSession session)
从接口复制的说明:WebSocketHandler
Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.
handleMessage
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message)
从接口复制的说明:WebSocketHandler
Invoked when a new WebSocket message arrives.- 指定者:
handleMessage
在接口中WebSocketHandler
- 覆盖:
handleMessage
在类中WebSocketHandlerDecorator
handleTransportError
public void handleTransportError(WebSocketSession session, Throwable exception)
从接口复制的说明:WebSocketHandler
Handle an error from the underlying WebSocket message transport.
afterConnectionClosed
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)
从接口复制的说明:WebSocketHandler
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.
tryCloseWithError
public static void tryCloseWithError(WebSocketSession session, Throwable exception, Log logger)