| Constructor and Description |
|---|
WsSession(Endpoint localEndpoint,
WsRemoteEndpointImplBase wsRemoteEndpoint,
WsWebSocketContainer wsWebSocketContainer,
java.net.URI requestUri,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> requestParameterMap,
java.lang.String queryString,
java.security.Principal userPrincipal,
java.lang.String httpSessionId,
java.lang.String subProtocol,
java.util.Map<java.lang.String,java.lang.String> pathParameters,
boolean secure,
EndpointConfig endpointConfig)
Creates a new WebSocket session for communication between the two
provided end points.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMessageHandler(MessageHandler listener) |
protected static void |
appendCloseReasonWithTruncation(java.nio.ByteBuffer msg,
java.lang.String reason)
Use protected so unit tests can access this method directly.
|
protected void |
checkExpiration() |
void |
close()
Close the connection to the remote end point using the code
CloseReason.CloseCodes.NORMAL_CLOSURE and an
empty reason phrase. |
void |
close(CloseReason closeReason)
Close the connection to the remote end point using the specified code
and reason phrase.
|
RemoteEndpoint.Async |
getAsyncRemote() |
RemoteEndpoint.Basic |
getBasicRemote() |
protected MessageHandler |
getBinaryMessageHandler() |
WebSocketContainer |
getContainer()
Returns the container that created this session.
|
java.lang.String |
getHttpSessionId() |
java.lang.String |
getId()
Provides a unique identifier for the session.
|
Endpoint |
getLocal() |
int |
getMaxBinaryMessageBufferSize()
Get the current maximum buffer size (in bytes) for binary messages.
|
long |
getMaxIdleTimeout()
Get the idle timeout for this session in milliseconds.
|
int |
getMaxTextMessageBufferSize()
Get the current maximum buffer size (in characters) for text messages.
|
java.util.Set<MessageHandler> |
getMessageHandlers() |
java.util.List<Extension> |
getNegotiatedExtensions() |
java.lang.String |
getNegotiatedSubprotocol() |
java.util.Set<Session> |
getOpenSessions()
Obtain the set of currently open sessions for the local endpoint that
this session is associated with.
|
java.util.Map<java.lang.String,java.lang.String> |
getPathParameters() |
protected MessageHandler.Whole<PongMessage> |
getPongMessageHandler() |
java.lang.String |
getProtocolVersion() |
java.lang.String |
getQueryString() |
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getRequestParameterMap() |
java.net.URI |
getRequestURI() |
protected MessageHandler |
getTextMessageHandler() |
java.security.Principal |
getUserPrincipal() |
java.util.Map<java.lang.String,java.lang.Object> |
getUserProperties() |
boolean |
isOpen() |
boolean |
isSecure() |
void |
onClose(CloseReason closeReason)
Called when a close message is received.
|
protected void |
registerFuture(org.apache.tomcat.websocket.FutureToSendHandler f2sh)
Make the session aware of a
FutureToSendHandler that will need to
be forcibly closed if the session closes before the
FutureToSendHandler completes. |
void |
removeMessageHandler(MessageHandler listener) |
void |
setMaxBinaryMessageBufferSize(int max)
Set the current maximum buffer size (in bytes) for binary messages.
|
void |
setMaxIdleTimeout(long timeout)
Set the idle timeout for this session in milliseconds.
|
void |
setMaxTextMessageBufferSize(int max)
Set the current maximum buffer size (in characters) for text messages.
|
protected void |
unregisterFuture(org.apache.tomcat.websocket.FutureToSendHandler f2sh)
Remove a
FutureToSendHandler from the set of tracked instances. |
protected void |
updateLastActive() |
public WsSession(Endpoint localEndpoint, WsRemoteEndpointImplBase wsRemoteEndpoint, WsWebSocketContainer wsWebSocketContainer, java.net.URI requestUri, java.util.Map<java.lang.String,java.util.List<java.lang.String>> requestParameterMap, java.lang.String queryString, java.security.Principal userPrincipal, java.lang.String httpSessionId, java.lang.String subProtocol, java.util.Map<java.lang.String,java.lang.String> pathParameters, boolean secure, EndpointConfig endpointConfig) throws DeploymentException
Thread.getContextClassLoader()
at the time this constructor is called will be used when calling
Endpoint.onClose(Session, CloseReason).localEndpoint - wsRemoteEndpoint - DeploymentExceptionpublic WebSocketContainer getContainer()
javax.websocket.SessiongetContainer in interface Sessionpublic void addMessageHandler(MessageHandler listener)
addMessageHandler in interface Sessionpublic java.util.Set<MessageHandler> getMessageHandlers()
getMessageHandlers in interface Sessionpublic void removeMessageHandler(MessageHandler listener)
removeMessageHandler in interface Sessionpublic java.lang.String getProtocolVersion()
getProtocolVersion in interface Sessionpublic java.lang.String getNegotiatedSubprotocol()
getNegotiatedSubprotocol in interface Sessionpublic java.util.List<Extension> getNegotiatedExtensions()
getNegotiatedExtensions in interface Sessionpublic long getMaxIdleTimeout()
javax.websocket.SessiongetMaxIdleTimeout in interface Sessionpublic void setMaxIdleTimeout(long timeout)
javax.websocket.SessionsetMaxIdleTimeout in interface Sessionpublic void setMaxBinaryMessageBufferSize(int max)
javax.websocket.SessionsetMaxBinaryMessageBufferSize in interface Sessionpublic int getMaxBinaryMessageBufferSize()
javax.websocket.SessiongetMaxBinaryMessageBufferSize in interface Sessionpublic void setMaxTextMessageBufferSize(int max)
javax.websocket.SessionsetMaxTextMessageBufferSize in interface Sessionpublic int getMaxTextMessageBufferSize()
javax.websocket.SessiongetMaxTextMessageBufferSize in interface Sessionpublic java.util.Set<Session> getOpenSessions()
javax.websocket.SessiongetOpenSessions in interface Sessionpublic RemoteEndpoint.Async getAsyncRemote()
getAsyncRemote in interface Sessionpublic RemoteEndpoint.Basic getBasicRemote()
getBasicRemote in interface Sessionpublic void close()
throws java.io.IOException
javax.websocket.SessionCloseReason.CloseCodes.NORMAL_CLOSURE and an
empty reason phrase.public void close(CloseReason closeReason) throws java.io.IOException
javax.websocket.Sessionpublic void onClose(CloseReason closeReason)
protected static void appendCloseReasonWithTruncation(java.nio.ByteBuffer msg,
java.lang.String reason)
protected void registerFuture(org.apache.tomcat.websocket.FutureToSendHandler f2sh)
FutureToSendHandler that will need to
be forcibly closed if the session closes before the
FutureToSendHandler completes.protected void unregisterFuture(org.apache.tomcat.websocket.FutureToSendHandler f2sh)
FutureToSendHandler from the set of tracked instances.public java.net.URI getRequestURI()
getRequestURI in interface Sessionpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestParameterMap()
getRequestParameterMap in interface Sessionpublic java.lang.String getQueryString()
getQueryString in interface Sessionpublic java.security.Principal getUserPrincipal()
getUserPrincipal in interface Sessionpublic java.util.Map<java.lang.String,java.lang.String> getPathParameters()
getPathParameters in interface Sessionpublic java.lang.String getId()
javax.websocket.Sessionpublic java.util.Map<java.lang.String,java.lang.Object> getUserProperties()
getUserProperties in interface Sessionpublic Endpoint getLocal()
public java.lang.String getHttpSessionId()
protected MessageHandler getTextMessageHandler()
protected MessageHandler getBinaryMessageHandler()
protected MessageHandler.Whole<PongMessage> getPongMessageHandler()
protected void updateLastActive()
protected void checkExpiration()
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.