Updated Frame inheritance.

This commit is contained in:
Simone Bordet 2014-06-10 08:56:34 +02:00
parent b38bae36f1
commit e0474108d0
9 changed files with 27 additions and 7 deletions

View File

@ -28,6 +28,7 @@ public class DataFrame extends Frame
public DataFrame(int streamId, ByteBuffer data, boolean endStream)
{
super(FrameType.DATA);
this.streamId = streamId;
this.data = data;
this.endStream = endStream;

View File

@ -22,4 +22,16 @@ public abstract class Frame
{
public static final int HEADER_LENGTH = 8;
public static final int MAX_LENGTH = 0x3F_FF;
private FrameType type;
protected Frame(FrameType type)
{
this.type = type;
}
public FrameType getType()
{
return type;
}
}

View File

@ -18,7 +18,7 @@
package org.eclipse.jetty.http2.frames;
public class GoAwayFrame
public class GoAwayFrame extends Frame
{
private final int lastStreamId;
private final int error;
@ -26,6 +26,7 @@ public class GoAwayFrame
public GoAwayFrame(int lastStreamId, int error, byte[] payload)
{
super(FrameType.GO_AWAY);
this.lastStreamId = lastStreamId;
this.error = error;
this.payload = payload;

View File

@ -20,7 +20,7 @@ package org.eclipse.jetty.http2.frames;
import org.eclipse.jetty.http2.hpack.MetaData;
public class HeadersFrame
public class HeadersFrame extends Frame
{
private final int streamId;
private final MetaData metaData;
@ -29,6 +29,7 @@ public class HeadersFrame
public HeadersFrame(int streamId, MetaData metaData, PriorityFrame priority, boolean endStream)
{
super(FrameType.HEADERS);
this.streamId = streamId;
this.metaData = metaData;
this.priority = priority;

View File

@ -18,13 +18,14 @@
package org.eclipse.jetty.http2.frames;
public class PingFrame
public class PingFrame extends Frame
{
private final byte[] payload;
private final boolean reply;
public PingFrame(byte[] payload, boolean reply)
{
super(FrameType.PING);
this.payload = payload;
this.reply = reply;
}

View File

@ -18,7 +18,7 @@
package org.eclipse.jetty.http2.frames;
public class PriorityFrame
public class PriorityFrame extends Frame
{
private final int streamId;
private final int dependentStreamId;
@ -27,6 +27,7 @@ public class PriorityFrame
public PriorityFrame(int streamId, int dependentStreamId, int weight, boolean exclusive)
{
super(FrameType.PRIORITY);
this.streamId = streamId;
this.dependentStreamId = dependentStreamId;
this.weight = weight;

View File

@ -18,13 +18,14 @@
package org.eclipse.jetty.http2.frames;
public class ResetFrame
public class ResetFrame extends Frame
{
private final int streamId;
private final int error;
public ResetFrame(int streamId, int error)
{
super(FrameType.RST_STREAM);
this.streamId = streamId;
this.error = error;
}

View File

@ -20,13 +20,14 @@ package org.eclipse.jetty.http2.frames;
import java.util.Map;
public class SettingsFrame
public class SettingsFrame extends Frame
{
private final Map<Integer, Integer> settings;
private final boolean reply;
public SettingsFrame(Map<Integer, Integer> settings, boolean reply)
{
super(FrameType.SETTINGS);
this.settings = settings;
this.reply = reply;
}

View File

@ -18,13 +18,14 @@
package org.eclipse.jetty.http2.frames;
public class WindowUpdateFrame
public class WindowUpdateFrame extends Frame
{
private final int streamId;
private final int windowDelta;
public WindowUpdateFrame(int streamId, int windowDelta)
{
super(FrameType.WINDOW_UPDATE);
this.streamId = streamId;
this.windowDelta = windowDelta;
}