@ManagedObject(value="A Jetty WebSocket Session") public class WebSocketSession extends ContainerLifeCycle implements Session, RemoteEndpointFactory, WebSocketSessionScope, IncomingFrames, OutgoingFrames, Connection.Listener
AbstractLifeCycle.AbstractLifeCycleListenerConnection.Listener.AdapterContainer.InheritedListener, Container.ListenerLifeCycle.Listener| Constructor and Description |
|---|
WebSocketSession(WebSocketContainerScope containerScope,
URI requestURI,
EventDriver websocket,
LogicalConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
void |
callApplicationOnClose(CloseInfo closeInfo) |
void |
callApplicationOnError(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,
String reason)
Send a websocket Close frame, with status code.
|
void |
close(Throwable cause)
Close the active session based on the throwable
|
void |
disconnect()
Harsh disconnect
|
void |
dispatch(Runnable runnable) |
String |
dumpSelf()
The description of this/self found in the dump.
|
BatchMode |
getBatchMode() |
ByteBufferPool |
getBufferPool() |
ClassLoader |
getClassLoader() |
LogicalConnection |
getConnection() |
WebSocketContainerScope |
getContainerScope()
The parent
WebSocketContainerScope for this session scope. |
ExtensionFactory |
getExtensionFactory() |
long |
getIdleTimeout()
The idle timeout in milliseconds
|
IncomingFrames |
getIncomingHandler() |
InetSocketAddress |
getLocalAddress()
Get the address of the local side.
|
OutgoingFrames |
getOutgoingHandler() |
WebSocketPolicy |
getPolicy()
Access the (now read-only)
WebSocketPolicy in use for this connection. |
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.
|
InetSocketAddress |
getRemoteAddress()
Get the address of the remote side.
|
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 |
outgoingFrame(Frame frame,
WriteCallback callback,
BatchMode batchMode)
A frame, and optional callback, intended for the network layer.
|
void |
setExtensionFactory(ExtensionFactory extensionFactory) |
void |
setFuture(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.
|
String |
toString() |
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopequals, getClass, hashCode, notify, notifyAll, wait, wait, waitdumpContainer, dumpIterable, dumpMapEntries, dumpObjects, namedpublic WebSocketSession(WebSocketContainerScope containerScope, URI requestURI, EventDriver websocket, LogicalConnection connection)
public void close(Throwable cause)
cause - the cause for closing the connectionpublic void close()
SessionThis will enqueue a graceful close to the remote endpoint.
close in interface Closeableclose in interface 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,
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(Runnable runnable)
public String dumpSelf()
Dumpablepublic ByteBufferPool getBufferPool()
public 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 InetSocketAddress getLocalAddress()
SessiongetLocalAddress in interface Session@ManagedAttribute(readonly=true) public OutgoingFrames getOutgoingHandler()
public WebSocketPolicy getPolicy()
SessionWebSocketPolicy in use for this connection.public String getProtocolVersion()
SessiongetProtocolVersion in interface Sessionpublic RemoteEndpoint getRemote()
Sessionpublic InetSocketAddress getRemoteAddress()
SessiongetRemoteAddress in interface Sessionpublic 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 void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
OutgoingFramesNote: the frame can undergo many transformations in the various layers and extensions present in the implementation.
If you are implementing a mutation, you are obliged to handle the incoming WriteCallback appropriately.
outgoingFrame in interface OutgoingFramesframe - the frame to eventually write to the network layer.callback - the callback to notify when the frame is written.batchMode - the batch mode requested by the sender.public boolean isOpen()
Sessionpublic boolean isSecure()
Sessionpublic void callApplicationOnClose(CloseInfo closeInfo)
public void callApplicationOnError(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(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 String toString()
toString in class AbstractLifeCycleCopyright © 2010 - 2020 Adobe. All Rights Reserved