Top Description Inners Fields Constructors Methods
io.undertow.websockets.core.protocol.version07

public Class WebSocket07Channel

extends WebSocketChannel
Class Inheritance
Known Direct Subclasses
io.undertow.websockets.core.protocol.version08.WebSocket08Channel, io.undertow.websockets.core.protocol.version13.WebSocket13Channel
Imports
io.undertow.server.protocol.framed.AbstractFramedStreamSourceChannel, io.undertow.websockets.core.StreamSinkFrameChannel, .StreamSourceFrameChannel, .WebSocketChannel, .WebSocketException, .WebSocketFrame, .WebSocketFrameCorruptedException, .WebSocketFrameType, .WebSocketLogger, .WebSocketMessages, .WebSocketVersion, io.undertow.websockets.extensions.ExtensionFunction, org.xnio.IoUtils, .OptionMap, .StreamConnection, io.undertow.connector.ByteBufferPool, .PooledByteBuffer, java.nio.ByteBuffer, java.util.Set

WebSocketChannel which is used for WebSocketVersion#V08
Author
Norman Maurer

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
pack-priv class

Field Summary

Modifier and TypeField and Description
private UTF8Checker
private int
private final ByteBuffer
protected static final byte
protected static final byte
protected static final byte
protected static final byte
protected static final byte
protected static final byte
Inherited from io.undertow.websockets.core.WebSocketChannel:
extensionFunctionextensionsSupportedfragmentedChannelhasReservedOpCode

Constructor Summary

AccessConstructor and Description
public
WebSocket07Channel(StreamConnection
The StreamConnection over which the WebSocket Frames should get send and received. Be aware that it already must be "upgraded".
channel
,
ByteBufferPool
The ByteBufferPool which will be used to acquire ByteBuffer's from.
bufferPool
,
String
The url for which the WebSocket07Channel was created.
wsUrl
,
String subProtocol, final boolean client, boolean allowExtensions, final ExtensionFunction extensionFunction, Set<WebSocketChannel> openConnections, OptionMap options)

Create a new WebSocket07Channel

Method Summary

Modifier and TypeMethod and Description
protected void
closeSubChannels()

Implements abstract io.undertow.server.protocol.framed.AbstractFramedChannel.closeSubChannels.

Method that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.

protected StreamSinkFrameChannel
createStreamSinkChannel(WebSocketFrameType
The WebSocketFrameType of the WebSocketFrame which will be send over this StreamSinkFrameChannel
type
)

Implements abstract io.undertow.websockets.core.WebSocketChannel.createStreamSinkChannel.

Create a new StreamSinkFrameChannel which can be used to send a WebSocket Frame of the type WebSocketFrameType.

protected void
markReadsBroken(Throwable
The possibly null cause
cause
)

Overrides io.undertow.websockets.core.WebSocketChannel.markReadsBroken.

Called when a source sub channel fails to fulfil its contract, and leaves the channel in an inconsistent state.

protected WebSocketChannel.PartialFrame
receiveFrame()

Implements abstract io.undertow.websockets.core.WebSocketChannel.receiveFrame.

Create a new io.undertow.websockets.core.StreamSourceFrameChannel which can be used to read the data of the received Frame

Inherited from io.undertow.websockets.core.WebSocketChannel:
areExtensionsSupportedcreateChannelcreateIdleTimeoutChannelgetAttributegetCloseCodegetCloseReasongetDestinationAddressgetExtensionFunctiongetFramePrioritygetPeerConnectionsgetReceiversgetRequestSchemegetSourceAddressgetSubProtocolgetSubProtocolsgetUrlgetVersionhandleBrokenSinkChannelhandleBrokenSourceChannelisClientisCloseFrameReceivedisCloseFrameSentisCloseInitiatedByRemotePeerisLastFrameReceivedisLastFrameSentisReadsBrokenisSecurelastDataReadparseFramesendsendClosesetAttributesetCloseCodesetCloseReason

Field Detail

checkerback to summary
private UTF8Checker checker
fragmentedFramesCountback to summary
private int fragmentedFramesCount
lengthBufferback to summary
private final ByteBuffer lengthBuffer
OPCODE_BINARYback to summary
protected static final byte OPCODE_BINARY
OPCODE_CLOSEback to summary
protected static final byte OPCODE_CLOSE
OPCODE_CONTback to summary
protected static final byte OPCODE_CONT
OPCODE_PINGback to summary
protected static final byte OPCODE_PING
OPCODE_PONGback to summary
protected static final byte OPCODE_PONG
OPCODE_TEXTback to summary
protected static final byte OPCODE_TEXT

