Class WebSocketCoreSession
- All Implemented Interfaces:
- Dumpable,- Configuration,- CoreSession,- IncomingFrames,- OutgoingFrames
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.eclipse.jetty.websocket.core.ConfigurationConfiguration.ConfigurationCustomizer, Configuration.CustomizerNested classes/interfaces inherited from interface org.eclipse.jetty.websocket.core.CoreSessionCoreSession.EmptyNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.DumpableDumpable.DumpableContainer
- 
Field Summary
- 
Constructor SummaryConstructorsConstructorDescriptionWebSocketCoreSession(FrameHandler handler, Behavior behavior, Negotiated negotiated, WebSocketComponents components) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidabort()Issue a harsh abort of the underlying connection.voidvoidSend Close Frame with specified Status Code and optional ReasonvoidSend Close Frame with no payload.voiddemand(long n) Manage flow control by indicating demand for handling Frames.dump()voiddump(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.voidIf using BatchMode.ON or BatchMode.AUTO, trigger a flush of enqueued / batched frames.Get the Idle TimeoutintThe Local Socket Address for the connectionlonglongintGet the maximum number of data frames allowed to be waiting to be sent at any one time.longThe negotiated WebSocket Extension Configurations for this session.The negotiated WebSocket Sub-Protocol for this session.intThe parameter map (from URI Query) for the active session.The activeSec-WebSocket-Version(protocol version) in use.The Remote Socket Address for the connectionThe active connection's Request URI.Get the Write Timeoutprotected voidCan be overridden to scope into the correct classloader before calling application code.booleanbooleanisClosed()booleanbooleanbooleanbooleanbooleanbooleanbooleanisSecure()The active connection's Secure status indicator.voidonEof()voidProcess the incoming frame.voidonOpen()Open/Activate the session.voidprocessConnectionError(Throwable cause, Callback callback) Process an Error that originated from the connection.voidprocessHandlerError(Throwable cause, Callback callback) Process an Error that originated from the handler.voidA frame, and optional callback, intended for the network layer.voidsetAutoFragment(boolean autoFragment) voidsetClassLoader(ClassLoader classLoader) voidsetIdleTimeout(Duration timeout) Set the Idle Timeout.voidsetInputBufferSize(int inputBufferSize) voidsetMaxBinaryMessageSize(long maxSize) voidsetMaxFrameSize(long maxFrameSize) voidsetMaxOutgoingFrames(int maxOutgoingFrames) Set the maximum number of data frames allowed to be waiting to be sent at any one time.voidsetMaxTextMessageSize(long maxSize) voidsetOutputBufferSize(int outputBufferSize) voidsetWebSocketConnection(WebSocketConnection connection) voidsetWriteTimeout(Duration timeout) Set the Write Timeout.toString()
- 
Constructor Details- 
WebSocketCoreSessionpublic WebSocketCoreSession(FrameHandler handler, Behavior behavior, Negotiated negotiated, WebSocketComponents components) 
 
- 
- 
Method Details- 
getClassLoader
- 
setClassLoader
- 
handleCan be overridden to scope into the correct classloader before calling application code.- Parameters:
- runnable- the runnable to execute.
 
- 
isDemandingpublic boolean isDemanding()- Returns:
- True if the sessions handling is demanding.
 
- 
getExtensionStack
- 
getHandler
- 
getNegotiatedSubProtocolDescription copied from interface:CoreSessionThe negotiated WebSocket Sub-Protocol for this session.- Specified by:
- getNegotiatedSubProtocolin interface- CoreSession
- Returns:
- the negotiated WebSocket Sub-Protocol for this session.
 
- 
getIdleTimeoutDescription copied from interface:ConfigurationGet the Idle Timeout- Specified by:
- getIdleTimeoutin interface- Configuration
- Returns:
- the idle timeout
 
- 
setIdleTimeoutDescription copied from interface:ConfigurationSet the Idle Timeout.- Specified by:
- setIdleTimeoutin interface- Configuration
- Parameters:
- timeout- the timeout duration (timeout <= 0 implies an infinite timeout)
 
- 
getWriteTimeoutDescription copied from interface:ConfigurationGet the Write Timeout- Specified by:
- getWriteTimeoutin interface- Configuration
- Returns:
- the write timeout
 
- 
setWriteTimeoutDescription copied from interface:ConfigurationSet the Write Timeout.- Specified by:
- setWriteTimeoutin interface- Configuration
- Parameters:
- timeout- the timeout duration (timeout <= 0 implies an infinite timeout)
 
- 
getLocalAddressDescription copied from interface:CoreSessionThe Local Socket Address for the connectionDo not assume that this will return a InetSocketAddressin all cases. Use of various proxies, and even UnixSockets can result a SocketAddress being returned without supportingInetSocketAddress- Specified by:
- getLocalAddressin interface- CoreSession
- Returns:
- the SocketAddress for the local connection, or null if not supported by Session
 
- 
getRemoteAddressDescription copied from interface:CoreSessionThe Remote Socket Address for the connectionDo not assume that this will return a InetSocketAddressin all cases. Use of various proxies, and even UnixSockets can result a SocketAddress being returned without supportingInetSocketAddress- Specified by:
- getRemoteAddressin interface- CoreSession
- Returns:
- the SocketAddress for the remote connection, or null if not supported by Session
 
- 
isInputOpenpublic boolean isInputOpen()- Specified by:
- isInputOpenin interface- CoreSession
- Returns:
- True if the websocket is open inbound
 
- 
isOutputOpenpublic boolean isOutputOpen()- Specified by:
- isOutputOpenin interface- CoreSession
- Returns:
- True if the websocket is open outbound
 
- 
isClosedpublic boolean isClosed()
- 
setWebSocketConnection
- 
closeSend Close Frame with no payload.- Specified by:
- closein interface- CoreSession
- Parameters:
- callback- the callback on successful send of close frame
 
- 
closeSend Close Frame with specified Status Code and optional Reason- Specified by:
- closein interface- CoreSession
- Parameters:
- statusCode- a valid WebSocket status code
- reason- an optional reason phrase
- callback- the callback on successful send of close frame
 
- 
getByteBufferPool- Specified by:
- getByteBufferPoolin interface- CoreSession
- Returns:
- The shared ByteBufferPool
 
- 
onEofpublic void onEof()
- 
processConnectionErrorProcess an Error that originated from the connection. For protocol causes, send and abnormal close frame otherwise just close the connection.- Parameters:
- cause- the cause
- callback- the callback on completion of error handling
 
- 
processHandlerErrorProcess an Error that originated from the handler. Send an abnormal close frame to ensure connection is closed.- Parameters:
- cause- the cause
- callback- the callback on completion of error handling
 
- 
onOpenpublic void onOpen()Open/Activate the session.
- 
demandpublic void demand(long n) Description copied from interface:CoreSessionManage flow control by indicating demand for handling Frames. A call toFrameHandler.onFrame(Frame, Callback)will only be made if a corresponding demand has been signaled. It is an error to call this method ifFrameHandler.isDemanding()returns false.- Specified by:
- demandin interface- CoreSession
- Parameters:
- n- The number of frames that can be handled (in sequential calls to- FrameHandler.onFrame(Frame, Callback)). May not be negative.
 
- 
autoDemandpublic void autoDemand()
- 
isRsv1Usedpublic boolean isRsv1Used()- Specified by:
- isRsv1Usedin interface- CoreSession
- Returns:
- true if an extension has been negotiated which uses the RSV1 bit.
 
- 
isRsv2Usedpublic boolean isRsv2Used()- Specified by:
- isRsv2Usedin interface- CoreSession
- Returns:
- true if an extension has been negotiated which uses the RSV2 bit.
 
- 
isRsv3Usedpublic boolean isRsv3Used()- Specified by:
- isRsv3Usedin interface- CoreSession
- Returns:
- true if an extension has been negotiated which uses the RSV3 bit.
 
- 
getConnection
- 
getExecutor
- 
onFrameDescription copied from interface:IncomingFramesProcess the incoming frame. Note: if you need to hang onto any information from the frame, be sure to copy it, as the information contained in the Frame will be released and/or reused by the implementation. Failure of the callback will propagate the failure back to the CoreSessionto fail the connection and attempt to send a closeFrameif one has not been sent.- Specified by:
- onFramein interface- IncomingFrames
- Parameters:
- frame- the frame to process.
- callback- the read completion.
 
- 
sendFrameDescription copied from interface:OutgoingFramesA frame, and optional callback, intended for the network layer.Note: 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. - Specified by:
- sendFramein interface- OutgoingFrames
- Parameters:
- frame- the frame to eventually write to the network layer.
- callback- the callback to notify when the frame is written.
- batch- the batch mode requested by the sender.
 
- 
flushDescription copied from interface:CoreSessionIf using BatchMode.ON or BatchMode.AUTO, trigger a flush of enqueued / batched frames.- Specified by:
- flushin interface- CoreSession
- Parameters:
- callback- the callback to track close frame sent (or failed)
 
- 
abortpublic void abort()Description copied from interface:CoreSessionIssue a harsh abort of the underlying connection.This will terminate the connection, without sending a websocket close frame. No WebSocket Protocol close handshake will be performed. Once called, any read/write activity on the websocket from this point will be indeterminate. This can result in the FrameHandler.onError(Throwable, Callback)event being called indicating any issue that arises.Once the underlying connection has been determined to be closed, the FrameHandler.onClosed(CloseStatus, Callback)event will be called.- Specified by:
- abortin interface- CoreSession
 
- 
isAutoFragmentpublic boolean isAutoFragment()- Specified by:
- isAutoFragmentin interface- Configuration
 
- 
setAutoFragmentpublic void setAutoFragment(boolean autoFragment) - Specified by:
- setAutoFragmentin interface- Configuration
 
- 
getMaxFrameSizepublic long getMaxFrameSize()- Specified by:
- getMaxFrameSizein interface- Configuration
 
- 
setMaxFrameSizepublic void setMaxFrameSize(long maxFrameSize) - Specified by:
- setMaxFrameSizein interface- Configuration
 
- 
getOutputBufferSizepublic int getOutputBufferSize()- Specified by:
- getOutputBufferSizein interface- Configuration
 
- 
setOutputBufferSizepublic void setOutputBufferSize(int outputBufferSize) - Specified by:
- setOutputBufferSizein interface- Configuration
 
- 
getInputBufferSizepublic int getInputBufferSize()- Specified by:
- getInputBufferSizein interface- Configuration
 
- 
setInputBufferSizepublic void setInputBufferSize(int inputBufferSize) - Specified by:
- setInputBufferSizein interface- Configuration
 
- 
getMaxBinaryMessageSizepublic long getMaxBinaryMessageSize()- Specified by:
- getMaxBinaryMessageSizein interface- Configuration
 
- 
setMaxBinaryMessageSizepublic void setMaxBinaryMessageSize(long maxSize) - Specified by:
- setMaxBinaryMessageSizein interface- Configuration
 
- 
getMaxTextMessageSizepublic long getMaxTextMessageSize()- Specified by:
- getMaxTextMessageSizein interface- Configuration
 
- 
setMaxTextMessageSizepublic void setMaxTextMessageSize(long maxSize) - Specified by:
- setMaxTextMessageSizein interface- Configuration
 
- 
getMaxOutgoingFramespublic int getMaxOutgoingFrames()Description copied from interface:ConfigurationGet the maximum number of data frames allowed to be waiting to be sent at any one time. The default value is -1, this indicates there is no limit on how many frames can be queued to be sent by the implementation. If the limit is exceeded, subsequent frames sent are failed with aWritePendingExceptionbut the connection is not failed and will remain open.- Specified by:
- getMaxOutgoingFramesin interface- Configuration
- Returns:
- the max number of frames.
 
- 
setMaxOutgoingFramespublic void setMaxOutgoingFrames(int maxOutgoingFrames) Description copied from interface:ConfigurationSet the maximum number of data frames allowed to be waiting to be sent at any one time. The default value is -1, this indicates there is no limit on how many frames can be queued to be sent by the implementation. If the limit is exceeded, subsequent frames sent are failed with aWritePendingExceptionbut the connection is not failed and will remain open.- Specified by:
- setMaxOutgoingFramesin interface- Configuration
- Parameters:
- maxOutgoingFrames- the max number of frames.
 
- 
dump
- 
dumpDescription copied from interface:DumpableDump 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:
- dumpin interface- Dumpable
- Parameters:
- out- The appendable to dump to
- indent- The indent to apply after any new lines.
- Throws:
- IOException- if unable to write to Appendable
 
- 
getNegotiatedExtensionsDescription copied from interface:CoreSessionThe negotiated WebSocket Extension Configurations for this session.- Specified by:
- getNegotiatedExtensionsin interface- CoreSession
- Returns:
- the list of Negotiated Extension Configurations for this session.
 
- 
getParameterMapDescription copied from interface:CoreSessionThe parameter map (from URI Query) for the active session.- Specified by:
- getParameterMapin interface- CoreSession
- Returns:
- the immutable map of parameters
 
- 
getProtocolVersionDescription copied from interface:CoreSessionThe activeSec-WebSocket-Version(protocol version) in use.- Specified by:
- getProtocolVersionin interface- CoreSession
- Returns:
- the protocol version in use.
 
- 
getRequestURIDescription copied from interface:CoreSessionThe active connection's Request URI. This is the URI of the upgrade request and is typically http: or https: rather than the ws: or wss: scheme.- Specified by:
- getRequestURIin interface- CoreSession
- Returns:
- the absolute URI (including Query string)
 
- 
isSecurepublic boolean isSecure()Description copied from interface:CoreSessionThe active connection's Secure status indicator.- Specified by:
- isSecurein interface- CoreSession
- Returns:
- true if connection is secure (similar in role to HttpServletRequest.isSecure())
 
- 
getBehavior- Specified by:
- getBehaviorin interface- CoreSession
- Returns:
- Client or Server behaviour
 
- 
getWebSocketComponents- Specified by:
- getWebSocketComponentsin interface- CoreSession
- Returns:
- the WebSocketComponents instance in use for this Connection.
 
- 
toString
 
-