add ping, pong, close frames extending from a controlframe

This commit is contained in:
Jesse McConnell 2012-06-18 13:02:27 -05:00
parent 145b98a663
commit f4a416586e
6 changed files with 27 additions and 5 deletions

View File

@ -1,5 +1,6 @@
package org.eclipse.jetty.websocket.frames;
public class CloseFrame {
public class CloseFrame extends ControlFrame
{
}

View File

@ -1,5 +1,6 @@
package org.eclipse.jetty.websocket.frames;
public class ControlFrame {
public class ControlFrame extends BaseFrame
{
}

View File

@ -23,7 +23,10 @@ import org.eclipse.jetty.websocket.frames.ControlFrameType;
public enum ControlFrameType
{
BASE_FRAME((short)1);
BASE_FRAME((short)1), // remove?
PING_FRAME((short)2),
PONG_FRAME((short)3),
CLOSE_FRAME((short)4);
public static ControlFrameType from(short code)
{

View File

@ -1,5 +1,6 @@
package org.eclipse.jetty.websocket.frames;
public class PingFrame {
public class PingFrame extends ControlFrame
{
}

View File

@ -1,5 +1,6 @@
package org.eclipse.jetty.websocket.frames;
public class PongFrame {
public class PongFrame extends ControlFrame
{
}

View File

@ -1,5 +1,12 @@
package org.eclipse.jetty.websocket.generator;
import java.util.EnumMap;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.websocket.frames.BaseFrame;
import org.eclipse.jetty.websocket.frames.ControlFrameType;
import org.eclipse.jetty.websocket.generator.ControlFrameGenerator;
/**
* Generating a frame in WebSocket land.
*
@ -26,4 +33,12 @@ package org.eclipse.jetty.websocket.generator;
*/
public class Generator {
private final EnumMap<ControlFrameType, BaseFrame> generators = new EnumMap<>(ControlFrameType.class);
public Generator(ByteBufferPool bufferPool) //, CompressionFactory.Compressor compressor)
{
HeadersBlockGenerator headerBlockGenerator = new HeadersBlockGenerator();
generators.put(ControlFrameType.BASE_FRAME, new BaseFrame());
}
}