@ManagedObject(value="A Jetty WebSocket Session") public class WebSocketSession extends ContainerLifeCycle implements Session, RemoteEndpointFactory, WebSocketSessionScope, IncomingFrames, Connection.Listener
AbstractLifeCycle.AbstractLifeCycleListenerConnection.Listener.AdapterContainer.InheritedListener, Container.ListenerLifeCycle.Listener| Constructor and Description |
|---|
WebSocketSession(WebSocketContainerScope containerScope,
java.net.URI requestURI,
EventDriver websocket,
LogicalConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
void |
callApplicationOnClose(CloseInfo closeInfo) |
void |
callApplicationOnError(java.lang.Throwable cause) |
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 |
close(java.lang.Throwable cause)
Close the active session based on the throwable
|
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.
|
java.lang.String |
dumpSelf()
The description of this/self found in the dump.
|
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. |
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 |
onClosed(Connection connection)
Jetty Connection onSessionClosed event
|
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, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdumpObjectspublic WebSocketSession(WebSocketContainerScope containerScope, java.net.URI requestURI, EventDriver websocket, LogicalConnection connection)
public void close(java.lang.Throwable cause)
cause - the cause for closing the connectionpublic 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 java.lang.String dumpSelf()
Dumpablepublic 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 void incomingFrame(Frame frame)
incomingFrame in interface IncomingFramesframe - the frame to processpublic boolean isOpen()
Sessionpublic boolean isSecure()
Sessionpublic void callApplicationOnClose(CloseInfo closeInfo)
public void callApplicationOnError(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 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 AbstractLifeCycleCopyright © 1995–2021 Webtide. All rights reserved.