org.eclipse.jetty.websocket

## Class WebSocketConnectionD00

- java.lang.Object
- - org.eclipse.jetty.io.AbstractConnection
  - - org.eclipse.jetty.websocket.WebSocketConnectionD00

- All Implemented Interfaces:
    Connection, AsyncConnection, WebSocket.Connection, WebSocket.FrameConnection, WebSocketConnection
  Direct Known Subclasses:
    WebSocketServletConnectionD00

      public class WebSocketConnectionD00
      extends AbstractConnection
      implements WebSocketConnection, WebSocket.FrameConnection

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static byte` | `LENGTH_FRAME`
    `static byte` | `SENTINEL_FRAME`

    - ### Fields inherited from class org.eclipse.jetty.io.AbstractConnection

      `_endp`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebSocketConnectionD00(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte` | `binaryOpcode()`
    `void` | `close()` Close the connection with normal close code.
    `void` | `close(int code, String message)` Close the connection with specific closeCode and message.
    `byte` | `continuationOpcode()`
    `void` | `disconnect()`
    `static byte[]` | `doTheHixieHixieShake(long key1, long key2, byte[] key3)`
    `void` | `fillBuffersFrom(Buffer buffer)`
    `byte` | `finMask()`
    `WebSocket.Connection` | `getConnection()`
    `List<Extension>` | `getExtensions()`
    `int` | `getMaxBinaryMessageSize()` Size in bytes of the maximum binary message to be received
    `int` | `getMaxIdleTime()`
    `int` | `getMaxTextMessageSize()` Size in characters of the maximum text message to be received
    `String` | `getProtocol()`
    `Connection` | `handle()` Handle the connection.
    `boolean` | `isAllowFrameFragmentation()`
    `boolean` | `isBinary(byte opcode)`
    `boolean` | `isClose(byte opcode)`
    `boolean` | `isContinuation(byte opcode)`
    `boolean` | `isControl(byte opcode)`
    `boolean` | `isIdle()`
    `boolean` | `isMessageComplete(byte flags)`
    `boolean` | `isMore(byte flags)`
    `boolean` | `isOpen()`
    `boolean` | `isPing(byte opcode)`
    `boolean` | `isPong(byte opcode)`
    `boolean` | `isSuspended()` The semantic of this method is to return true to indicate interest in further reads, or false otherwise, but it is misnamed and should be really called `isReadInterested()`.
    `boolean` | `isText(byte opcode)`
    `void` | `onClose()` Called after the connection is closed
    `protected void` | `onFrameHandshake()`
    `void` | `onInputShutdown()`
    `protected void` | `onWebsocketOpen()`
    `void` | `sendControl(byte code, byte[] content, int offset, int length)` Send a control frame
    `void` | `sendFrame(byte flags, byte opcode, byte[] content, int offset, int length)` Send an arbitrary frame
    `void` | `sendMessage(byte[] data, int offset, int length)`
    `void` | `sendMessage(String content)`
    `void` | `setAllowFrameFragmentation(boolean allowFragmentation)` Set if frames larger than the frame buffer are handled with local fragmentations
    `void` | `setHixieKeys(String key1, String key2)`
    `void` | `setMaxBinaryMessageSize(int size)`
    `void` | `setMaxIdleTime(int ms)`
    `void` | `setMaxTextMessageSize(int size)`
    `void` | `shutdown()`
    `byte` | `textOpcode()`

    - ### Methods inherited from class org.eclipse.jetty.io.AbstractConnection

      `getEndPoint, getTimeStamp, onIdleExpired, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.jetty.io.Connection

      `getTimeStamp, onIdleExpired`

- - ### Field Detail

    - #### LENGTH_FRAME

          public static final byte LENGTH_FRAME

      See Also:
        Constant Field Values

    - #### SENTINEL_FRAME

          public static final byte SENTINEL_FRAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### WebSocketConnectionD00

          public WebSocketConnectionD00(WebSocket websocket,
                                EndPoint endpoint,
                                WebSocketBuffers buffers,
                                long timestamp,
                                int maxIdleTime,
                                String protocol)
                                 throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### getConnection

          public WebSocket.Connection getConnection()

      Specified by:
        `getConnection` in interface `WebSocketConnection`

    - #### setHixieKeys

          public void setHixieKeys(String key1,
                          String key2)

    - #### handle

          public Connection handle()
                            throws IOException

      Description copied from interface: `Connection`
      Handle the connection.
      Specified by:
        `handle` in interface `Connection`
      Returns:
        The Connection to use for the next handling of the connection. This allows protocol upgrades and support for CONNECT.
      Throws:
        `IOException` - if the handling of I/O operations fail

    - #### onInputShutdown

          public void onInputShutdown()
                               throws IOException

      Specified by:
        `onInputShutdown` in interface `AsyncConnection`
      Throws:
        `IOException`

    - #### isOpen

          public boolean isOpen()

      Specified by:
        `isOpen` in interface `WebSocket.Connection`

    - #### isIdle

          public boolean isIdle()

      Specified by:
        `isIdle` in interface `Connection`
      Returns:
        whether this connection is idle, that is not parsing and not generating
      See Also:
        `Connection.onIdleExpired(long)`

    - #### isSuspended

          public boolean isSuspended()

      Description copied from interface: `Connection`

      The semantic of this method is to return true to indicate interest in further reads, or false otherwise, but it is misnamed and should be really called `isReadInterested()`.

      Specified by:
        `isSuspended` in interface `Connection`
      Returns:
        true to indicate interest in further reads, false otherwise

    - #### onClose

          public void onClose()

      Description copied from interface: `Connection`
      Called after the connection is closed
      Specified by:
        `onClose` in interface `Connection`

    - #### sendMessage

          public void sendMessage(String content)
                           throws IOException

      Specified by:
        `sendMessage` in interface `WebSocket.Connection`
      Throws:
        `IOException`

    - #### sendMessage

          public void sendMessage(byte[] data,
                         int offset,
                         int length)
                           throws IOException

      Specified by:
        `sendMessage` in interface `WebSocket.Connection`
      Throws:
        `IOException`

    - #### isMore

          public boolean isMore(byte flags)

    - #### sendControl

          public void sendControl(byte code,
                         byte[] content,
                         int offset,
                         int length)
                           throws IOException

      Send a control frame
      Specified by:
        `sendControl` in interface `WebSocket.FrameConnection`
      Throws:
        `IOException`

    - #### sendFrame

          public void sendFrame(byte flags,
                       byte opcode,
                       byte[] content,
                       int offset,
                       int length)
                         throws IOException

      Description copied from interface: `WebSocket.FrameConnection`
      Send an arbitrary frame
      Specified by:
        `sendFrame` in interface `WebSocket.FrameConnection`
      Throws:
        `IOException`

    - #### close

          public void close(int code,
                   String message)

      Description copied from interface: `WebSocket.Connection`
      Close the connection with specific closeCode and message.
      Specified by:
        `close` in interface `WebSocket.Connection`
      Parameters:
        `code` - The close code to send, or -1 for no close code
        `message` - The message to send or null for no message

    - #### disconnect

          public void disconnect()

      Specified by:
        `disconnect` in interface `WebSocket.Connection`

    - #### close

          public void close()

      Description copied from interface: `WebSocket.Connection`
      Close the connection with normal close code.
      Specified by:
        `close` in interface `WebSocket.Connection`

    - #### shutdown

          public void shutdown()

      Specified by:
        `shutdown` in interface `WebSocketConnection`

    - #### fillBuffersFrom

          public void fillBuffersFrom(Buffer buffer)

      Specified by:
        `fillBuffersFrom` in interface `WebSocketConnection`

    - #### doTheHixieHixieShake

          public static byte[] doTheHixieHixieShake(long key1,
                                    long key2,
                                    byte[] key3)

    - #### setMaxTextMessageSize

          public void setMaxTextMessageSize(int size)

      Specified by:
        `setMaxTextMessageSize` in interface `WebSocket.Connection`
      Parameters:
        `size` - size<0 No aggregation of frames to messages, >=0 max size of text frame aggregation buffer in characters

    - #### setMaxIdleTime

          public void setMaxIdleTime(int ms)

      Specified by:
        `setMaxIdleTime` in interface `WebSocket.Connection`
      Parameters:
        `ms` - The time in ms that the connection can be idle before closing

    - #### setMaxBinaryMessageSize

          public void setMaxBinaryMessageSize(int size)

      Specified by:
        `setMaxBinaryMessageSize` in interface `WebSocket.Connection`
      Parameters:
        `size` - size<0 no aggregation of binary frames, >=0 size of binary frame aggregation buffer

    - #### getMaxTextMessageSize

          public int getMaxTextMessageSize()

      Description copied from interface: `WebSocket.Connection`
      Size in characters of the maximum text message to be received
      Specified by:
        `getMaxTextMessageSize` in interface `WebSocket.Connection`
      Returns:
        size <0 No aggregation of frames to messages, >=0 max size of text frame aggregation buffer in characters

    - #### getMaxIdleTime

          public int getMaxIdleTime()

      Specified by:
        `getMaxIdleTime` in interface `WebSocket.Connection`
      Returns:
        The time in ms that the connection can be idle before closing

    - #### getMaxBinaryMessageSize

          public int getMaxBinaryMessageSize()

      Description copied from interface: `WebSocket.Connection`
      Size in bytes of the maximum binary message to be received
      Specified by:
        `getMaxBinaryMessageSize` in interface `WebSocket.Connection`
      Returns:
        size <0 no aggregation of binary frames, >=0 size of binary frame aggregation buffer

    - #### getProtocol

          public String getProtocol()

      Specified by:
        `getProtocol` in interface `WebSocket.Connection`

    - #### onFrameHandshake

          protected void onFrameHandshake()

    - #### onWebsocketOpen

          protected void onWebsocketOpen()

    - #### isMessageComplete

          public boolean isMessageComplete(byte flags)

      Specified by:
        `isMessageComplete` in interface `WebSocket.FrameConnection`
      Parameters:
        `flags` - The flags bytes of a frame
      Returns:
        True of the flags indicate a final frame.

    - #### binaryOpcode

          public byte binaryOpcode()

      Specified by:
        `binaryOpcode` in interface `WebSocket.FrameConnection`
      Returns:
        The opcode of a binary message

    - #### textOpcode

          public byte textOpcode()

      Specified by:
        `textOpcode` in interface `WebSocket.FrameConnection`
      Returns:
        The opcode of a text message

    - #### isControl

          public boolean isControl(byte opcode)

      Specified by:
        `isControl` in interface `WebSocket.FrameConnection`
      Returns:
        True if the opcode is for a control frame

    - #### isText

          public boolean isText(byte opcode)

      Specified by:
        `isText` in interface `WebSocket.FrameConnection`
      Returns:
        True if the opcode is for a text frame

    - #### isBinary

          public boolean isBinary(byte opcode)

      Specified by:
        `isBinary` in interface `WebSocket.FrameConnection`
      Returns:
        True if the opcode is for a binary frame

    - #### isContinuation

          public boolean isContinuation(byte opcode)

      Specified by:
        `isContinuation` in interface `WebSocket.FrameConnection`
      Returns:
        True if the opcode is for a continuation frame

    - #### isClose

          public boolean isClose(byte opcode)

      Specified by:
        `isClose` in interface `WebSocket.FrameConnection`
      Returns:
        True if the opcode is a close control

    - #### isPing

          public boolean isPing(byte opcode)

      Specified by:
        `isPing` in interface `WebSocket.FrameConnection`
      Returns:
        True if the opcode is a ping control

    - #### isPong

          public boolean isPong(byte opcode)

      Specified by:
        `isPong` in interface `WebSocket.FrameConnection`
      Returns:
        True if the opcode is a pong control

    - #### getExtensions

          public List<Extension> getExtensions()

      Specified by:
        `getExtensions` in interface `WebSocketConnection`

    - #### continuationOpcode

          public byte continuationOpcode()

      Specified by:
        `continuationOpcode` in interface `WebSocket.FrameConnection`
      Returns:
        The opcode of a continuation frame

    - #### finMask

          public byte finMask()

      Specified by:
        `finMask` in interface `WebSocket.FrameConnection`
      Returns:
        Mask for the FIN bit.

    - #### setAllowFrameFragmentation

          public void setAllowFrameFragmentation(boolean allowFragmentation)

      Description copied from interface: `WebSocket.FrameConnection`
      Set if frames larger than the frame buffer are handled with local fragmentations
      Specified by:
        `setAllowFrameFragmentation` in interface `WebSocket.FrameConnection`

    - #### isAllowFrameFragmentation

          public boolean isAllowFrameFragmentation()

      Specified by:
        `isAllowFrameFragmentation` in interface `WebSocket.FrameConnection`
      Returns:
        True if frames larger than the frame buffer are fragmented.

Copyright © 1995-2016 Mort Bay Consulting. All Rights Reserved.