Class AbstractWebSocketConnection
- java.lang.Object
-
- org.eclipse.jetty.io.AbstractConnection
-
- org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Connection
,Connection.UpgradeTo
,Dumpable
,OutgoingFrames
,SuspendToken
,LogicalConnection
- Direct Known Subclasses:
WebSocketClientConnection
,WebSocketServerConnection
@Deprecated(since="2021-05-27") public abstract class AbstractWebSocketConnection extends AbstractConnection implements LogicalConnection, Connection.UpgradeTo, Dumpable
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.Provides the implementation ofLogicalConnection
within the framework of the newConnection
framework ofjetty-io
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractWebSocketConnection.Stats
Deprecated.-
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
-
Constructor Summary
Constructors Constructor Description AbstractWebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canReadWebSocketFrames()
Deprecated.Test if Connection State allows for reading of frames.boolean
canWriteWebSocketFrames()
Deprecated.Test if Connection State allows for writing frames.void
close()
Deprecated.Jetty Connection Closevoid
close(Throwable cause)
Deprecated.Close the connection based on the throwablevoid
close(CloseInfo close, Callback callback)
Deprecated.Request a local close.void
disconnect()
Deprecated.Terminate the connection (no close frame sent)void
dump(Appendable out, String indent)
Deprecated.Dump this object (and children) into an Appendable using the provided indent after any new lines.String
dumpSelf()
Deprecated.The description of this/self found in the dump.void
fillInterested()
Deprecated.Utility method to be called to register read interest.ByteBufferPool
getBufferPool()
Deprecated.Get the ByteBufferPool in use by the connectionlong
getBytesIn()
Deprecated.long
getBytesOut()
Deprecated.Executor
getExecutor()
Deprecated.Get the Executor used by this connection.List<ExtensionConfig>
getExtensions()
Deprecated.Get the list of extensions in use.Generator
getGenerator()
Deprecated.String
getId()
Deprecated.Get Unique ID for the Connectionlong
getIdleTimeout()
Deprecated.Get the read/write idle timeout.InetSocketAddress
getLocalAddress()
Deprecated.Get the localInetSocketAddress
in use for this connection.long
getMaxIdleTimeout()
Deprecated.Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)long
getMessagesIn()
Deprecated.long
getMessagesOut()
Deprecated.Parser
getParser()
Deprecated.WebSocketPolicy
getPolicy()
Deprecated.The policy that the connection is running under.InetSocketAddress
getRemoteAddress()
Deprecated.Get the remote Address in use for this connection.Scheduler
getScheduler()
Deprecated.AbstractWebSocketConnection.Stats
getStats()
Deprecated.boolean
isOpen()
Deprecated.Test if logical connection is still openboolean
isReading()
Deprecated.Tests if the connection is actively reading.void
onFillable()
Deprecated.Callback method invoked when the endpoint is ready to be read.boolean
onIdleExpired()
Deprecated.Callback method invoked upon an idle timeout event.void
onUpgradeTo(ByteBuffer buffer)
Deprecated.Extra bytes from the initial HTTP upgrade that need to be processed by the websocket parser before starting to read bytes from the connectionboolean
opened()
Deprecated.Set the state to opened (the application onOpen() method has been called successfully).boolean
opening()
Deprecated.Set the state to upgrade/opening handshake has completed.void
outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
Deprecated.Frame from API, User, or Internal implementation destined for network.void
remoteClose(CloseInfo close)
Deprecated.Report that the Remote Endpoint CLOSE Frame has been receivedvoid
resume()
Deprecated.Resume a previously suspended connection.void
setExtensions(List<ExtensionConfig> extensions)
Deprecated.Get the list of extensions in use.void
setInputBufferSize(int inputBufferSize)
Deprecated.void
setMaxIdleTimeout(long ms)
Deprecated.Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)void
setNextIncomingFrames(IncomingFrames incoming)
Deprecated.Set where the connection should send the incoming frames to.void
setSession(WebSocketSession session)
Deprecated.Associate the Active Session with the connection.SuspendToken
suspend()
Deprecated.Suspend a the incoming read events on the connection.String
toConnectionString()
Deprecated.String
toStateString()
Deprecated.Get the Connection State as a String-
Methods inherited from class org.eclipse.jetty.io.AbstractConnection
addListener, getCreatedTimeStamp, getEndPoint, getInputBufferSize, isFillInterested, onClose, onOpen, removeListener, toString, tryFillInterested, tryFillInterested
-
-
-
-
Constructor Detail
-
AbstractWebSocketConnection
public AbstractWebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, WebSocketPolicy policy, ByteBufferPool bufferPool)
Deprecated.
-
-
Method Detail
-
getExecutor
public Executor getExecutor()
Deprecated.Description copied from interface:LogicalConnection
Get the Executor used by this connection.- Specified by:
getExecutor
in interfaceLogicalConnection
- Returns:
- the executor
-
close
public void close(CloseInfo close, Callback callback)
Deprecated.Description copied from interface:LogicalConnection
Request a local close.- Specified by:
close
in interfaceLogicalConnection
-
close
public void close(Throwable cause)
Deprecated.Close the connection based on the throwable- Specified by:
close
in interfaceLogicalConnection
- Parameters:
cause
- the cause
-
canWriteWebSocketFrames
public boolean canWriteWebSocketFrames()
Deprecated.Description copied from interface:LogicalConnection
Test if Connection State allows for writing frames.- Specified by:
canWriteWebSocketFrames
in interfaceLogicalConnection
- Returns:
- true if able to write, false otherwise.
-
canReadWebSocketFrames
public boolean canReadWebSocketFrames()
Deprecated.Description copied from interface:LogicalConnection
Test if Connection State allows for reading of frames.- Specified by:
canReadWebSocketFrames
in interfaceLogicalConnection
- Returns:
- true if able to read, false otherwise.
-
toStateString
public String toStateString()
Deprecated.Description copied from interface:LogicalConnection
Get the Connection State as a String- Specified by:
toStateString
in interfaceLogicalConnection
- Returns:
- the Connection State string
-
opening
public boolean opening()
Deprecated.Description copied from interface:LogicalConnection
Set the state to upgrade/opening handshake has completed.- Specified by:
opening
in interfaceLogicalConnection
- Returns:
- true if state is OPENING, false otherwise
-
opened
public boolean opened()
Deprecated.Description copied from interface:LogicalConnection
Set the state to opened (the application onOpen() method has been called successfully).Reads from network begin here.
- Specified by:
opened
in interfaceLogicalConnection
- Returns:
- true if state is OPENED, false otherwise
-
remoteClose
public void remoteClose(CloseInfo close)
Deprecated.Description copied from interface:LogicalConnection
Report that the Remote Endpoint CLOSE Frame has been received- Specified by:
remoteClose
in interfaceLogicalConnection
- Parameters:
close
- the close frame details
-
setSession
public void setSession(WebSocketSession session)
Deprecated.Description copied from interface:LogicalConnection
Associate the Active Session with the connection.- Specified by:
setSession
in interfaceLogicalConnection
- Parameters:
session
- the session for this connection
-
onIdleExpired
public boolean onIdleExpired()
Deprecated.Description copied from interface:Connection
Callback method invoked upon an idle timeout event.
Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.
When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.
- Specified by:
onIdleExpired
in interfaceConnection
- Overrides:
onIdleExpired
in classAbstractConnection
- Returns:
- true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.
-
close
public void close()
Deprecated.Jetty Connection Close- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnection
- Overrides:
close
in classAbstractConnection
-
disconnect
public void disconnect()
Deprecated.Description copied from interface:LogicalConnection
Terminate the connection (no close frame sent)- Specified by:
disconnect
in interfaceLogicalConnection
-
fillInterested
public void fillInterested()
Deprecated.Description copied from class:AbstractConnection
Utility method to be called to register read interest.
After a call to this method,
AbstractConnection.onFillable()
orAbstractConnection.onFillInterestedFailed(Throwable)
will be called back as appropriate.- Overrides:
fillInterested
in classAbstractConnection
- See Also:
AbstractConnection.onFillable()
-
getBufferPool
public ByteBufferPool getBufferPool()
Deprecated.Description copied from interface:LogicalConnection
Get the ByteBufferPool in use by the connection- Specified by:
getBufferPool
in interfaceLogicalConnection
- Returns:
- the buffer pool
-
getExtensions
public List<ExtensionConfig> getExtensions()
Deprecated.Get the list of extensions in use.This list is negotiated during the WebSocket Upgrade Request/Response handshake.
- Returns:
- the list of negotiated extensions in use.
-
getGenerator
public Generator getGenerator()
Deprecated.
-
getId
public String getId()
Deprecated.Description copied from interface:LogicalConnection
Get Unique ID for the Connection- Specified by:
getId
in interfaceLogicalConnection
- Returns:
- the unique ID for the connection
-
getIdleTimeout
public long getIdleTimeout()
Deprecated.Description copied from interface:LogicalConnection
Get the read/write idle timeout.- Specified by:
getIdleTimeout
in interfaceLogicalConnection
- Returns:
- the idle timeout in milliseconds
-
getMaxIdleTimeout
public long getMaxIdleTimeout()
Deprecated.Description copied from interface:LogicalConnection
Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)- Specified by:
getMaxIdleTimeout
in interfaceLogicalConnection
- Returns:
- the idle timeout in milliseconds
-
getParser
public Parser getParser()
Deprecated.
-
getPolicy
public WebSocketPolicy getPolicy()
Deprecated.Description copied from interface:LogicalConnection
The policy that the connection is running under.- Specified by:
getPolicy
in interfaceLogicalConnection
- Returns:
- the policy for the connection
-
getLocalAddress
public InetSocketAddress getLocalAddress()
Deprecated.Description copied from interface:LogicalConnection
Get the localInetSocketAddress
in use for this connection.Note: Non-physical connections, like during the Mux extensions, or during unit testing can result in a InetSocketAddress on port 0 and/or on localhost.
- Specified by:
getLocalAddress
in interfaceLogicalConnection
- Returns:
- the local address.
-
getRemoteAddress
public InetSocketAddress getRemoteAddress()
Deprecated.Description copied from interface:LogicalConnection
Get the remote Address in use for this connection.Note: Non-physical connections, like during the Mux extensions, or during unit testing can result in a InetSocketAddress on port 0 and/or on localhost.
- Specified by:
getRemoteAddress
in interfaceLogicalConnection
- Returns:
- the remote address.
-
getScheduler
public Scheduler getScheduler()
Deprecated.
-
getStats
@Deprecated public AbstractWebSocketConnection.Stats getStats()
Deprecated.
-
isOpen
public boolean isOpen()
Deprecated.Description copied from interface:LogicalConnection
Test if logical connection is still open- Specified by:
isOpen
in interfaceLogicalConnection
- Returns:
- true if connection is open
-
isReading
public boolean isReading()
Deprecated.Description copied from interface:LogicalConnection
Tests if the connection is actively reading.- Specified by:
isReading
in interfaceLogicalConnection
- Returns:
- true if connection is actively attempting to read.
-
onFillable
public void onFillable()
Deprecated.Description copied from class:AbstractConnection
Callback method invoked when the endpoint is ready to be read.
- Specified by:
onFillable
in classAbstractConnection
- See Also:
AbstractConnection.fillInterested()
-
resume
public void resume()
Deprecated.Description copied from interface:SuspendToken
Resume a previously suspended connection.- Specified by:
resume
in interfaceSuspendToken
-
suspend
public SuspendToken suspend()
Deprecated.Description copied from interface:LogicalConnection
Suspend a the incoming read events on the connection.- Specified by:
suspend
in interfaceLogicalConnection
- Returns:
- the suspend token
-
outgoingFrame
public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
Deprecated.Frame from API, User, or Internal implementation destined for network.- Specified by:
outgoingFrame
in interfaceOutgoingFrames
- Parameters:
frame
- 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.
-
setExtensions
public void setExtensions(List<ExtensionConfig> extensions)
Deprecated.Get the list of extensions in use.This list is negotiated during the WebSocket Upgrade Request/Response handshake.
- Parameters:
extensions
- the list of negotiated extensions in use.
-
setInputBufferSize
public void setInputBufferSize(int inputBufferSize)
Deprecated.- Overrides:
setInputBufferSize
in classAbstractConnection
-
setMaxIdleTimeout
public void setMaxIdleTimeout(long ms)
Deprecated.Description copied from interface:LogicalConnection
Set the maximum number of milliseconds of idleness before the connection is closed/disconnected, (ie no frames are either sent or received)This idle timeout cannot be garunteed to take immediate effect for any active read/write actions. New read/write actions will have this new idle timeout.
- Specified by:
setMaxIdleTimeout
in interfaceLogicalConnection
- Parameters:
ms
- the number of milliseconds of idle timeout
-
dumpSelf
public String dumpSelf()
Deprecated.Description copied from interface:Dumpable
The description of this/self found in the dump. Allows for alternative representation of Object other then .toString() where the long form output of toString() is represented in a cleaner way within the dump infrastructure.
-
dump
public void dump(Appendable out, String indent) throws IOException
Deprecated.Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dump
in interfaceDumpable
- Parameters:
out
- The appendable to dump toindent
- The indent to apply after any new lines.- Throws:
IOException
- if unable to write to Appendable
-
toConnectionString
public String toConnectionString()
Deprecated.- Overrides:
toConnectionString
in classAbstractConnection
-
onUpgradeTo
public void onUpgradeTo(ByteBuffer buffer)
Deprecated.Extra bytes from the initial HTTP upgrade that need to be processed by the websocket parser before starting to read bytes from the connection- Specified by:
onUpgradeTo
in interfaceConnection.UpgradeTo
- Parameters:
buffer
- a non-null buffer of unconsumed bytes received from the upgrade-from connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes.
-
setNextIncomingFrames
public void setNextIncomingFrames(IncomingFrames incoming)
Deprecated.Description copied from interface:LogicalConnection
Set where the connection should send the incoming frames to.Often this is from the Parser to the start of the extension stack, and eventually on to the session.
- Specified by:
setNextIncomingFrames
in interfaceLogicalConnection
- Parameters:
incoming
- the incoming frames handler
-
getMessagesIn
public long getMessagesIn()
Deprecated.- Specified by:
getMessagesIn
in interfaceConnection
- Overrides:
getMessagesIn
in classAbstractConnection
- Returns:
- the number of WebSocket frames received over this connection
-
getMessagesOut
public long getMessagesOut()
Deprecated.- Specified by:
getMessagesOut
in interfaceConnection
- Overrides:
getMessagesOut
in classAbstractConnection
- Returns:
- the number of WebSocket frames sent over this connection
-
getBytesIn
public long getBytesIn()
Deprecated.- Specified by:
getBytesIn
in interfaceConnection
- Overrides:
getBytesIn
in classAbstractConnection
- Returns:
- the number of bytes received over this connection
-
getBytesOut
public long getBytesOut()
Deprecated.- Specified by:
getBytesOut
in interfaceConnection
- Overrides:
getBytesOut
in classAbstractConnection
- Returns:
- the number of bytes frames sent over this connection
-
-