Constructor Detail

WebSocket07Channelback to summary
public WebSocket07Channel(StreamConnection channel, ByteBufferPool bufferPool, String wsUrl, String subProtocol, final boolean client, boolean allowExtensions, final ExtensionFunction extensionFunction, Set<WebSocketChannel> openConnections, OptionMap options)

Create a new WebSocket07Channel

Parameters
channel:StreamConnection

The StreamConnection over which the WebSocket Frames should get send and received. Be aware that it already must be "upgraded".

bufferPool:ByteBufferPool

The ByteBufferPool which will be used to acquire ByteBuffer's from.

wsUrl:String

The url for which the WebSocket07Channel was created.

Method Detail

closeSubChannelsback to summary
protected void closeSubChannels()

Implements abstract io.undertow.server.protocol.framed.AbstractFramedChannel.closeSubChannels.

Doc from io.undertow.server.protocol.framed.AbstractFramedChannel.closeSubChannels.

Method that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.

Annotations
@Override
createStreamSinkChannelback to summary
protected StreamSinkFrameChannel createStreamSinkChannel(WebSocketFrameType type)

Implements abstract io.undertow.websockets.core.WebSocketChannel.createStreamSinkChannel.

Doc from io.undertow.websockets.core.WebSocketChannel.createStreamSinkChannel.

Create a new StreamSinkFrameChannel which can be used to send a WebSocket Frame of the type WebSocketFrameType.

Parameters
type:WebSocketFrameType

The WebSocketFrameType of the WebSocketFrame which will be send over this StreamSinkFrameChannel

Annotations
@Override
markReadsBrokenback to summary
protected void markReadsBroken(Throwable cause)

Overrides io.undertow.websockets.core.WebSocketChannel.markReadsBroken.

Doc from io.undertow.server.protocol.framed.AbstractFramedChannel.markReadsBroken.

Called when a source sub channel fails to fulfil its contract, and leaves the channel in an inconsistent state.

The underlying read side will be forcibly closed.

Parameters
cause:Throwable

The possibly null cause

Annotations
@Override
receiveFrameback to summary
protected WebSocketChannel.PartialFrame receiveFrame()

Implements abstract io.undertow.websockets.core.WebSocketChannel.receiveFrame.

Doc from io.undertow.websockets.core.WebSocketChannel.receiveFrame.

Create a new io.undertow.websockets.core.StreamSourceFrameChannel which can be used to read the data of the received Frame

Returns:WebSocketChannel.PartialFrame

channel A io.undertow.websockets.core.StreamSourceFrameChannel will be used to read a Frame from. This will return null if the right io.undertow.websockets.core.StreamSourceFrameChannel could not be detected with the given buffer and so more data is needed.

Annotations
@Override
io.undertow.websockets.core.protocol.version07 back to summary

private final Enum WebSocket07Channel.State

extends Enum<WebSocket07Channel.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State
public static final WebSocket07Channel.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static WebSocket07Channel.State
public static WebSocket07Channel.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DONEback to summary
public static final WebSocket07Channel.State DONE
READING_EXTENDED_SIZE1back to summary
public static final WebSocket07Channel.State READING_EXTENDED_SIZE1
READING_EXTENDED_SIZE2back to summary
public static final WebSocket07Channel.State READING_EXTENDED_SIZE2
READING_EXTENDED_SIZE3back to summary
public static final WebSocket07Channel.State READING_EXTENDED_SIZE3
READING_EXTENDED_SIZE4back to summary
public static final WebSocket07Channel.State READING_EXTENDED_SIZE4
READING_EXTENDED_SIZE5back to summary
public static final WebSocket07Channel.State READING_EXTENDED_SIZE5
READING_EXTENDED_SIZE6back to summary
public static final WebSocket07Channel.State READING_EXTENDED_SIZE6
READING_EXTENDED_SIZE7back to summary
public static final WebSocket07Channel.State READING_EXTENDED_SIZE7
READING_EXTENDED_SIZE8back to summary
public static final WebSocket07Channel.State READING_EXTENDED_SIZE8
READING_FIRSTback to summary
public static final WebSocket07Channel.State READING_FIRST
READING_MASK_1back to summary
public static final WebSocket07Channel.State READING_MASK_1
READING_MASK_2back to summary
public static final WebSocket07Channel.State READING_MASK_2
READING_MASK_3back to summary
public static final WebSocket07Channel.State READING_MASK_3
READING_MASK_4back to summary
public static final WebSocket07Channel.State READING_MASK_4
READING_SECONDback to summary
public static final WebSocket07Channel.State READING_SECOND

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static WebSocket07Channel.State valueOf(String name)
valuesback to summary
public static WebSocket07Channel.State[] values()
io.undertow.websockets.core.protocol.version07 back to summary

