public class TyrusEndpoint extends WebSocketApplication implements SPIRegisteredEndpoint
SPIRegisteredEndpoint.
Please note that for one connection to WebSocketApplication it is guaranteed that the methods:
isApplicationRequest, createSocket, getSupportedProtocols, getSupportedExtensions are called in this order.
Handshakes| Constructor and Description |
|---|
TyrusEndpoint(SPIEndpoint endpoint)
Create
TyrusEndpoint which represents given SPIEndpoint. |
| Modifier and Type | Method and Description |
|---|---|
WebSocket |
createSocket(ProtocolHandler handler,
WebSocketRequest requestPacket,
WebSocketListener... listeners) |
static javax.websocket.CloseReason.CloseCode |
getCloseCode(int code)
Creates
CloseReason.CloseCode from given integer value. |
Set<javax.websocket.Session> |
getOpenSessions() |
List<Extension> |
getSupportedExtensions() |
List<String> |
getSupportedProtocols(List<String> subProtocol) |
boolean |
isApplicationRequest(WebSocketRequest o) |
void |
onClose(WebSocket socket,
ClosingFrame frame) |
void |
onConnect(WebSocket socket) |
boolean |
onError(WebSocket webSocket,
Throwable t) |
void |
onExtensionNegotiation(List<Extension> extensions) |
void |
onFragment(WebSocket socket,
byte[] fragment,
boolean last) |
void |
onFragment(WebSocket socket,
String fragment,
boolean last) |
void |
onHandShakeResponse(WebSocketRequest request,
WebSocketResponse response) |
void |
onMessage(WebSocket socket,
byte[] bytes) |
void |
onMessage(WebSocket socket,
String messageString) |
void |
onPing(WebSocket socket,
byte[] bytes) |
void |
onPong(WebSocket socket,
byte[] bytes) |
void |
remove() |
getWebSockets, handshake, upgradepublic TyrusEndpoint(SPIEndpoint endpoint)
TyrusEndpoint which represents given SPIEndpoint.endpoint - endpoint to be wrapped.public boolean isApplicationRequest(WebSocketRequest o)
isApplicationRequest in class WebSocketApplicationpublic WebSocket createSocket(ProtocolHandler handler, WebSocketRequest requestPacket, WebSocketListener... listeners)
createSocket in class WebSocketApplicationpublic void onConnect(WebSocket socket)
onConnect in interface WebSocketListeneronConnect in class WebSocketApplicationpublic void onFragment(WebSocket socket, String fragment, boolean last)
onFragment in interface WebSocketListenerpublic void onFragment(WebSocket socket, byte[] fragment, boolean last)
onFragment in interface WebSocketListenerpublic void onMessage(WebSocket socket, String messageString)
onMessage in interface WebSocketListenerpublic void onMessage(WebSocket socket, byte[] bytes)
onMessage in interface WebSocketListenerpublic void onClose(WebSocket socket, ClosingFrame frame)
onClose in interface WebSocketListeneronClose in class WebSocketApplicationpublic void onPong(WebSocket socket, byte[] bytes)
onPong in interface WebSocketListenerpublic void remove()
remove in interface SPIRegisteredEndpointpublic Set<javax.websocket.Session> getOpenSessions()
getOpenSessions in interface SPIRegisteredEndpointpublic void onExtensionNegotiation(List<Extension> extensions)
onExtensionNegotiation in class WebSocketApplicationpublic List<Extension> getSupportedExtensions()
getSupportedExtensions in class WebSocketApplicationpublic boolean onError(WebSocket webSocket, Throwable t)
onError in class WebSocketApplicationpublic List<String> getSupportedProtocols(List<String> subProtocol)
getSupportedProtocols in class WebSocketApplicationpublic void onPing(WebSocket socket, byte[] bytes)
onPing in interface WebSocketListenerpublic void onHandShakeResponse(WebSocketRequest request, WebSocketResponse response)
onHandShakeResponse in class WebSocketApplicationpublic static javax.websocket.CloseReason.CloseCode getCloseCode(int code)
CloseReason.CloseCode from given integer value.
Present only for our convenience, should be removed once http://java.net/jira/browse/WEBSOCKET_SPEC-102 is
resolved.code - close code.CloseReason.CloseCode instance corresponding to given value or newly created
anonymous class if code is not present in CloseReason.CloseCodes enumeration.IllegalArgumentException - when code is smaller than 1000 (not used) or bigger than 4999. See RFC-6455,
section 7.4 for more details.Copyright © 2012-2013. All Rights Reserved.