Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project
This commit is contained in:
commit
b2849e36c6
|
@ -112,7 +112,6 @@ public interface WebSocket
|
||||||
void disconnect();
|
void disconnect();
|
||||||
boolean isOpen();
|
boolean isOpen();
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param ms The time in ms that the connection can be idle before closing
|
* @param ms The time in ms that the connection can be idle before closing
|
||||||
*/
|
*/
|
||||||
|
@ -128,7 +127,6 @@ public interface WebSocket
|
||||||
*/
|
*/
|
||||||
void setMaxBinaryMessageSize(int size);
|
void setMaxBinaryMessageSize(int size);
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @return The time in ms that the connection can be idle before closing
|
* @return The time in ms that the connection can be idle before closing
|
||||||
*/
|
*/
|
||||||
|
@ -150,30 +148,113 @@ public interface WebSocket
|
||||||
/**
|
/**
|
||||||
* Frame Level Connection
|
* Frame Level Connection
|
||||||
* <p>The Connection interface at the level of sending/receiving frames rather than messages.
|
* <p>The Connection interface at the level of sending/receiving frames rather than messages.
|
||||||
|
* Also contains methods to decode/generate flags and opcodes without using constants, so that
|
||||||
|
* code can be written to work with multiple drafts of the protocol.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface FrameConnection extends Connection
|
public interface FrameConnection extends Connection
|
||||||
{
|
{
|
||||||
boolean isMessageComplete(byte flags);
|
/** Close the connection with specific closeCode and message.
|
||||||
|
* @param closeCode
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
void close(int closeCode,String message);
|
void close(int closeCode,String message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The opcode of a binary message
|
||||||
|
*/
|
||||||
byte binaryOpcode();
|
byte binaryOpcode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The opcode of a text message
|
||||||
|
*/
|
||||||
byte textOpcode();
|
byte textOpcode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The opcode of a continuation frame
|
||||||
|
*/
|
||||||
byte continuationOpcode();
|
byte continuationOpcode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Mask for the FIN bit.
|
||||||
|
*/
|
||||||
byte finMask();
|
byte finMask();
|
||||||
String getProtocol();
|
|
||||||
|
/** Set if frames larger than the frame buffer are handled with local fragmentations
|
||||||
|
* @param allowFragmentation
|
||||||
|
*/
|
||||||
void setAllowFrameFragmentation(boolean allowFragmentation);
|
void setAllowFrameFragmentation(boolean allowFragmentation);
|
||||||
|
|
||||||
boolean isAllowFrameFragmentation();
|
/**
|
||||||
|
* @param flags The flags bytes of a frame
|
||||||
|
* @return True of the flags indicate a final frame.
|
||||||
|
*/
|
||||||
|
boolean isMessageComplete(byte flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opcode
|
||||||
|
* @return True if the opcode is for a control frame
|
||||||
|
*/
|
||||||
boolean isControl(byte opcode);
|
boolean isControl(byte opcode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opcode
|
||||||
|
* @return True if the opcode is for a text frame
|
||||||
|
*/
|
||||||
boolean isText(byte opcode);
|
boolean isText(byte opcode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opcode
|
||||||
|
* @return True if the opcode is for a binary frame
|
||||||
|
*/
|
||||||
boolean isBinary(byte opcode);
|
boolean isBinary(byte opcode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opcode
|
||||||
|
* @return True if the opcode is for a continuation frame
|
||||||
|
*/
|
||||||
boolean isContinuation(byte opcode);
|
boolean isContinuation(byte opcode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opcode
|
||||||
|
* @return True if the opcode is a close control
|
||||||
|
*/
|
||||||
boolean isClose(byte opcode);
|
boolean isClose(byte opcode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opcode
|
||||||
|
* @return True if the opcode is a ping control
|
||||||
|
*/
|
||||||
boolean isPing(byte opcode);
|
boolean isPing(byte opcode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opcode
|
||||||
|
* @return True if the opcode is a pong control
|
||||||
|
*/
|
||||||
boolean isPong(byte opcode);
|
boolean isPong(byte opcode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return True if frames larger than the frame buffer are fragmented.
|
||||||
|
*/
|
||||||
|
boolean isAllowFrameFragmentation();
|
||||||
|
|
||||||
|
/** Send a control frame
|
||||||
|
* @param control
|
||||||
|
* @param data
|
||||||
|
* @param offset
|
||||||
|
* @param length
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
void sendControl(byte control,byte[] data, int offset, int length) throws IOException;
|
void sendControl(byte control,byte[] data, int offset, int length) throws IOException;
|
||||||
|
|
||||||
|
/** Send an arbitrary frame
|
||||||
|
* @param flags
|
||||||
|
* @param opcode
|
||||||
|
* @param data
|
||||||
|
* @param offset
|
||||||
|
* @param length
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
void sendFrame(byte flags,byte opcode,byte[] data, int offset, int length) throws IOException;
|
void sendFrame(byte flags,byte opcode,byte[] data, int offset, int length) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,7 +616,7 @@ public class WebSocketConnectionD13 extends AbstractConnection implements WebSoc
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
private class WSFrameHandler implements WebSocketParser.FrameHandler
|
private class WSFrameHandler implements WebSocketParser.FrameHandler
|
||||||
{
|
{
|
||||||
private final Utf8StringBuilder _utf8 = new Utf8StringBuilder();
|
private final Utf8StringBuilder _utf8 = new Utf8StringBuilder(512); // TODO configure initial capacity
|
||||||
private ByteArrayBuffer _aggregate;
|
private ByteArrayBuffer _aggregate;
|
||||||
private byte _opcode=-1;
|
private byte _opcode=-1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue