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:
Closeable,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.AbstractLifeCycleListenerNested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection.Listener
Connection.Listener.AdapterNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionWebSocketSession(WebSocketContainerScope containerScope, URI requestURI, EventDriver websocket, LogicalConnection connection) -
Method Summary
Modifier and TypeMethodDescriptionvoidcallApplicationOnClose(CloseInfo closeInfo) voidcallApplicationOnError(Throwable cause) voidclose()voidvoidClose the active session based on the throwablevoidclose(CloseStatus closeStatus) voidHarsh disconnectvoidprotected voiddoStart()protected voiddoStop()dumpSelf()The parentWebSocketContainerScopefor this session scope.longThe idle timeout in millisecondsActiveWebSocketSessionassociated with this scope.voidincomingFrame(Frame frame) Incoming Raw Frames from ParserbooleanisOpen()booleanisSecure()newRemoteEndpoint(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) voidvoidsetIdleTimeout(long ms) Set the timeout in millisecondsvoidsetOutgoingHandler(OutgoingFrames outgoing) voidsetPolicy(WebSocketPolicy policy) Deprecated.voidsetUpgradeRequest(UpgradeRequest request) voidsetUpgradeResponse(UpgradeResponse response) suspend()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, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Constructor Details
-
WebSocketSession
public WebSocketSession(WebSocketContainerScope containerScope, URI requestURI, EventDriver websocket, LogicalConnection connection)
-
-
Method Details
-
close
Close the active session based on the throwable- Parameters:
cause- the cause for closing the connection
-
close
public void close() -
close
-
close
-
disconnect
public void disconnect()Harsh disconnect- Specified by:
disconnectin interfaceSession
-
dispatch
-
doStart
- Overrides:
doStartin classContainerLifeCycle- Throws:
Exception
-
doStop
- Overrides:
doStopin classContainerLifeCycle- Throws:
Exception
-
dumpSelf
-
getBufferPool
-
getClassLoader
-
getConnection
-
getContainerScope
Description copied from interface:WebSocketSessionScopeThe parentWebSocketContainerScopefor this session scope.- Specified by:
getContainerScopein interfaceWebSocketSessionScope- Returns:
- the websocket container scope
-
getExtensionFactory
-
getIdleTimeout
public long getIdleTimeout()The idle timeout in milliseconds- Specified by:
getIdleTimeoutin interfaceSession
-
getIncomingHandler
-
getLocalAddress
- Specified by:
getLocalAddressin interfaceSession
-
getOutgoingHandler
-
getPolicy
-
getProtocolVersion
- Specified by:
getProtocolVersionin interfaceSession
-
getRemote
-
getRemoteAddress
- Specified by:
getRemoteAddressin interfaceSession
-
getRequestURI
-
getUpgradeRequest
- Specified by:
getUpgradeRequestin interfaceSession
-
getUpgradeResponse
- Specified by:
getUpgradeResponsein interfaceSession
-
getWebSocketSession
Description copied from interface:WebSocketSessionScopeActiveWebSocketSessionassociated with this scope.- Specified by:
getWebSocketSessionin interfaceWebSocketSessionScope- Returns:
- the websocket session
-
incomingFrame
Incoming Raw Frames from Parser- Specified by:
incomingFramein interfaceIncomingFrames
-
outgoingFrame
- Specified by:
outgoingFramein interfaceOutgoingFrames
-
isOpen
public boolean isOpen() -
isSecure
public boolean isSecure() -
callApplicationOnClose
-
callApplicationOnError
-
onClosed
Jetty Connection onSessionClosed event- Specified by:
onClosedin interfaceConnection.Listener- Parameters:
connection- the connection that was closed
-
onOpened
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
-
setFuture
-
setIdleTimeout
public void setIdleTimeout(long ms) Set the timeout in milliseconds- Specified by:
setIdleTimeoutin interfaceSession
-
setOutgoingHandler
-
setPolicy
Deprecated. -
setUpgradeRequest
-
setUpgradeResponse
-
suspend
-
getBatchMode
- Returns:
- the default (initial) value for the batching mode.
-
toString
- Overrides:
toStringin classAbstractLifeCycle
-