Class WebSocketSession
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.websocket.common.WebSocketSession
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Connection.Listener
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
,IncomingFrames
,OutgoingFrames
,Session
,RemoteEndpointFactory
,WebSocketSessionScope
@ManagedObject("A Jetty WebSocket Session") public class WebSocketSession extends ContainerLifeCycle implements Session, RemoteEndpointFactory, WebSocketSessionScope, IncomingFrames, OutgoingFrames, Connection.Listener
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection.Listener
Connection.Listener.Adapter
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Constructor Summary
Constructors Constructor Description WebSocketSession(WebSocketContainerScope containerScope, java.net.URI requestURI, EventDriver websocket, LogicalConnection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
callApplicationOnClose(CloseInfo closeInfo)
void
callApplicationOnError(java.lang.Throwable cause)
void
close()
void
close(int statusCode, java.lang.String reason)
void
close(java.lang.Throwable cause)
Close the active session based on the throwablevoid
close(CloseStatus closeStatus)
void
disconnect()
Harsh disconnectvoid
dispatch(java.lang.Runnable runnable)
protected void
doStart()
protected void
doStop()
java.lang.String
dumpSelf()
BatchMode
getBatchMode()
ByteBufferPool
getBufferPool()
java.lang.ClassLoader
getClassLoader()
LogicalConnection
getConnection()
WebSocketContainerScope
getContainerScope()
The parentWebSocketContainerScope
for this session scope.ExtensionFactory
getExtensionFactory()
long
getIdleTimeout()
The idle timeout in millisecondsIncomingFrames
getIncomingHandler()
java.net.InetSocketAddress
getLocalAddress()
OutgoingFrames
getOutgoingHandler()
WebSocketPolicy
getPolicy()
java.lang.String
getProtocolVersion()
RemoteEndpoint
getRemote()
java.net.InetSocketAddress
getRemoteAddress()
java.net.URI
getRequestURI()
UpgradeRequest
getUpgradeRequest()
UpgradeResponse
getUpgradeResponse()
WebSocketSession
getWebSocketSession()
ActiveWebSocketSession
associated with this scope.void
incomingFrame(Frame frame)
Incoming Raw Frames from Parserboolean
isOpen()
boolean
isSecure()
WebSocketRemoteEndpoint
newRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoingFrames, BatchMode batchMode)
void
onClosed(Connection connection)
Jetty Connection onSessionClosed eventvoid
onOpened(Connection connection)
Jetty Connection onOpen eventvoid
open()
Open/Activate the sessionvoid
outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
void
setExtensionFactory(ExtensionFactory extensionFactory)
void
setFuture(java.util.concurrent.CompletableFuture<Session> fut)
void
setIdleTimeout(long ms)
Set the timeout in millisecondsvoid
setOutgoingHandler(OutgoingFrames outgoing)
void
setPolicy(WebSocketPolicy policy)
Deprecated.void
setUpgradeRequest(UpgradeRequest request)
void
setUpgradeResponse(UpgradeResponse response)
SuspendToken
suspend()
java.lang.String
toString()
-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
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, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
-
-
-
Constructor Detail
-
WebSocketSession
public WebSocketSession(WebSocketContainerScope containerScope, java.net.URI requestURI, EventDriver websocket, LogicalConnection connection)
-
-
Method Detail
-
close
public void close(java.lang.Throwable cause)
Close the active session based on the throwable- Parameters:
cause
- the cause for closing the connection
-
close
public void close()
-
close
public void close(CloseStatus closeStatus)
-
close
public void close(int statusCode, java.lang.String reason)
-
disconnect
public void disconnect()
Harsh disconnect- Specified by:
disconnect
in interfaceSession
-
dispatch
public void dispatch(java.lang.Runnable runnable)
-
doStart
protected void doStart() throws java.lang.Exception
- Overrides:
doStart
in classContainerLifeCycle
- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.Exception
- Overrides:
doStop
in classContainerLifeCycle
- Throws:
java.lang.Exception
-
getBufferPool
public ByteBufferPool getBufferPool()
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
-
getConnection
public LogicalConnection getConnection()
-
getContainerScope
public WebSocketContainerScope getContainerScope()
Description copied from interface:WebSocketSessionScope
The parentWebSocketContainerScope
for this session scope.- Specified by:
getContainerScope
in interfaceWebSocketSessionScope
- Returns:
- the websocket container scope
-
getExtensionFactory
public ExtensionFactory getExtensionFactory()
-
getIdleTimeout
public long getIdleTimeout()
The idle timeout in milliseconds- Specified by:
getIdleTimeout
in interfaceSession
-
getIncomingHandler
@ManagedAttribute(readonly=true) public IncomingFrames getIncomingHandler()
-
getLocalAddress
public java.net.InetSocketAddress getLocalAddress()
- Specified by:
getLocalAddress
in interfaceSession
-
getOutgoingHandler
@ManagedAttribute(readonly=true) public OutgoingFrames getOutgoingHandler()
-
getPolicy
public WebSocketPolicy getPolicy()
-
getProtocolVersion
public java.lang.String getProtocolVersion()
- Specified by:
getProtocolVersion
in interfaceSession
-
getRemote
public RemoteEndpoint getRemote()
-
getRemoteAddress
public java.net.InetSocketAddress getRemoteAddress()
- Specified by:
getRemoteAddress
in interfaceSession
-
getRequestURI
public java.net.URI getRequestURI()
-
getUpgradeRequest
public UpgradeRequest getUpgradeRequest()
- Specified by:
getUpgradeRequest
in interfaceSession
-
getUpgradeResponse
public UpgradeResponse getUpgradeResponse()
- Specified by:
getUpgradeResponse
in interfaceSession
-
getWebSocketSession
public WebSocketSession getWebSocketSession()
Description copied from interface:WebSocketSessionScope
ActiveWebSocketSession
associated with this scope.- Specified by:
getWebSocketSession
in interfaceWebSocketSessionScope
- Returns:
- the websocket session
-
incomingFrame
public void incomingFrame(Frame frame)
Incoming Raw Frames from Parser- Specified by:
incomingFrame
in interfaceIncomingFrames
-
outgoingFrame
public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
- Specified by:
outgoingFrame
in interfaceOutgoingFrames
-
callApplicationOnClose
public void callApplicationOnClose(CloseInfo closeInfo)
-
callApplicationOnError
public void callApplicationOnError(java.lang.Throwable cause)
-
onClosed
public void onClosed(Connection connection)
Jetty Connection onSessionClosed event- Specified by:
onClosed
in interfaceConnection.Listener
- Parameters:
connection
- the connection that was closed
-
onOpened
public void onOpened(Connection connection)
Jetty Connection onOpen event- Specified by:
onOpened
in interfaceConnection.Listener
- Parameters:
connection
- the connection that was opened
-
newRemoteEndpoint
public WebSocketRemoteEndpoint newRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoingFrames, BatchMode batchMode)
- Specified by:
newRemoteEndpoint
in interfaceRemoteEndpointFactory
-
open
public void open()
Open/Activate the session
-
setExtensionFactory
public void setExtensionFactory(ExtensionFactory extensionFactory)
-
setFuture
public void setFuture(java.util.concurrent.CompletableFuture<Session> fut)
-
setIdleTimeout
public void setIdleTimeout(long ms)
Set the timeout in milliseconds- Specified by:
setIdleTimeout
in interfaceSession
-
setOutgoingHandler
public void setOutgoingHandler(OutgoingFrames outgoing)
-
setPolicy
@Deprecated public void setPolicy(WebSocketPolicy policy)
Deprecated.
-
setUpgradeRequest
public void setUpgradeRequest(UpgradeRequest request)
-
setUpgradeResponse
public void setUpgradeResponse(UpgradeResponse response)
-
suspend
public SuspendToken suspend()
-
getBatchMode
public BatchMode getBatchMode()
- Returns:
- the default (initial) value for the batching mode.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractLifeCycle
-
-