Jetty 12 implementation of WebSocketSession.
More...
Public Member Functions | |
| Object | attribute (final String name) |
| Returns a session-scoped attribute by name. | |
| void | attribute (final String name, final Object value) |
| Sets or removes a session-scoped attribute. | |
| CompletionStage< Void > | close (final WebSocketCloseStatus status) |
| Closes the session with the given status code and reason. | |
| String | headerFirst (final String name) |
| Returns the first value of an HTTP header. | |
| Map< String, List< String > > | headers () |
| Returns an unmodifiable view of all HTTP headers. | |
| String | id () |
| Returns a unique session identifier derived from the native session's identity hash code. | |
| boolean | isOpen () |
| Returns whether the underlying session is still open. | |
| JettyWebSocketSession (final Session session, final String path, final Map< String, String > pathParams, final Map< String, List< String > > queryParams, final Map< String, List< String > > headers) | |
| Creates a session wrapper. | |
| String | path () |
| Returns the matched request path. | |
| String | pathParam (final String name) |
| Returns the value of a single path parameter by name. | |
| Map< String, String > | pathParams () |
| Returns an unmodifiable view of all path parameters. | |
| List< String > | queryAll (final String name) |
| Returns all values of a query parameter. | |
| String | queryFirst (final String name) |
| Returns the first value of a query parameter. | |
| Map< String, List< String > > | queryParams () |
| Returns an unmodifiable view of all query parameters. | |
| CompletionStage< Void > | sendBinary (final ByteBuffer data) |
| Sends a binary message asynchronously. | |
| CompletionStage< Void > | sendText (final String text) |
| Sends a text message asynchronously. | |
| String | subprotocol () |
| Returns the accepted subprotocol, or an empty string if none was negotiated. | |
Jetty 12 implementation of WebSocketSession.
Wraps the native Jetty Session and exposes the framework's transport-agnostic WebSocket session contract. Each instance carries the request path, path parameters, query parameters, headers and a thread-safe attribute bag.
Definition at line 53 of file JettyWebSocketSession.java.
| dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.JettyWebSocketSession | ( | final Session | session, |
| final String | path, | ||
| final Map< String, String > | pathParams, | ||
| final Map< String, List< String > > | queryParams, | ||
| final Map< String, List< String > > | headers ) |
Creates a session wrapper.
| session | the native Jetty WebSocket session |
| path | the matched request path |
| pathParams | extracted path parameters (e.g. "channel" -> "abc") |
| queryParams | query string parameters |
| headers | HTTP headers from the upgrade request |
| NullPointerException | if session or path is null |
Definition at line 72 of file JettyWebSocketSession.java.
| Object dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.attribute | ( | final String | name | ) |
Returns a session-scoped attribute by name.
| name | the attribute name |
null if not set Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 183 of file JettyWebSocketSession.java.
| void dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.attribute | ( | final String | name, |
| final Object | value ) |
Sets or removes a session-scoped attribute.
Passing null as the value removes the attribute.
| name | the attribute name |
| value | the attribute value, or null to remove |
Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 196 of file JettyWebSocketSession.java.
| CompletionStage< Void > dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.close | ( | final WebSocketCloseStatus | status | ) |
Closes the session with the given status code and reason.
| status | the close status; defaults to WebSocketCloseStatus#NORMAL if null |
Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 267 of file JettyWebSocketSession.java.
| String dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.headerFirst | ( | final String | name | ) |
Returns the first value of an HTTP header.
| name | the header name (case-sensitive) |
null if absent Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 168 of file JettyWebSocketSession.java.
| Map< String, List< String > > dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.headers | ( | ) |
Returns an unmodifiable view of all HTTP headers.
Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 230 of file JettyWebSocketSession.java.
| String dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.id | ( | ) |
Returns a unique session identifier derived from the native session's identity hash code.
Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 88 of file JettyWebSocketSession.java.
| boolean dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.isOpen | ( | ) |
Returns whether the underlying session is still open.
true if the session is open Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 120 of file JettyWebSocketSession.java.
| String dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.path | ( | ) |
Returns the matched request path.
Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 98 of file JettyWebSocketSession.java.
| String dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.pathParam | ( | final String | name | ) |
Returns the value of a single path parameter by name.
| name | the path parameter name |
null if the parameter does not exist Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 131 of file JettyWebSocketSession.java.
| Map< String, String > dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.pathParams | ( | ) |
Returns an unmodifiable view of all path parameters.
Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 210 of file JettyWebSocketSession.java.
| List< String > dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.queryAll | ( | final String | name | ) |
Returns all values of a query parameter.
| name | the query parameter name |
null) Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 157 of file JettyWebSocketSession.java.
| String dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.queryFirst | ( | final String | name | ) |
Returns the first value of a query parameter.
| name | the query parameter name |
null if absent Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 142 of file JettyWebSocketSession.java.
| Map< String, List< String > > dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.queryParams | ( | ) |
Returns an unmodifiable view of all query parameters.
Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 220 of file JettyWebSocketSession.java.
| CompletionStage< Void > dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.sendBinary | ( | final ByteBuffer | data | ) |
Sends a binary message asynchronously.
| data | the binary payload (an empty buffer is sent if null) |
Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 254 of file JettyWebSocketSession.java.
| CompletionStage< Void > dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.sendText | ( | final String | text | ) |
Sends a text message asynchronously.
| text | the text payload |
Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 241 of file JettyWebSocketSession.java.
| String dev.rafex.ether.websocket.jetty12.JettyWebSocketSession.subprotocol | ( | ) |
Returns the accepted subprotocol, or an empty string if none was negotiated.
"" Implements dev.rafex.ether.websocket.core.WebSocketSession.
Definition at line 108 of file JettyWebSocketSession.java.