org.eclipse.jetty.websocket
Class WebSocketConnectionD00

java.lang.Object
  extended by org.eclipse.jetty.io.AbstractConnection
      extended by org.eclipse.jetty.websocket.WebSocketConnectionD00
All Implemented Interfaces:
Connection, WebSocket.Connection, WebSocket.FrameConnection, WebSocketConnection

public class WebSocketConnectionD00
extends AbstractConnection
implements WebSocketConnection, WebSocket.FrameConnection


Field Summary
static byte LENGTH_FRAME
           
static byte SENTINEL_FRAME
           
 
Fields inherited from class org.eclipse.jetty.io.AbstractConnection
_endp
 
Constructor Summary
WebSocketConnectionD00(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, int maxIdleTime, String protocol)
           
 
Method Summary
 byte binaryOpcode()
           
 void close(int code, String message)
           
 void closed()
          Called when the connection is closed
 void disconnect()
           
static byte[] doTheHixieHixieShake(long key1, long key2, byte[] key3)
           
 void fillBuffersFrom(Buffer buffer)
           
 int getMaxBinaryMessageSize()
          Size in bytes of the maximum binary message to be received
 int getMaxTextMessageSize()
          Size in characters of the maximum text message to be received
 String getProtocol()
           
 Connection handle()
          Handle the connection.
 void handshake(HttpServletRequest request, HttpServletResponse response, String origin, String subprotocol)
           
 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()
           
 boolean isText(byte opcode)
           
 void sendControl(byte code, byte[] content, int offset, int length)
          
 void sendFrame(byte flags, byte opcode, byte[] content, int offset, int length)
           
 void sendMessage(byte[] data, int offset, int length)
           
 void sendMessage(String content)
           
 void setHixieKeys(String key1, String key2)
           
 void setMaxBinaryMessageSize(int size)
           
 void setMaxTextMessageSize(int size)
           
 byte textOpcode()
           
 
Methods inherited from class org.eclipse.jetty.io.AbstractConnection
getEndPoint, getTimeStamp, idleExpired, 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, idleExpired
 

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

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

isOpen

public boolean isOpen()
Specified by:
isOpen in interface WebSocket.Connection

isIdle

public boolean isIdle()
Specified by:
isIdle in interface Connection

isSuspended

public boolean isSuspended()
Specified by:
isSuspended in interface Connection

closed

public void closed()
Description copied from interface: Connection
Called when the connection is closed

Specified by:
closed 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

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
Specified by:
sendFrame in interface WebSocket.FrameConnection
Throws:
IOException

close

public void close(int code,
                  String message)
Specified by:
close in interface WebSocket.FrameConnection

disconnect

public void disconnect()
Specified by:
disconnect in interface WebSocket.Connection

fillBuffersFrom

public void fillBuffersFrom(Buffer buffer)
Specified by:
fillBuffersFrom in interface WebSocketConnection

doTheHixieHixieShake

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

handshake

public void handshake(HttpServletRequest request,
                      HttpServletResponse response,
                      String origin,
                      String subprotocol)
               throws IOException
Specified by:
handshake in interface WebSocketConnection
Throws:
IOException

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

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

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

isMessageComplete

public boolean isMessageComplete(byte flags)
Specified by:
isMessageComplete in interface WebSocket.FrameConnection

binaryOpcode

public byte binaryOpcode()
Specified by:
binaryOpcode in interface WebSocket.FrameConnection

textOpcode

public byte textOpcode()
Specified by:
textOpcode in interface WebSocket.FrameConnection

isControl

public boolean isControl(byte opcode)
Specified by:
isControl in interface WebSocket.FrameConnection

isText

public boolean isText(byte opcode)
Specified by:
isText in interface WebSocket.FrameConnection

isBinary

public boolean isBinary(byte opcode)
Specified by:
isBinary in interface WebSocket.FrameConnection

isContinuation

public boolean isContinuation(byte opcode)
Specified by:
isContinuation in interface WebSocket.FrameConnection

isClose

public boolean isClose(byte opcode)
Specified by:
isClose in interface WebSocket.FrameConnection

isPing

public boolean isPing(byte opcode)
Specified by:
isPing in interface WebSocket.FrameConnection

isPong

public boolean isPong(byte opcode)
Specified by:
isPong in interface WebSocket.FrameConnection


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