public class RemoteSession extends Object implements javax.websocket.Session, DistributedSession
| Modifier and Type | Class and Description |
|---|---|
static class |
RemoteSession.DistributedMapKey |
| Constructor and Description |
|---|
RemoteSession(String sessionId,
ClusterContext clusterContext,
Map<RemoteSession.DistributedMapKey,Object> distributedPropertyMap,
TyrusEndpointWrapper endpointWrapper,
javax.websocket.Session session)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addMessageHandler(Class<T> clazz,
javax.websocket.MessageHandler.Partial<T> handler)
This method is not supported on
RemoteSession. |
<T> void |
addMessageHandler(Class<T> clazz,
javax.websocket.MessageHandler.Whole<T> handler)
This method is not supported on
RemoteSession. |
void |
addMessageHandler(javax.websocket.MessageHandler handler)
This method is not supported on
RemoteSession. |
void |
close()
Close the current conversation with a normal status code and no reason phrase.
|
void |
close(javax.websocket.CloseReason closeReason)
Close the current conversation, giving a reason for the closure.
|
javax.websocket.RemoteEndpoint.Async |
getAsyncRemote()
Get a reference a
RemoteEndpoint.Async object representing the peer of this conversation
that is able to send messages asynchronously to the peer. |
javax.websocket.RemoteEndpoint.Basic |
getBasicRemote()
Get a reference a
RemoteEndpoint.Basic object representing the peer of this conversation
that is able to send messages synchronously to the peer. |
javax.websocket.WebSocketContainer |
getContainer()
This method is not supported on
RemoteSession. |
Map<String,Object> |
getDistributedProperties()
Get distributed properties.
|
String |
getId()
Get a string containing the unique identifier assigned to this session.
|
int |
getMaxBinaryMessageBufferSize()
Get the maximum length of incoming binary messages that this Session can buffer.
|
long |
getMaxIdleTimeout()
Get the number of milliseconds before this conversation may be closed by the
container if it is inactive, i.e.
|
int |
getMaxTextMessageBufferSize()
Get the maximum length of incoming text messages that this Session can buffer.
|
Set<javax.websocket.MessageHandler> |
getMessageHandlers()
This method is not supported on
RemoteSession. |
List<javax.websocket.Extension> |
getNegotiatedExtensions()
Get the list of extensions currently in use for this conversation.
|
String |
getNegotiatedSubprotocol()
Get the sub protocol agreed during the websocket handshake for this conversation.
|
Set<javax.websocket.Session> |
getOpenSessions()
This method is not supported on
RemoteSession. |
Map<String,String> |
getPathParameters()
Get a map of the path parameter names and values used associated with the
request this session was opened under.
|
String |
getProtocolVersion()
Get the version of the websocket protocol currently being used.
|
String |
getQueryString()
Get the query string associated with the request this session
was opened under.
|
Map<String,List<String>> |
getRequestParameterMap()
Get the request parameters associated with the request this session
was opened under.
|
URI |
getRequestURI()
Get the
URI under which this session was opened, including
the query string if there is one. |
Principal |
getUserPrincipal()
Get the authenticated user for this session or
null if no user is authenticated for this session. |
Map<String,Object> |
getUserProperties()
This method is not supported on
RemoteSession. |
boolean |
isOpen()
Get the information about session state.
|
boolean |
isSecure()
Get the information about secure transport.
|
void |
removeMessageHandler(javax.websocket.MessageHandler handler)
This method is not supported on
RemoteSession. |
void |
setMaxBinaryMessageBufferSize(int length)
This method is not supported on
RemoteSession. |
void |
setMaxIdleTimeout(long milliseconds)
This method is not supported on
RemoteSession. |
void |
setMaxTextMessageBufferSize(int length)
This method is not supported on
RemoteSession. |
String |
toString() |
public RemoteSession(String sessionId, ClusterContext clusterContext, Map<RemoteSession.DistributedMapKey,Object> distributedPropertyMap, TyrusEndpointWrapper endpointWrapper, javax.websocket.Session session)
sessionId - session id.clusterContext - cluster context.endpointWrapper - used just to get encoders/decoders.session - used just to get encoders/decoders.public String getProtocolVersion()
getProtocolVersion in interface javax.websocket.Sessionpublic String getNegotiatedSubprotocol()
getNegotiatedSubprotocol in interface javax.websocket.Sessionpublic List<javax.websocket.Extension> getNegotiatedExtensions()
getNegotiatedExtensions in interface javax.websocket.Sessionpublic boolean isSecure()
isSecure in interface javax.websocket.Sessiontrue when the underlying socket is using a secure transport, false otherwise.public boolean isOpen()
isOpen in interface javax.websocket.Sessiontrue when the underlying socket is open, false otherwise.public long getMaxIdleTimeout()
getMaxIdleTimeout in interface javax.websocket.Sessionpublic int getMaxBinaryMessageBufferSize()
CloseReason.CloseCodes#TOO_BIG.getMaxBinaryMessageBufferSize in interface javax.websocket.Sessionpublic int getMaxTextMessageBufferSize()
CloseReason.CloseCodes#TOO_BIG.getMaxTextMessageBufferSize in interface javax.websocket.Sessionpublic javax.websocket.RemoteEndpoint.Async getAsyncRemote()
RemoteEndpoint.Async object representing the peer of this conversation
that is able to send messages asynchronously to the peer.getAsyncRemote in interface javax.websocket.Sessionpublic javax.websocket.RemoteEndpoint.Basic getBasicRemote()
RemoteEndpoint.Basic object representing the peer of this conversation
that is able to send messages synchronously to the peer.getBasicRemote in interface javax.websocket.Sessionpublic String getId()
getId in interface javax.websocket.Sessionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface javax.websocket.SessionIOException - if there was a connection error closing the connection.public void close(javax.websocket.CloseReason closeReason)
throws IOException
CloseReason.CloseCodes#NO_STATUS_CODE.close in interface javax.websocket.SessioncloseReason - the reason for the closure.IOException - if there was a connection error closing the connection.public URI getRequestURI()
URI under which this session was opened, including
the query string if there is one.getRequestURI in interface javax.websocket.Sessionpublic Map<String,List<String>> getRequestParameterMap()
getRequestParameterMap in interface javax.websocket.Sessionpublic String getQueryString()
getQueryString in interface javax.websocket.Sessionpublic Map<String,String> getPathParameters()
getPathParameters in interface javax.websocket.Sessionpublic Map<String,Object> getUserProperties()
RemoteSession. Each invocation will throw an UnsupportedOperationException.getUserProperties in interface javax.websocket.SessiongetDistributedProperties()public Map<String,Object> getDistributedProperties()
DistributedSessionSerializable or serializable by other, implementation-dependent
alternative.
Content of this map is synchronized among all cluster nodes, so putting an entry on any of the nodes will be
visible on all other nodes which have reference to current session (in form of TyrusSession or RemoteSession).
Please note that when not running in the distributed environment, this map behaves similarly to Session.getUserProperties(), so no serialization or deserialization is performed when values are read from or stored to
the returned map.getDistributedProperties in interface DistributedSessionTyrusSession,
RemoteSessionpublic Principal getUserPrincipal()
null if no user is authenticated for this session.getUserPrincipal in interface javax.websocket.Sessionpublic javax.websocket.WebSocketContainer getContainer()
RemoteSession. Each invocation will throw an UnsupportedOperationException.getContainer in interface javax.websocket.Sessionpublic void addMessageHandler(javax.websocket.MessageHandler handler)
throws IllegalStateException
RemoteSession. Each invocation will throw an UnsupportedOperationException.addMessageHandler in interface javax.websocket.Sessionhandler - nothing.IllegalStateExceptionpublic <T> void addMessageHandler(Class<T> clazz, javax.websocket.MessageHandler.Whole<T> handler)
RemoteSession. Each invocation will throw an UnsupportedOperationException.addMessageHandler in interface javax.websocket.Sessionclazz - nothing.handler - nothing.public <T> void addMessageHandler(Class<T> clazz, javax.websocket.MessageHandler.Partial<T> handler)
RemoteSession. Each invocation will throw an UnsupportedOperationException.addMessageHandler in interface javax.websocket.Sessionclazz - nothing.handler - nothing.public Set<javax.websocket.MessageHandler> getMessageHandlers()
RemoteSession. Each invocation will throw an UnsupportedOperationException.getMessageHandlers in interface javax.websocket.Sessionpublic void removeMessageHandler(javax.websocket.MessageHandler handler)
RemoteSession. Each invocation will throw an UnsupportedOperationException.removeMessageHandler in interface javax.websocket.Sessionhandler - nothing.public void setMaxIdleTimeout(long milliseconds)
RemoteSession. Each invocation will throw an UnsupportedOperationException.setMaxIdleTimeout in interface javax.websocket.Sessionmilliseconds - nothing.public void setMaxBinaryMessageBufferSize(int length)
RemoteSession. Each invocation will throw an UnsupportedOperationException.setMaxBinaryMessageBufferSize in interface javax.websocket.Sessionlength - nothing.public void setMaxTextMessageBufferSize(int length)
RemoteSession. Each invocation will throw an UnsupportedOperationException.setMaxTextMessageBufferSize in interface javax.websocket.Sessionlength - nothing.public Set<javax.websocket.Session> getOpenSessions()
RemoteSession. Each invocation will throw an UnsupportedOperationException.getOpenSessions in interface javax.websocket.SessionCopyright © 2012–2019 Oracle Corporation. All rights reserved.