Package org.simpleframework.http.socket
Interface Session
- All Known Implementing Classes:
ServiceSession
public interface Session
The
Session
object represents a simple WebSocket session
that contains the connection handshake details and the actual socket.
In order to determine how the session should be interacted with the
protocol is conveniently exposed, however all attributes of the
original HTTP request are available.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(Object key) This is used as a shortcut for acquiring attributes for the response.This can be used to retrieve the response attributes.Provides aFrameChannel
that can be used to communicate with the connected client.Provides theRequest
used to initiate the session.Provides theResponse
used to establish the session with the remote client.
-
Method Details
-
getAttributes
Map getAttributes()This can be used to retrieve the response attributes. These can be used to keep state with the response when it is passed to other systems for processing. Attributes act as a convenient model for storing objects associated with the response. This also inherits attributes associated with the client connection.- Returns:
- the attributes of that have been set on the request
-
getAttribute
This is used as a shortcut for acquiring attributes for the response. This avoids acquiring the attributeMap
in order to retrieve the attribute directly from that object. The attributes contain data specific to the response.- Parameters:
key
- this is the key of the attribute to acquire- Returns:
- this returns the attribute for the specified name
-
getChannel
FrameChannel getChannel()Provides aFrameChannel
that can be used to communicate with the connected client. Communication is full duplex and also asynchronous through the use of aFrameListener
that can be registered with the channel.- Returns:
- a web socket for full duplex communication
-
getRequest
Request getRequest()Provides theRequest
used to initiate the session. This is useful in establishing the identity of the user, acquiring an security information and also for determining the request path that was used, which be used to establish context.- Returns:
- the request used to initiate the session
-
getResponse
Response getResponse()Provides theResponse
used to establish the session with the remote client. This is useful in establishing the protocol used to create the session and also for determining various other useful contextual information.- Returns:
- the response used to establish the session
-