pack-priv Class WebSocket07Channel.WebSocketFrameHeader

extends Object
implements WebSocketFrame
Class Inheritance
  • java.lang.Object
  • io.undertow.websockets.core.protocol.version07.WebSocket07Channel.WebSocketFrameHeader
All Implemented Interfaces
io.undertow.websockets.core.WebSocketFrame, io.undertow.websockets.core.WebSocketChannel.PartialFrame, io.undertow.server.protocol.framed.FrameHeaderData

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean
private int
private int
private long
private int
private int
private WebSocket07Channel.State

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public StreamSourceFrameChannel
public StreamSourceFrameChannel
public AbstractFramedStreamSourceChannel<?, ?, ?>
public long
pack-priv int
public void
handle(final ByteBuffer buffer)

Implements io.undertow.websockets.core.WebSocketChannel.PartialFrame.handle.

Handles the data, any remaining data will be pushed back

public boolean
public boolean
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

doneback to summary
private boolean done
frameFinalFlagback to summary
private boolean frameFinalFlag
frameMaskedback to summary
private boolean frameMasked
frameOpcodeback to summary
private int frameOpcode
framePayloadLen1back to summary
private int framePayloadLen1
framePayloadLengthback to summary
private long framePayloadLength
frameRsvback to summary
private int frameRsv
maskingKeyback to summary
private int maskingKey
stateback to summary
private WebSocket07Channel.State state

Constructor Detail

WebSocketFrameHeaderback to summary
pack-priv WebSocketFrameHeader()

Method Detail

createChannelback to summary
public StreamSourceFrameChannel createChannel(PooledByteBuffer pooled)
getChannelback to summary
public StreamSourceFrameChannel getChannel(PooledByteBuffer pooled)

Implements io.undertow.websockets.core.WebSocketChannel.PartialFrame.getChannel.

Returns:StreamSourceFrameChannel

Doc from io.undertow.websockets.core.WebSocketChannel.PartialFrame.getChannel.

The channel, or null if the channel is not available yet

Annotations
@Override
getExistingChannelback to summary
public AbstractFramedStreamSourceChannel<?, ?, ?> getExistingChannel()

Implements io.undertow.server.protocol.framed.FrameHeaderData.getExistingChannel.

Annotations
@Override
getFrameLengthback to summary
public long getFrameLength()

Implements io.undertow.server.protocol.framed.FrameHeaderData.getFrameLength.

Annotations
@Override
getMaskingKeyback to summary
pack-priv int getMaskingKey()
handleback to summary
public void handle(final ByteBuffer buffer) throws WebSocketException

Implements io.undertow.websockets.core.WebSocketChannel.PartialFrame.handle.

Doc from io.undertow.websockets.core.WebSocketChannel.PartialFrame.handle.

Handles the data, any remaining data will be pushed back

Annotations
@Override
isDoneback to summary
public boolean isDone()

Implements io.undertow.websockets.core.WebSocketChannel.PartialFrame.isDone.

Returns:boolean

Doc from io.undertow.websockets.core.WebSocketChannel.PartialFrame.isDone.

true if the channel is available

Annotations
@Override
isFinalFragmentback to summary
public boolean isFinalFragment()

Implements io.undertow.websockets.core.WebSocketFrame.isFinalFragment.

Annotations
@Override
validateControlFrameback to summary
private void validateControlFrame() throws WebSocketFrameCorruptedException
validateDataFrameback to summary
private void validateDataFrame() throws WebSocketFrameCorruptedException