Moved http2.frames.Flag to http2.Flags.

This commit is contained in:
Simone Bordet 2014-08-01 15:04:14 +02:00
parent 67fd213263
commit 89a045855c
15 changed files with 37 additions and 37 deletions

View File

@ -16,9 +16,9 @@
// ========================================================================
//
package org.eclipse.jetty.http2.frames;
package org.eclipse.jetty.http2;
public interface Flag
public interface Flags
{
public static final int NONE = 0x00;
public static final int END_STREAM = 0x01;

View File

@ -20,8 +20,8 @@ package org.eclipse.jetty.http2.generator;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.io.ByteBufferPool;
@ -80,9 +80,9 @@ public class DataGenerator
{
int length = data.remaining();
int flags = Flag.NONE;
int flags = Flags.NONE;
if (last)
flags |= Flag.END_STREAM;
flags |= Flags.END_STREAM;
ByteBuffer header = headerGenerator.generate(lease, FrameType.DATA, Frame.HEADER_LENGTH + length, length, flags, streamId);

View File

@ -21,7 +21,7 @@ package org.eclipse.jetty.http2.generator;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.http2.frames.GoAwayFrame;
@ -56,7 +56,7 @@ public class GoAwayGenerator extends FrameGenerator
payload = Arrays.copyOfRange(payload, 0, maxPayloadLength);
int length = fixedLength + (payload != null ? payload.length : 0);
ByteBuffer header = generateHeader(lease, FrameType.GO_AWAY, length, Flag.NONE, 0);
ByteBuffer header = generateHeader(lease, FrameType.GO_AWAY, length, Flags.NONE, 0);
header.putInt(lastStreamId);
header.putInt(error);

View File

@ -21,7 +21,7 @@ package org.eclipse.jetty.http2.generator;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.http2.frames.HeadersFrame;
@ -58,9 +58,9 @@ public class HeadersGenerator extends FrameGenerator
if (length > maxFrameSize)
throw new IllegalArgumentException("Invalid headers, too big");
int flags = Flag.END_HEADERS;
int flags = Flags.END_HEADERS;
if (!contentFollows)
flags |= Flag.END_STREAM;
flags |= Flags.END_STREAM;
ByteBuffer header = generateHeader(lease, FrameType.HEADERS, (int)length, flags, streamId);

View File

@ -20,7 +20,7 @@ package org.eclipse.jetty.http2.generator;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.http2.frames.PingFrame;
@ -46,7 +46,7 @@ public class PingGenerator extends FrameGenerator
if (payload.length != 8)
throw new IllegalArgumentException("Invalid payload length: " + payload.length);
ByteBuffer header = generateHeader(lease, FrameType.PING, 8, reply ? Flag.ACK : Flag.NONE, 0);
ByteBuffer header = generateHeader(lease, FrameType.PING, 8, reply ? Flags.ACK : Flags.NONE, 0);
header.put(payload);

View File

@ -20,7 +20,7 @@ package org.eclipse.jetty.http2.generator;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.http2.frames.PriorityFrame;
@ -48,7 +48,7 @@ public class PriorityGenerator extends FrameGenerator
if (dependentStreamId < 0)
throw new IllegalArgumentException("Invalid dependent stream id: " + dependentStreamId);
ByteBuffer header = generateHeader(lease, FrameType.PRIORITY, 5, Flag.NONE, dependentStreamId);
ByteBuffer header = generateHeader(lease, FrameType.PRIORITY, 5, Flags.NONE, dependentStreamId);
if (exclusive)
streamId |= 0x80_00_00_00;

View File

@ -21,7 +21,7 @@ package org.eclipse.jetty.http2.generator;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.http2.frames.PushPromiseFrame;
@ -66,7 +66,7 @@ public class PushPromiseGenerator extends FrameGenerator
// Space for the promised streamId.
length += fixedLength;
int flags = Flag.END_HEADERS;
int flags = Flags.END_HEADERS;
ByteBuffer header = generateHeader(lease, FrameType.PUSH_PROMISE, (int)length, flags, streamId);
header.putInt(promisedStreamId);

View File

@ -20,7 +20,7 @@ package org.eclipse.jetty.http2.generator;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.http2.frames.ResetFrame;
@ -46,7 +46,7 @@ public class ResetGenerator extends FrameGenerator
if (streamId < 0)
throw new IllegalArgumentException("Invalid stream id: " + streamId);
ByteBuffer header = generateHeader(lease, FrameType.RST_STREAM, 4, Flag.NONE, streamId);
ByteBuffer header = generateHeader(lease, FrameType.RST_STREAM, 4, Flags.NONE, streamId);
header.putInt(error);

View File

@ -21,7 +21,7 @@ package org.eclipse.jetty.http2.generator;
import java.nio.ByteBuffer;
import java.util.Map;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.http2.frames.SettingsFrame;
@ -50,7 +50,7 @@ public class SettingsGenerator extends FrameGenerator
if (length > getMaxFrameSize())
throw new IllegalArgumentException("Invalid settings, too big");
ByteBuffer header = generateHeader(lease, FrameType.SETTINGS, length, reply ? Flag.ACK : Flag.NONE, 0);
ByteBuffer header = generateHeader(lease, FrameType.SETTINGS, length, reply ? Flags.ACK : Flags.NONE, 0);
for (Map.Entry<Integer, Integer> entry : settings.entrySet())
{

View File

@ -20,7 +20,7 @@ package org.eclipse.jetty.http2.generator;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.FrameType;
import org.eclipse.jetty.http2.frames.WindowUpdateFrame;
@ -57,13 +57,13 @@ public class WindowUpdateGenerator extends FrameGenerator
if (both)
{
ByteBuffer header = generateHeader(lease, FrameType.WINDOW_UPDATE, 4, Flag.NONE, 0);
ByteBuffer header = generateHeader(lease, FrameType.WINDOW_UPDATE, 4, Flags.NONE, 0);
header.putInt(windowUpdate);
BufferUtil.flipToFlush(header, 0);
lease.append(header, true);
}
ByteBuffer header = generateHeader(lease, FrameType.WINDOW_UPDATE, 4, Flag.NONE, streamId);
ByteBuffer header = generateHeader(lease, FrameType.WINDOW_UPDATE, 4, Flags.NONE, streamId);
header.putInt(windowUpdate);
BufferUtil.flipToFlush(header, 0);
lease.append(header, true);

View File

@ -21,8 +21,8 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.frames.GoAwayFrame;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.http2.frames.PingFrame;
@ -62,12 +62,12 @@ public abstract class BodyParser
protected boolean isPadding()
{
return headerParser.hasFlag(Flag.PADDING);
return headerParser.hasFlag(Flags.PADDING);
}
protected boolean isEndStream()
{
return headerParser.hasFlag(Flag.END_STREAM);
return headerParser.hasFlag(Flags.END_STREAM);
}
protected int getStreamId()

View File

@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.http2.frames.PriorityFrame;
import org.eclipse.jetty.util.BufferUtil;
@ -81,7 +81,7 @@ public class HeadersBodyParser extends BodyParser
}
// For now we don't support HEADERS frames that don't have END_HEADERS.
if (!hasFlag(Flag.END_HEADERS))
if (!hasFlag(Flags.END_HEADERS))
{
return notifyConnectionFailure(ErrorCodes.INTERNAL_ERROR, "unsupported_headers_frame");
}
@ -92,7 +92,7 @@ public class HeadersBodyParser extends BodyParser
{
state = State.PADDING_LENGTH;
}
else if (hasFlag(Flag.PRIORITY))
else if (hasFlag(Flags.PRIORITY))
{
state = State.EXCLUSIVE;
}
@ -107,7 +107,7 @@ public class HeadersBodyParser extends BodyParser
paddingLength = buffer.get() & 0xFF;
--length;
length -= paddingLength;
state = hasFlag(Flag.PRIORITY) ? State.EXCLUSIVE : State.HEADERS;
state = hasFlag(Flags.PRIORITY) ? State.EXCLUSIVE : State.HEADERS;
loop = length == 0;
if (length < 0)
{
@ -211,7 +211,7 @@ public class HeadersBodyParser extends BodyParser
private boolean onHeaders(int streamId, int weight, boolean exclusive, MetaData metaData)
{
PriorityFrame priorityFrame = null;
if (hasFlag(Flag.PRIORITY))
if (hasFlag(Flags.PRIORITY))
{
priorityFrame = new PriorityFrame(streamId, getStreamId(), weight, exclusive);
}

View File

@ -21,7 +21,7 @@ package org.eclipse.jetty.http2.parser;
import java.nio.ByteBuffer;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.PingFrame;
public class PingBodyParser extends BodyParser
@ -100,7 +100,7 @@ public class PingBodyParser extends BodyParser
private Result onPing(byte[] payload)
{
PingFrame frame = new PingFrame(payload, hasFlag(Flag.ACK));
PingFrame frame = new PingFrame(payload, hasFlag(Flags.ACK));
reset();
return notifyPing(frame) ? Result.ASYNC : Result.COMPLETE;
}

View File

@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.PushPromiseFrame;
public class PushPromiseBodyParser extends BodyParser
@ -66,7 +66,7 @@ public class PushPromiseBodyParser extends BodyParser
}
// For now we don't support PUSH_PROMISE frames that don't have END_HEADERS.
if (!hasFlag(Flag.END_HEADERS))
if (!hasFlag(Flags.END_HEADERS))
{
return notifyConnectionFailure(ErrorCodes.INTERNAL_ERROR, "unsupported_push_promise_frame");
}

View File

@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.jetty.http2.ErrorCodes;
import org.eclipse.jetty.http2.frames.Flag;
import org.eclipse.jetty.http2.Flags;
import org.eclipse.jetty.http2.frames.SettingsFrame;
public class SettingsBodyParser extends BodyParser
@ -164,7 +164,7 @@ public class SettingsBodyParser extends BodyParser
private Result onSettings(Map<Integer, Integer> settings)
{
SettingsFrame frame = new SettingsFrame(settings, hasFlag(Flag.ACK));
SettingsFrame frame = new SettingsFrame(settings, hasFlag(Flags.ACK));
reset();
return notifySettings(frame) ? Result.ASYNC : Result.COMPLETE;
}