@ManagedObject(value="A Jetty WebSocket Session") public class WebSocketSession extends ContainerLifeCycle implements Session, RemoteEndpointFactory, WebSocketSessionScope, IncomingFrames, Connection.Listener, IOState.ConnectionStateListener
| Modifier and Type | Class and Description |
|---|---|
class |
WebSocketSession.DisconnectCallback |
static interface |
WebSocketSession.Listener |
static class |
WebSocketSession.OnCloseLocalCallback |
AbstractLifeCycle.AbstractLifeCycleListenerConnection.Listener.AdapterContainer.InheritedListenerFAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING| Constructor and Description |
|---|
WebSocketSession(WebSocketContainerScope containerScope,
java.net.URI requestURI,
EventDriver websocket,
LogicalConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(int statusCode,
java.lang.String reason)
Aborts the active session abruptly.
|
void |
close()
Request a close of the current conversation with a normal status code and no reason phrase.
|
void |
close(CloseStatus closeStatus)
Request Close the current conversation, giving a reason for the closure.
|
void |
close(int statusCode,
java.lang.String reason)
Send a websocket Close frame, with status code.
|
void |
disconnect()
Harsh disconnect
|
void |
dispatch(java.lang.Runnable runnable) |
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
void |
dump(java.lang.Appendable out,
java.lang.String indent) |
boolean |
equals(java.lang.Object obj) |
BatchMode |
getBatchMode() |
ByteBufferPool |
getBufferPool() |
java.lang.ClassLoader |
getClassLoader() |
LogicalConnection |
getConnection() |
WebSocketContainerScope |
getContainerScope()
The parent
WebSocketContainerScope for this session scope. |
ExtensionFactory |
getExtensionFactory() |
long |
getIdleTimeout()
The idle timeout in milliseconds
|
IncomingFrames |
getIncomingHandler() |
java.net.InetSocketAddress |
getLocalAddress()
Get the address of the local side.
|
OutgoingFrames |
getOutgoingHandler() |
WebSocketPolicy |
getPolicy()
Access the (now read-only)
WebSocketPolicy in use for this connection. |
java.lang.String |
getProtocolVersion()
Returns the version of the websocket protocol currently being used.
|
RemoteEndpoint |
getRemote()
Return a reference to the RemoteEndpoint object representing the other end of this conversation.
|
java.net.InetSocketAddress |
getRemoteAddress()
Get the address of the remote side.
|
java.net.URI |
getRequestURI() |
UpgradeRequest |
getUpgradeRequest()
Get the UpgradeRequest used to create this session
|
UpgradeResponse |
getUpgradeResponse()
Get the UpgradeResponse used to create this session
|
WebSocketSession |
getWebSocketSession()
Active
WebSocketSession associated with this scope. |
int |
hashCode() |
void |
incomingError(java.lang.Throwable t)
Incoming Errors
|
void |
incomingFrame(Frame frame)
Incoming Raw Frames from Parser
|
boolean |
isOpen()
Return true if and only if the underlying socket is open.
|
boolean |
isSecure()
Return true if and only if the underlying socket is using a secure transport.
|
WebSocketRemoteEndpoint |
newRemoteEndpoint(LogicalConnection connection,
OutgoingFrames outgoingFrames,
BatchMode batchMode) |
void |
notifyClose(int statusCode,
java.lang.String reason) |
void |
notifyError(java.lang.Throwable cause) |
void |
onClosed(Connection connection)
Jetty Connection onClosed event
|
void |
onConnectionStateChange(ConnectionState state) |
void |
onOpened(Connection connection)
Jetty Connection onOpen event
|
void |
open()
Open/Activate the session
|
void |
setExtensionFactory(ExtensionFactory extensionFactory) |
void |
setFuture(java.util.concurrent.CompletableFuture<Session> fut) |
void |
setIdleTimeout(long ms)
Set the timeout in milliseconds
|
void |
setOutgoingHandler(OutgoingFrames outgoing) |
void |
setPolicy(WebSocketPolicy policy)
Deprecated.
|
void |
setUpgradeRequest(UpgradeRequest request) |
void |
setUpgradeResponse(UpgradeResponse response) |
SuspendToken |
suspend()
Suspend the incoming read events on the connection.
|
java.lang.String |
toString() |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stoppublic WebSocketSession(WebSocketContainerScope containerScope, java.net.URI requestURI, EventDriver websocket, LogicalConnection connection)
public void abort(int statusCode,
java.lang.String reason)
statusCode - the status codereason - the raw reason codepublic void close()
SessionThis will enqueue a graceful close to the remote endpoint.
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface SessionSession.close(CloseStatus),
Session.close(int, String),
Session.disconnect()public void close(CloseStatus closeStatus)
SessionThis will enqueue a graceful close to the remote endpoint.
close in interface SessioncloseStatus - the reason for the closureSession.close(),
Session.close(int, String),
Session.disconnect()public void close(int statusCode,
java.lang.String reason)
SessionThis will enqueue a graceful close to the remote endpoint.
close in interface SessionstatusCode - the status codereason - the (optional) reason. (can be null for no reason)StatusCode,
Session.close(),
Session.close(CloseStatus),
Session.disconnect()public void disconnect()
disconnect in interface SessionSession.close(),
Session.close(CloseStatus),
Session.close(int, String),
Session.disconnect()public void dispatch(java.lang.Runnable runnable)
protected void doStart()
throws java.lang.Exception
ContainerLifeCycledoStart in class ContainerLifeCyclejava.lang.Exceptionprotected void doStop()
throws java.lang.Exception
ContainerLifeCycledoStop in class ContainerLifeCyclejava.lang.Exceptionpublic void dump(java.lang.Appendable out,
java.lang.String indent)
throws java.io.IOException
dump in interface Dumpabledump in class ContainerLifeCyclejava.io.IOExceptionpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic ByteBufferPool getBufferPool()
public java.lang.ClassLoader getClassLoader()
public LogicalConnection getConnection()
public WebSocketContainerScope getContainerScope()
WebSocketSessionScopeWebSocketContainerScope for this session scope.getContainerScope in interface WebSocketSessionScopepublic ExtensionFactory getExtensionFactory()
public long getIdleTimeout()
getIdleTimeout in interface Session@ManagedAttribute(readonly=true) public IncomingFrames getIncomingHandler()
public java.net.InetSocketAddress getLocalAddress()
SessiongetLocalAddress in interface Session@ManagedAttribute(readonly=true) public OutgoingFrames getOutgoingHandler()
public WebSocketPolicy getPolicy()
SessionWebSocketPolicy in use for this connection.public java.lang.String getProtocolVersion()
SessiongetProtocolVersion in interface Sessionpublic RemoteEndpoint getRemote()
Sessionpublic java.net.InetSocketAddress getRemoteAddress()
SessiongetRemoteAddress in interface Sessionpublic java.net.URI getRequestURI()
public UpgradeRequest getUpgradeRequest()
SessiongetUpgradeRequest in interface Sessionpublic UpgradeResponse getUpgradeResponse()
SessiongetUpgradeResponse in interface Sessionpublic WebSocketSession getWebSocketSession()
WebSocketSessionScopeWebSocketSession associated with this scope.getWebSocketSession in interface WebSocketSessionScopepublic int hashCode()
hashCode in class java.lang.Objectpublic void incomingError(java.lang.Throwable t)
incomingError in interface IncomingFramespublic void incomingFrame(Frame frame)
incomingFrame in interface IncomingFramesframe - the frame to processpublic boolean isOpen()
Sessionpublic boolean isSecure()
Sessionpublic void notifyClose(int statusCode,
java.lang.String reason)
public void notifyError(java.lang.Throwable cause)
public void onClosed(Connection connection)
onClosed in interface Connection.Listenerconnection - the connection that was closedpublic void onOpened(Connection connection)
onOpened in interface Connection.Listenerconnection - the connection that was openedpublic void onConnectionStateChange(ConnectionState state)
onConnectionStateChange in interface IOState.ConnectionStateListenerpublic WebSocketRemoteEndpoint newRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoingFrames, BatchMode batchMode)
newRemoteEndpoint in interface RemoteEndpointFactorypublic void open()
public void setExtensionFactory(ExtensionFactory extensionFactory)
public void setFuture(java.util.concurrent.CompletableFuture<Session> fut)
public void setIdleTimeout(long ms)
setIdleTimeout in interface Sessionms - the number of milliseconds.public void setOutgoingHandler(OutgoingFrames outgoing)
@Deprecated public void setPolicy(WebSocketPolicy policy)
public void setUpgradeRequest(UpgradeRequest request)
public void setUpgradeResponse(UpgradeResponse response)
public SuspendToken suspend()
Sessionpublic BatchMode getBatchMode()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 1995–2018 Webtide. All rights reserved.