| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <title>Session</title> |
| <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="Session"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":6,"i21":6,"i22":6,"i23":6,"i24":6,"i25":6,"i26":6,"i27":6,"i28":6}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../index-all.html">Index</a></li> |
| <li><a href="../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../javax/websocket/SendResult.html" title="class in javax.websocket"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../javax/websocket/SessionException.html" title="class in javax.websocket"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?javax/websocket/Session.html" target="_top">Frames</a></li> |
| <li><a href="Session.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">javax.websocket</div> |
| <h2 title="Interface Session" class="title">Interface Session</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Superinterfaces:</dt> |
| <dd>java.lang.AutoCloseable, java.io.Closeable</dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public interface <span class="typeNameLabel">Session</span> |
| extends java.io.Closeable</pre> |
| <div class="block">A Web Socket session represents a conversation between two web socket endpoints. As soon as the websocket handshake |
| completes successfully, the web socket implementation provides the endpoint an open websocket session. The endpoint |
| can then register interest in incoming messages that are part of this newly created session by providing a |
| MessageHandler to the session, and can send messages to the other end of the conversation by means of the |
| RemoteEndpoint object obtained from this session. |
| <p> |
| Once the session is closed, it is no longer valid for use by applications. Calling any of its methods (with the |
| exception of the close() methods) once the session has been closed will result in an |
| <code>IllegalStateException</code> being thrown. Developers should retrieve any information from the session |
| during the <a href="../../javax/websocket/Endpoint.html#onClose-javax.websocket.Session-javax.websocket.CloseReason-"><code>Endpoint.onClose(javax.websocket.Session, javax.websocket.CloseReason)</code></a> method. Following the convention of <code>Closeable</code> calling the Session |
| close() methods after the Session has been closed has no effect. |
| <p> |
| Session objects may be called by multiple threads. Implementations must ensure the integrity of the mutable |
| properties of the session under such circumstances.</div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code><T> void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#addMessageHandler-java.lang.Class-javax.websocket.MessageHandler.Partial-">addMessageHandler</a></span>(java.lang.Class<T> clazz, |
| <a href="../../javax/websocket/MessageHandler.Partial.html" title="interface in javax.websocket">MessageHandler.Partial</a><T> handler)</code> |
| <div class="block">Register to handle to incoming messages in this conversation.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code><T> void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#addMessageHandler-java.lang.Class-javax.websocket.MessageHandler.Whole-">addMessageHandler</a></span>(java.lang.Class<T> clazz, |
| <a href="../../javax/websocket/MessageHandler.Whole.html" title="interface in javax.websocket">MessageHandler.Whole</a><T> handler)</code> |
| <div class="block">Register to handle to incoming messages in this conversation.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#addMessageHandler-javax.websocket.MessageHandler-">addMessageHandler</a></span>(<a href="../../javax/websocket/MessageHandler.html" title="interface in javax.websocket">MessageHandler</a> handler)</code> |
| <div class="block">Register to handle to incoming messages in this conversation.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#close--">close</a></span>()</code> |
| <div class="block">Close the current conversation with a normal status code and no reason phrase.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#close-javax.websocket.CloseReason-">close</a></span>(<a href="../../javax/websocket/CloseReason.html" title="class in javax.websocket">CloseReason</a> closeReason)</code> |
| <div class="block">Close the current conversation, giving a reason for the closure.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/websocket/RemoteEndpoint.Async.html" title="interface in javax.websocket">RemoteEndpoint.Async</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getAsyncRemote--">getAsyncRemote</a></span>()</code> |
| <div class="block">Return a reference a RemoteEndpoint object representing the peer of this conversation that is able to send |
| messages asynchronously to the peer.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/websocket/RemoteEndpoint.Basic.html" title="interface in javax.websocket">RemoteEndpoint.Basic</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getBasicRemote--">getBasicRemote</a></span>()</code> |
| <div class="block">Return a reference a RemoteEndpoint object representing the peer of this conversation that is able to send |
| messages synchronously to the peer.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/websocket/WebSocketContainer.html" title="interface in javax.websocket">WebSocketContainer</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getContainer--">getContainer</a></span>()</code> |
| <div class="block">Return the container that this session is part of.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getId--">getId</a></span>()</code> |
| <div class="block">Returns a string containing the unique identifier assigned to this session.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getMaxBinaryMessageBufferSize--">getMaxBinaryMessageBufferSize</a></span>()</code> |
| <div class="block">The maximum length of incoming binary messages that this Session can buffer.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>long</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getMaxIdleTimeout--">getMaxIdleTimeout</a></span>()</code> |
| <div class="block">Return the number of milliseconds before this conversation may be closed by the container if it is inactive, i.e.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getMaxTextMessageBufferSize--">getMaxTextMessageBufferSize</a></span>()</code> |
| <div class="block">The maximum length of incoming text messages that this Session can buffer.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>java.util.Set<<a href="../../javax/websocket/MessageHandler.html" title="interface in javax.websocket">MessageHandler</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getMessageHandlers--">getMessageHandlers</a></span>()</code> |
| <div class="block">Return an unmodifiable copy of the set of MessageHandlers for this Session.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>java.util.List<<a href="../../javax/websocket/Extension.html" title="interface in javax.websocket">Extension</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getNegotiatedExtensions--">getNegotiatedExtensions</a></span>()</code> |
| <div class="block">Return the list of extensions currently in use for this conversation.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getNegotiatedSubprotocol--">getNegotiatedSubprotocol</a></span>()</code> |
| <div class="block">Return the sub protocol agreed during the websocket handshake for this conversation.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>java.util.Set<<a href="../../javax/websocket/Session.html" title="interface in javax.websocket">Session</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getOpenSessions--">getOpenSessions</a></span>()</code> |
| <div class="block">Return a copy of the Set of all the open web socket sessions that represent connections to the same endpoint to |
| which this session represents a connection.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>java.util.Map<java.lang.String,java.lang.String></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getPathParameters--">getPathParameters</a></span>()</code> |
| <div class="block">Return a map of the path parameter names and values used associated with the request this session was opened |
| under.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getProtocolVersion--">getProtocolVersion</a></span>()</code> |
| <div class="block">Returns the version of the websocket protocol currently being used.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getQueryString--">getQueryString</a></span>()</code> |
| <div class="block">Return the query string associated with the request this session was opened under.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>java.util.Map<java.lang.String,java.util.List<java.lang.String>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getRequestParameterMap--">getRequestParameterMap</a></span>()</code> |
| <div class="block">Return the request parameters associated with the request this session was opened under.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code>java.net.URI</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getRequestURI--">getRequestURI</a></span>()</code> |
| <div class="block">Return the URI under which this session was opened, including the query string if there is one.</div> |
| </td> |
| </tr> |
| <tr id="i21" class="rowColor"> |
| <td class="colFirst"><code>java.security.Principal</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getUserPrincipal--">getUserPrincipal</a></span>()</code> |
| <div class="block">Return the authenticated user for this Session or <code>null</code> if no user is authenticated for this session.</div> |
| </td> |
| </tr> |
| <tr id="i22" class="altColor"> |
| <td class="colFirst"><code>java.util.Map<java.lang.String,java.lang.Object></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#getUserProperties--">getUserProperties</a></span>()</code> |
| <div class="block">While the session is open, this method returns a Map that the developer may use to store application specific |
| information relating to this session instance.</div> |
| </td> |
| </tr> |
| <tr id="i23" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#isOpen--">isOpen</a></span>()</code> |
| <div class="block">Return true if and only if the underlying socket is open.</div> |
| </td> |
| </tr> |
| <tr id="i24" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#isSecure--">isSecure</a></span>()</code> |
| <div class="block">Return true if and only if the underlying socket is using a secure transport.</div> |
| </td> |
| </tr> |
| <tr id="i25" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#removeMessageHandler-javax.websocket.MessageHandler-">removeMessageHandler</a></span>(<a href="../../javax/websocket/MessageHandler.html" title="interface in javax.websocket">MessageHandler</a> handler)</code> |
| <div class="block">Remove the given MessageHandler from the set belonging to this session.</div> |
| </td> |
| </tr> |
| <tr id="i26" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#setMaxBinaryMessageBufferSize-int-">setMaxBinaryMessageBufferSize</a></span>(int length)</code> |
| <div class="block">Sets the maximum length of incoming binary messages that this Session can buffer.</div> |
| </td> |
| </tr> |
| <tr id="i27" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#setMaxIdleTimeout-long-">setMaxIdleTimeout</a></span>(long milliseconds)</code> |
| <div class="block">Set the non-zero number of milliseconds before this session will be closed by the container if it is inactive, ie |
| no messages are either sent or received.</div> |
| </td> |
| </tr> |
| <tr id="i28" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/websocket/Session.html#setMaxTextMessageBufferSize-int-">setMaxTextMessageBufferSize</a></span>(int length)</code> |
| <div class="block">Sets the maximum length of incoming text messages that this Session can buffer.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="getContainer--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getContainer</h4> |
| <pre><a href="../../javax/websocket/WebSocketContainer.html" title="interface in javax.websocket">WebSocketContainer</a> getContainer()</pre> |
| <div class="block">Return the container that this session is part of.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the container.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addMessageHandler-javax.websocket.MessageHandler-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addMessageHandler</h4> |
| <pre>void addMessageHandler(<a href="../../javax/websocket/MessageHandler.html" title="interface in javax.websocket">MessageHandler</a> handler) |
| throws java.lang.IllegalStateException</pre> |
| <div class="block">Register to handle to incoming messages in this conversation. A maximum of one message handler per native |
| websocket message type (text, binary, pong) may be added to each Session. I.e. a maximum of one message handler |
| to handle incoming text messages a maximum of one message handler for handling incoming binary messages, and a |
| maximum of one for handling incoming pong messages. For further details of which message handlers handle which of |
| the native websocket message types please see <a href="../../javax/websocket/MessageHandler.Whole.html" title="interface in javax.websocket"><code>MessageHandler.Whole</code></a> and <a href="../../javax/websocket/MessageHandler.Partial.html" title="interface in javax.websocket"><code>MessageHandler.Partial</code></a>. |
| Adding more than one of any one type will result in a runtime exception. |
| <p> |
| This method is not safe to use unless you are providing an anonymous class derived directly from |
| <a href="../../javax/websocket/MessageHandler.Whole.html" title="interface in javax.websocket"><code>MessageHandler.Whole</code></a> or <a href="../../javax/websocket/MessageHandler.Partial.html" title="interface in javax.websocket"><code>MessageHandler.Partial</code></a>. In all other |
| cases (Lambda Expressions, more complex inheritance or generic type arrangements), one of the following methods |
| have to be used: <a href="../../javax/websocket/Session.html#addMessageHandler-java.lang.Class-javax.websocket.MessageHandler.Whole-"><code>addMessageHandler(Class, javax.websocket.MessageHandler.Whole)</code></a> or |
| <a href="../../javax/websocket/Session.html#addMessageHandler-java.lang.Class-javax.websocket.MessageHandler.Partial-"><code>addMessageHandler(Class, javax.websocket.MessageHandler.Partial)</code></a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>handler</code> - the MessageHandler to be added.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if there is already a MessageHandler registered for the same native websocket |
| message type as this handler.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addMessageHandler-java.lang.Class-javax.websocket.MessageHandler.Whole-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addMessageHandler</h4> |
| <pre><T> void addMessageHandler(java.lang.Class<T> clazz, |
| <a href="../../javax/websocket/MessageHandler.Whole.html" title="interface in javax.websocket">MessageHandler.Whole</a><T> handler)</pre> |
| <div class="block">Register to handle to incoming messages in this conversation. A maximum of one message handler per native |
| websocket message type (text, binary, pong) may be added to each Session. I.e. a maximum of one message handler |
| to handle incoming text messages a maximum of one message handler for handling incoming binary messages, and a |
| maximum of one for handling incoming pong messages. For further details of which message handlers handle which of |
| the native websocket message types please see <a href="../../javax/websocket/MessageHandler.Whole.html" title="interface in javax.websocket"><code>MessageHandler.Whole</code></a> and <a href="../../javax/websocket/MessageHandler.Partial.html" title="interface in javax.websocket"><code>MessageHandler.Partial</code></a>. |
| Adding more than one of any one type will result in a runtime exception.</div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - type of message that the given handler is intended for.</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>clazz</code> - type of the message processed by message handler to be registered.</dd> |
| <dd><code>handler</code> - whole message handler to be added.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if there is already a MessageHandler registered for the same native websocket |
| message type as this handler.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>WebSocket 1.1</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addMessageHandler-java.lang.Class-javax.websocket.MessageHandler.Partial-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addMessageHandler</h4> |
| <pre><T> void addMessageHandler(java.lang.Class<T> clazz, |
| <a href="../../javax/websocket/MessageHandler.Partial.html" title="interface in javax.websocket">MessageHandler.Partial</a><T> handler)</pre> |
| <div class="block">Register to handle to incoming messages in this conversation. A maximum of one message handler per native |
| websocket message type (text, binary, pong) may be added to each Session. I.e. a maximum of one message handler |
| to handle incoming text messages a maximum of one message handler for handling incoming binary messages, and a |
| maximum of one for handling incoming pong messages. For further details of which message handlers handle which of |
| the native websocket message types please see <a href="../../javax/websocket/MessageHandler.Whole.html" title="interface in javax.websocket"><code>MessageHandler.Whole</code></a> and <a href="../../javax/websocket/MessageHandler.Partial.html" title="interface in javax.websocket"><code>MessageHandler.Partial</code></a>. |
| Adding more than one of any one type will result in a runtime exception.</div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - type of message that the given handler is intended for.</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>clazz</code> - type of the message processed by message handler to be registered.</dd> |
| <dd><code>handler</code> - partial message handler to be added.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if there is already a MessageHandler registered for the same native websocket |
| message type as this handler.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>WebSocket 1.1</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMessageHandlers--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMessageHandlers</h4> |
| <pre>java.util.Set<<a href="../../javax/websocket/MessageHandler.html" title="interface in javax.websocket">MessageHandler</a>> getMessageHandlers()</pre> |
| <div class="block">Return an unmodifiable copy of the set of MessageHandlers for this Session.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the set of message handlers.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="removeMessageHandler-javax.websocket.MessageHandler-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>removeMessageHandler</h4> |
| <pre>void removeMessageHandler(<a href="../../javax/websocket/MessageHandler.html" title="interface in javax.websocket">MessageHandler</a> handler)</pre> |
| <div class="block">Remove the given MessageHandler from the set belonging to this session. This method may block if the given |
| handler is processing a message until it is no longer in use.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>handler</code> - the handler to be removed.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getProtocolVersion--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getProtocolVersion</h4> |
| <pre>java.lang.String getProtocolVersion()</pre> |
| <div class="block">Returns the version of the websocket protocol currently being used. This is taken as the value of the |
| Sec-WebSocket-Version header used in the opening handshake. i.e. "13".</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the protocol version.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getNegotiatedSubprotocol--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getNegotiatedSubprotocol</h4> |
| <pre>java.lang.String getNegotiatedSubprotocol()</pre> |
| <div class="block">Return the sub protocol agreed during the websocket handshake for this conversation.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the negotiated subprotocol, or the empty string if there isn't one.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getNegotiatedExtensions--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getNegotiatedExtensions</h4> |
| <pre>java.util.List<<a href="../../javax/websocket/Extension.html" title="interface in javax.websocket">Extension</a>> getNegotiatedExtensions()</pre> |
| <div class="block">Return the list of extensions currently in use for this conversation.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the negotiated extensions.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isSecure--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isSecure</h4> |
| <pre>boolean isSecure()</pre> |
| <div class="block">Return true if and only if the underlying socket is using a secure transport.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>whether its using a secure transport.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isOpen--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isOpen</h4> |
| <pre>boolean isOpen()</pre> |
| <div class="block">Return true if and only if the underlying socket is open.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>whether the session is active.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMaxIdleTimeout--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMaxIdleTimeout</h4> |
| <pre>long getMaxIdleTimeout()</pre> |
| <div class="block">Return the number of milliseconds before this conversation may be closed by the container if it is inactive, i.e. |
| no messages are either sent or received in that time.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the timeout in milliseconds.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setMaxIdleTimeout-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setMaxIdleTimeout</h4> |
| <pre>void setMaxIdleTimeout(long milliseconds)</pre> |
| <div class="block">Set the non-zero number of milliseconds before this session will be closed by the container if it is inactive, ie |
| no messages are either sent or received. A value that is 0 or negative indicates the session will never timeout |
| due to inactivity.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>milliseconds</code> - the number of milliseconds.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setMaxBinaryMessageBufferSize-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setMaxBinaryMessageBufferSize</h4> |
| <pre>void setMaxBinaryMessageBufferSize(int length)</pre> |
| <div class="block">Sets the maximum length of incoming binary messages that this Session can buffer.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>length</code> - the maximum length.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMaxBinaryMessageBufferSize--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMaxBinaryMessageBufferSize</h4> |
| <pre>int getMaxBinaryMessageBufferSize()</pre> |
| <div class="block">The maximum length of incoming binary messages that this Session can buffer. If the implementation receives a |
| binary message that it cannot buffer because it is too large, it must close the session with a close code of |
| <a href="../../javax/websocket/CloseReason.CloseCodes.html#TOO_BIG"><code>CloseReason.CloseCodes.TOO_BIG</code></a>.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the maximum binary message size that can be buffered.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setMaxTextMessageBufferSize-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setMaxTextMessageBufferSize</h4> |
| <pre>void setMaxTextMessageBufferSize(int length)</pre> |
| <div class="block">Sets the maximum length of incoming text messages that this Session can buffer.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>length</code> - the maximum length.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMaxTextMessageBufferSize--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMaxTextMessageBufferSize</h4> |
| <pre>int getMaxTextMessageBufferSize()</pre> |
| <div class="block">The maximum length of incoming text messages that this Session can buffer. If the implementation receives a text |
| message that it cannot buffer because it is too large, it must close the session with a close code of |
| <a href="../../javax/websocket/CloseReason.CloseCodes.html#TOO_BIG"><code>CloseReason.CloseCodes.TOO_BIG</code></a>.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the maximum text message size that can be buffered.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getAsyncRemote--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getAsyncRemote</h4> |
| <pre><a href="../../javax/websocket/RemoteEndpoint.Async.html" title="interface in javax.websocket">RemoteEndpoint.Async</a> getAsyncRemote()</pre> |
| <div class="block">Return a reference a RemoteEndpoint object representing the peer of this conversation that is able to send |
| messages asynchronously to the peer.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the remote endpoint.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getBasicRemote--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getBasicRemote</h4> |
| <pre><a href="../../javax/websocket/RemoteEndpoint.Basic.html" title="interface in javax.websocket">RemoteEndpoint.Basic</a> getBasicRemote()</pre> |
| <div class="block">Return a reference a RemoteEndpoint object representing the peer of this conversation that is able to send |
| messages synchronously to the peer.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the remote endpoint.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getId--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getId</h4> |
| <pre>java.lang.String getId()</pre> |
| <div class="block">Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the web |
| socket implementation and is implementation dependent.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the unique identifier for this session instance.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="close--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>close</h4> |
| <pre>void close() |
| throws java.io.IOException</pre> |
| <div class="block">Close the current conversation with a normal status code and no reason phrase.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>close</code> in interface <code>java.lang.AutoCloseable</code></dd> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>close</code> in interface <code>java.io.Closeable</code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.io.IOException</code> - if there was a connection error closing the connection.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="close-javax.websocket.CloseReason-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>close</h4> |
| <pre>void close(<a href="../../javax/websocket/CloseReason.html" title="class in javax.websocket">CloseReason</a> closeReason) |
| throws java.io.IOException</pre> |
| <div class="block">Close the current conversation, giving a reason for the closure. The close call causes the implementation to |
| attempt notify the client of the close as soon as it can. This may cause the sending of unsent messages |
| immediately prior to the close notification. After the close notification has been sent the implementation |
| notifies the endpoint's onClose method. Note the websocket specification defines the acceptable uses of status |
| codes and reason phrases. If the application cannot determine a suitable close code to use for the closeReason, |
| it is recommended to use <a href="../../javax/websocket/CloseReason.CloseCodes.html#NO_STATUS_CODE"><code>CloseReason.CloseCodes.NO_STATUS_CODE</code></a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>closeReason</code> - the reason for the closure.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.io.IOException</code> - if there was a connection error closing the connection</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRequestURI--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRequestURI</h4> |
| <pre>java.net.URI getRequestURI()</pre> |
| <div class="block">Return the URI under which this session was opened, including the query string if there is one.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the request URI.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRequestParameterMap--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRequestParameterMap</h4> |
| <pre>java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestParameterMap()</pre> |
| <div class="block">Return the request parameters associated with the request this session was opened under.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the unmodifiable map of the request parameters.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getQueryString--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getQueryString</h4> |
| <pre>java.lang.String getQueryString()</pre> |
| <div class="block">Return the query string associated with the request this session was opened under.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the query string</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getPathParameters--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getPathParameters</h4> |
| <pre>java.util.Map<java.lang.String,java.lang.String> getPathParameters()</pre> |
| <div class="block">Return a map of the path parameter names and values used associated with the request this session was opened |
| under.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the unmodifiable map of path parameters. The key of the map is the parameter name, the values in the map |
| are the parameter values.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getUserProperties--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getUserProperties</h4> |
| <pre>java.util.Map<java.lang.String,java.lang.Object> getUserProperties()</pre> |
| <div class="block">While the session is open, this method returns a Map that the developer may use to store application specific |
| information relating to this session instance. The developer may retrieve information from this Map at any time |
| between the opening of the session and during the onClose() method. But outside that time, any information stored |
| using this Map may no longer be kept by the container. Web socket applications running on distributed |
| implementations of the web container should make any application specific objects stored here |
| java.io.Serializable, or the object may not be recreated after a failover.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an editable Map of application data.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getUserPrincipal--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getUserPrincipal</h4> |
| <pre>java.security.Principal getUserPrincipal()</pre> |
| <div class="block">Return the authenticated user for this Session or <code>null</code> if no user is authenticated for this session.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the user principal.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getOpenSessions--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>getOpenSessions</h4> |
| <pre>java.util.Set<<a href="../../javax/websocket/Session.html" title="interface in javax.websocket">Session</a>> getOpenSessions()</pre> |
| <div class="block">Return a copy of the Set of all the open web socket sessions that represent connections to the same endpoint to |
| which this session represents a connection. The Set includes the session this method is called on. These sessions |
| may not still be open at any point after the return of this method. For example, iterating over the set at a |
| later time may yield one or more closed sessions. Developers should use session.isOpen() to check.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the set of sessions, open at the time of return.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../index-all.html">Index</a></li> |
| <li><a href="../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../javax/websocket/SendResult.html" title="class in javax.websocket"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../javax/websocket/SessionException.html" title="class in javax.websocket"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?javax/websocket/Session.html" target="_top">Frames</a></li> |
| <li><a href="Session.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |