Class WebSocketContext
java.lang.Object
com.levigo.jadice.web.transport.server.networking.websocket.WebSocketContext
- All Implemented Interfaces:
MessageContext
This extends the
MessageContext
by carrying the WebSocket-Session
and the
HttpSession
of the client.-
Constructor Summary
ConstructorDescriptionWebSocketContext
(String clientID, jakarta.websocket.Session session) Constructs a message context, that interfaces aClient
, identified by its id, with the corresponding WebSocket-Session
and itsHttpSession
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the client id of the client which did send the message associated with this message context.jakarta.servlet.http.HttpSession
Returns theHttpSession
of the message associated with this message context.Returns the query string contained in the message for this context.Returns the URI requested by the message for this context from the protocol up to the query string.jakarta.websocket.Session
Gets the WebSocket-Session
associated with the message.Returns thePrincipal
identifying the user sending the message.
-
Constructor Details
-
WebSocketContext
Constructs a message context, that interfaces aClient
, identified by its id, with the corresponding WebSocket-Session
and itsHttpSession
.- Parameters:
clientID
- the id of the clientsession
- the WebSocket-Session
of the client
-
-
Method Details
-
getSession
public jakarta.websocket.Session getSession()Gets the WebSocket-Session
associated with the message.- Returns:
- WebSocket-
Session
associated with the message
-
getQueryString
Description copied from interface:MessageContext
Returns the query string contained in the message for this context.Example:
- https://somepage.com/somesite?key=value
- QueryString: key=value
- Specified by:
getQueryString
in interfaceMessageContext
- Returns:
- the query string
-
getRequestURI
Description copied from interface:MessageContext
Returns the URI requested by the message for this context from the protocol up to the query string.Example:
- https://somepage.com/somesite?key=value
- RequestURI: somepage.com/somesite
- Specified by:
getRequestURI
in interfaceMessageContext
- Returns:
- the requested URI
-
getUserPrincipal
Description copied from interface:MessageContext
Returns thePrincipal
identifying the user sending the message.- Specified by:
getUserPrincipal
in interfaceMessageContext
- Returns:
- the user
Principal
-
getClientID
Description copied from interface:MessageContext
Returns the client id of the client which did send the message associated with this message context.- Specified by:
getClientID
in interfaceMessageContext
- Returns:
- the client id
-
getHTTPSession
public jakarta.servlet.http.HttpSession getHTTPSession()Description copied from interface:MessageContext
Returns theHttpSession
of the message associated with this message context.- Specified by:
getHTTPSession
in interfaceMessageContext
- Returns:
- the
HttpSession
-