public class JettyWebSocketSession extends AbstractWebSocketSession<org.eclipse.jetty.websocket.api.Session>
WebSocketSession for use with the Jetty 9 WebSocket API.logger| Constructor and Description |
|---|
JettyWebSocketSession(Principal principal,
Map<String,Object> handshakeAttributes)
Create a new
JettyWebSocketSession instance. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeInternal(CloseStatus status) |
String |
getAcceptedProtocol()
Return the negotiated sub-protocol or
null if none was specified or
negotiated successfully. |
List<WebSocketExtension> |
getExtensions()
Return the negotiated extensions or
null if none was specified or
negotiated successfully. |
HttpHeaders |
getHandshakeHeaders()
Return the headers used in the handshake request.
|
String |
getId()
Return a unique session identifier.
|
InetSocketAddress |
getLocalAddress()
Return the address on which the request was received.
|
Principal |
getPrincipal()
Return a
Principal instance containing the name of the
authenticated user. |
InetSocketAddress |
getRemoteAddress()
Return the address of the remote client.
|
URI |
getUri()
Return the URI used to open the WebSocket connection.
|
boolean |
isOpen()
Return whether the connection is still open.
|
protected void |
sendBinaryMessage(BinaryMessage message) |
protected void |
sendPingMessage(PingMessage message) |
protected void |
sendPongMessage(PongMessage message) |
protected void |
sendTextMessage(TextMessage message) |
checkNativeSessionInitialized, close, close, getHandshakeAttributes, getNativeSession, getNativeSession, initializeNativeSession, sendMessage, toStringpublic JettyWebSocketSession(Principal principal, Map<String,Object> handshakeAttributes)
JettyWebSocketSession instance.principal - the user associated with the session, or nullhandshakeAttributes - attributes from the HTTP handshake to make available
through the WebSocket sessionpublic String getId()
WebSocketSessionpublic URI getUri()
WebSocketSessionpublic HttpHeaders getHandshakeHeaders()
WebSocketSessionpublic Principal getPrincipal()
WebSocketSessionPrincipal instance containing the name of the
authenticated user. If the user has not been authenticated, the method returns
null.public InetSocketAddress getLocalAddress()
WebSocketSessionpublic InetSocketAddress getRemoteAddress()
WebSocketSessionpublic String getAcceptedProtocol()
WebSocketSessionnull if none was specified or
negotiated successfully.public List<WebSocketExtension> getExtensions()
WebSocketSessionnull if none was specified or
negotiated successfully.public boolean isOpen()
WebSocketSessionprotected void sendTextMessage(TextMessage message) throws IOException
sendTextMessage in class AbstractWebSocketSession<org.eclipse.jetty.websocket.api.Session>IOExceptionprotected void sendBinaryMessage(BinaryMessage message) throws IOException
sendBinaryMessage in class AbstractWebSocketSession<org.eclipse.jetty.websocket.api.Session>IOExceptionprotected void sendPingMessage(PingMessage message) throws IOException
sendPingMessage in class AbstractWebSocketSession<org.eclipse.jetty.websocket.api.Session>IOExceptionprotected void sendPongMessage(PongMessage message) throws IOException
sendPongMessage in class AbstractWebSocketSession<org.eclipse.jetty.websocket.api.Session>IOExceptionprotected void closeInternal(CloseStatus status) throws IOException
closeInternal in class AbstractWebSocketSession<org.eclipse.jetty.websocket.api.Session>IOException