public class WebSocketHandlerDecorator extends java.lang.Object implements WebSocketHandler
WebSocketHandler
instance and delegates to it.
Also provides a getDelegate()
method to return the decorated
handler as well as a getLastHandler()
method to go through all nested
delegates and return the "last" handler.
Constructor and Description |
---|
WebSocketHandlerDecorator(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.
|
WebSocketHandler |
getDelegate() |
WebSocketHandler |
getLastHandler() |
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.
|
boolean |
supportsPartialMessages()
Whether the WebSocketHandler handles partial messages.
|
java.lang.String |
toString() |
static WebSocketHandler |
unwrap(WebSocketHandler handler) |
public WebSocketHandlerDecorator(WebSocketHandler delegate)
public WebSocketHandler getDelegate()
public WebSocketHandler getLastHandler()
public static WebSocketHandler unwrap(WebSocketHandler handler)
public void afterConnectionEstablished(WebSocketSession session) throws java.lang.Exception
WebSocketHandler
afterConnectionEstablished
in interface WebSocketHandler
java.lang.Exception
- this method can handle or propagate exceptions; see class-level
Javadoc for details.public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws java.lang.Exception
WebSocketHandler
handleMessage
in interface WebSocketHandler
java.lang.Exception
- this method can handle or propagate exceptions; see class-level
Javadoc for details.public void handleTransportError(WebSocketSession session, java.lang.Throwable exception) throws java.lang.Exception
WebSocketHandler
handleTransportError
in interface WebSocketHandler
java.lang.Exception
- this method can handle or propagate exceptions; see class-level
Javadoc for details.public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws java.lang.Exception
WebSocketHandler
afterConnectionClosed
in interface WebSocketHandler
java.lang.Exception
- this method can handle or propagate exceptions; see class-level
Javadoc for details.public boolean supportsPartialMessages()
WebSocketHandler
true
and the underlying WebSocket server supports partial messages,
then a large WebSocket message, or one of an unknown size may be split and
maybe received over multiple calls to
WebSocketHandler.handleMessage(WebSocketSession, WebSocketMessage)
. The flag
WebSocketMessage.isLast()
indicates if
the message is partial and whether it is the last part.supportsPartialMessages
in interface WebSocketHandler
public java.lang.String toString()
toString
in class java.lang.Object