Package org.xwiki.websocket
Class AbstractXWikiEndpoint
- java.lang.Object
-
- javax.websocket.Endpoint
-
- org.xwiki.websocket.AbstractXWikiEndpoint
-
- All Implemented Interfaces:
org.xwiki.websocket.EndpointComponent
public abstract class AbstractXWikiEndpoint extends javax.websocket.Endpoint implements org.xwiki.websocket.EndpointComponent
Base class for WebSocket end-points that require the XWiki execution context to be properly set-up.- Since:
- 13.7RC1
- Version:
- $Id: af8cee9fc621f555ab899abd0c8738b0c4e54041 $
-
-
Constructor Summary
Constructors Constructor Description AbstractXWikiEndpoint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
close(javax.websocket.Session session, javax.websocket.CloseReason.CloseCode closeCode, String reasonPhrase)
Try to close the given session using the specified code and reason.protected <T> void
handleMessage(javax.websocket.Session session, T message)
Handles a received message by calling eitheronMessage(Session, T)
oronMessage(T)
.protected <T> void
handleMessage(javax.websocket.Session session, T message, boolean last)
Handles a received message by calling eitheronMessage(Session, T)
oronMessage(T)
.
-
-
-
Method Detail
-
handleMessage
protected <T> void handleMessage(javax.websocket.Session session, T message)
Handles a received message by calling eitheronMessage(Session, T)
oronMessage(T)
. If the value returned byonMessage
matches the message type then we send it back.- Type Parameters:
T
- the message type- Parameters:
session
- the WebSocket session in which the message was receivedmessage
- the received message
-
handleMessage
protected <T> void handleMessage(javax.websocket.Session session, T message, boolean last)
Handles a received message by calling eitheronMessage(Session, T)
oronMessage(T)
. If the value returned byonMessage
matches the message type then we send it back.- Type Parameters:
T
- the message type- Parameters:
session
- the WebSocket session in which the message was receivedmessage
- the received messagelast
- whether this is the last message chunk or not, useful when handling partial messages
-
close
protected void close(javax.websocket.Session session, javax.websocket.CloseReason.CloseCode closeCode, String reasonPhrase)
Try to close the given session using the specified code and reason.- Parameters:
session
- the session to closecloseCode
- the error codereasonPhrase
- the reason to close the session
-
-