public class RemoteSession extends java.lang.Object implements Session, DistributedSession
Modifier and Type | Class and Description |
---|---|
static class |
RemoteSession.DistributedMapKey |
Constructor and Description |
---|
RemoteSession(java.lang.String sessionId,
ClusterContext clusterContext,
java.util.Map<RemoteSession.DistributedMapKey,java.lang.Object> distributedPropertyMap,
TyrusEndpointWrapper endpointWrapper,
Session session)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<T> void |
addMessageHandler(java.lang.Class<T> clazz,
MessageHandler.Partial<T> handler)
This method is not supported on
RemoteSession . |
<T> void |
addMessageHandler(java.lang.Class<T> clazz,
MessageHandler.Whole<T> handler)
This method is not supported on
RemoteSession . |
void |
addMessageHandler(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(CloseReason closeReason)
Close the current conversation, giving a reason for the closure.
|
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. |
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. |
WebSocketContainer |
getContainer()
This method is not supported on
RemoteSession . |
java.util.Map<java.lang.String,java.lang.Object> |
getDistributedProperties()
Get distributed properties.
|
java.lang.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.
|
java.util.Set<MessageHandler> |
getMessageHandlers()
This method is not supported on
RemoteSession . |
java.util.List<Extension> |
getNegotiatedExtensions()
Get the list of extensions currently in use for this conversation.
|
java.lang.String |
getNegotiatedSubprotocol()
Get the sub protocol agreed during the websocket handshake for this conversation.
|
java.util.Set<Session> |
getOpenSessions()
This method is not supported on
RemoteSession . |
java.util.Map<java.lang.String,java.lang.String> |
getPathParameters()
Get a map of the path parameter names and values used associated with the
request this session was opened under.
|
java.lang.String |
getProtocolVersion()
Get the version of the websocket protocol currently being used.
|
java.lang.String |
getQueryString()
Get the query string associated with the request this session
was opened under.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getRequestParameterMap()
Get the request parameters associated with the request this session
was opened under.
|
java.net.URI |
getRequestURI()
Get the
URI under which this session was opened, including
the query string if there is one. |
java.security.Principal |
getUserPrincipal()
Get the authenticated user for this session or
null if no user is authenticated for this session. |
java.util.Map<java.lang.String,java.lang.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(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 . |
java.lang.String |
toString() |
public RemoteSession(java.lang.String sessionId, ClusterContext clusterContext, java.util.Map<RemoteSession.DistributedMapKey,java.lang.Object> distributedPropertyMap, TyrusEndpointWrapper endpointWrapper, Session session)
sessionId
- session id.clusterContext
- cluster context.distributedPropertyMap
- distributed property map.endpointWrapper
- used just to get encoders/decoders.session
- used just to get encoders/decoders.public java.lang.String getProtocolVersion()
getProtocolVersion
in interface Session
public java.lang.String getNegotiatedSubprotocol()
getNegotiatedSubprotocol
in interface Session
public java.util.List<Extension> getNegotiatedExtensions()
getNegotiatedExtensions
in interface Session
public boolean isSecure()
public boolean isOpen()
public long getMaxIdleTimeout()
getMaxIdleTimeout
in interface Session
public int getMaxBinaryMessageBufferSize()
CloseReason.CloseCodes#TOO_BIG
.getMaxBinaryMessageBufferSize
in interface Session
public int getMaxTextMessageBufferSize()
CloseReason.CloseCodes#TOO_BIG
.getMaxTextMessageBufferSize
in interface Session
public 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 Session
public 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 Session
public java.lang.String getId()
public void close() throws java.io.IOException
public void close(CloseReason closeReason) throws java.io.IOException
CloseReason.CloseCodes#NO_STATUS_CODE
.public java.net.URI getRequestURI()
URI
under which this session was opened, including
the query string if there is one.getRequestURI
in interface Session
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestParameterMap()
getRequestParameterMap
in interface Session
public java.lang.String getQueryString()
getQueryString
in interface Session
public java.util.Map<java.lang.String,java.lang.String> getPathParameters()
getPathParameters
in interface Session
public java.util.Map<java.lang.String,java.lang.Object> getUserProperties()
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.getUserProperties
in interface Session
getDistributedProperties()
public java.util.Map<java.lang.String,java.lang.Object> getDistributedProperties()
DistributedSession
Values put into this map must be Serializable
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 DistributedSession
TyrusSession
,
RemoteSession
public java.security.Principal getUserPrincipal()
null
if no user is authenticated for this session.getUserPrincipal
in interface Session
public java.lang.String toString()
toString
in class java.lang.Object
public WebSocketContainer getContainer()
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.getContainer
in interface Session
public void addMessageHandler(MessageHandler handler) throws java.lang.IllegalStateException
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.addMessageHandler
in interface Session
handler
- nothing.java.lang.IllegalStateException
- if there is already a MessageHandler registered for the same native websocket
message type as this handler.public <T> void addMessageHandler(java.lang.Class<T> clazz, MessageHandler.Whole<T> handler)
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.addMessageHandler
in interface Session
T
- type of message that the given handler is intended for.clazz
- nothing.handler
- nothing.public <T> void addMessageHandler(java.lang.Class<T> clazz, MessageHandler.Partial<T> handler)
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.addMessageHandler
in interface Session
T
- type of message that the given handler is intended for.clazz
- nothing.handler
- nothing.public java.util.Set<MessageHandler> getMessageHandlers()
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.getMessageHandlers
in interface Session
public void removeMessageHandler(MessageHandler handler)
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.removeMessageHandler
in interface Session
handler
- nothing.public void setMaxIdleTimeout(long milliseconds)
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.setMaxIdleTimeout
in interface Session
milliseconds
- nothing.public void setMaxBinaryMessageBufferSize(int length)
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.setMaxBinaryMessageBufferSize
in interface Session
length
- nothing.public void setMaxTextMessageBufferSize(int length)
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.setMaxTextMessageBufferSize
in interface Session
length
- nothing.public java.util.Set<Session> getOpenSessions()
RemoteSession
. Each invocation will throw an UnsupportedOperationException
.getOpenSessions
in interface Session
Copyright © 2012–2020 Oracle Corporation. All rights reserved.