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 voidcallApplicationOnClose(CloseInfo closeInfo)voidcallApplicationOnError(java.lang.Throwable cause)voidclose()voidclose(int statusCode, java.lang.String reason)voidclose(java.lang.Throwable cause)Close the active session based on the throwablevoidclose(CloseStatus closeStatus)voiddisconnect()Harsh disconnectvoiddispatch(java.lang.Runnable runnable)protected voiddoStart()protected voiddoStop()java.lang.StringdumpSelf()BatchModegetBatchMode()ByteBufferPoolgetBufferPool()java.lang.ClassLoadergetClassLoader()LogicalConnectiongetConnection()WebSocketContainerScopegetContainerScope()The parentWebSocketContainerScopefor this session scope.ExtensionFactorygetExtensionFactory()longgetIdleTimeout()The idle timeout in millisecondsIncomingFramesgetIncomingHandler()java.net.InetSocketAddressgetLocalAddress()OutgoingFramesgetOutgoingHandler()WebSocketPolicygetPolicy()java.lang.StringgetProtocolVersion()RemoteEndpointgetRemote()java.net.InetSocketAddressgetRemoteAddress()java.net.URIgetRequestURI()UpgradeRequestgetUpgradeRequest()UpgradeResponsegetUpgradeResponse()WebSocketSessiongetWebSocketSession()ActiveWebSocketSessionassociated with this scope.voidincomingFrame(Frame frame)Incoming Raw Frames from ParserbooleanisOpen()booleanisSecure()WebSocketRemoteEndpointnewRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoingFrames, BatchMode batchMode)voidonClosed(Connection connection)Jetty Connection onSessionClosed eventvoidonOpened(Connection connection)Jetty Connection onOpen eventvoidopen()Open/Activate the sessionvoidoutgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)voidsetExtensionFactory(ExtensionFactory extensionFactory)voidsetFuture(java.util.concurrent.CompletableFuture<Session> fut)voidsetIdleTimeout(long ms)Set the timeout in millisecondsvoidsetOutgoingHandler(OutgoingFrames outgoing)voidsetPolicy(WebSocketPolicy policy)Deprecated.voidsetUpgradeRequest(UpgradeRequest request)voidsetUpgradeResponse(UpgradeResponse response)SuspendTokensuspend()java.lang.StringtoString()-
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:
disconnectin interfaceSession
-
dispatch
public void dispatch(java.lang.Runnable runnable)
-
doStart
protected void doStart() throws java.lang.Exception- Overrides:
doStartin classContainerLifeCycle- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.Exception- Overrides:
doStopin 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:WebSocketSessionScopeThe parentWebSocketContainerScopefor this session scope.- Specified by:
getContainerScopein interfaceWebSocketSessionScope- Returns:
- the websocket container scope
-
getExtensionFactory
public ExtensionFactory getExtensionFactory()
-
getIdleTimeout
public long getIdleTimeout()
The idle timeout in milliseconds- Specified by:
getIdleTimeoutin interfaceSession
-
getIncomingHandler
@ManagedAttribute(readonly=true) public IncomingFrames getIncomingHandler()
-
getLocalAddress
public java.net.InetSocketAddress getLocalAddress()
- Specified by:
getLocalAddressin interfaceSession
-
getOutgoingHandler
@ManagedAttribute(readonly=true) public OutgoingFrames getOutgoingHandler()
-
getPolicy
public WebSocketPolicy getPolicy()
-
getProtocolVersion
public java.lang.String getProtocolVersion()
- Specified by:
getProtocolVersionin interfaceSession
-
getRemote
public RemoteEndpoint getRemote()
-
getRemoteAddress
public java.net.InetSocketAddress getRemoteAddress()
- Specified by:
getRemoteAddressin interfaceSession
-
getRequestURI
public java.net.URI getRequestURI()
-
getUpgradeRequest
public UpgradeRequest getUpgradeRequest()
- Specified by:
getUpgradeRequestin interfaceSession
-
getUpgradeResponse
public UpgradeResponse getUpgradeResponse()
- Specified by:
getUpgradeResponsein interfaceSession
-
getWebSocketSession
public WebSocketSession getWebSocketSession()
Description copied from interface:WebSocketSessionScopeActiveWebSocketSessionassociated with this scope.- Specified by:
getWebSocketSessionin interfaceWebSocketSessionScope- Returns:
- the websocket session
-
incomingFrame
public void incomingFrame(Frame frame)
Incoming Raw Frames from Parser- Specified by:
incomingFramein interfaceIncomingFrames
-
outgoingFrame
public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
- Specified by:
outgoingFramein 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:
onClosedin interfaceConnection.Listener- Parameters:
connection- the connection that was closed
-
onOpened
public void onOpened(Connection connection)
Jetty Connection onOpen event- Specified by:
onOpenedin interfaceConnection.Listener- Parameters:
connection- the connection that was opened
-
newRemoteEndpoint
public WebSocketRemoteEndpoint newRemoteEndpoint(LogicalConnection connection, OutgoingFrames outgoingFrames, BatchMode batchMode)
- Specified by:
newRemoteEndpointin 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:
setIdleTimeoutin 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:
toStringin classAbstractLifeCycle
-
-