StreamID -> StreamId (#393 Ensure all fields follow naming convention)

This commit is contained in:
Trustin Lee 2012-06-12 21:06:45 +09:00
parent 9bf0ad8329
commit a35aeb8cd9
17 changed files with 134 additions and 134 deletions

View File

@ -24,7 +24,7 @@ import io.netty.util.internal.StringUtil;
*/
public class DefaultSpdyDataFrame implements SpdyDataFrame {
private int streamID;
private int streamId;
private boolean last;
private boolean compressed;
private ByteBuf data = Unpooled.EMPTY_BUFFER;
@ -32,24 +32,24 @@ public class DefaultSpdyDataFrame implements SpdyDataFrame {
/**
* Creates a new instance.
*
* @param streamID the Stream-ID of this frame
* @param streamId the Stream-ID of this frame
*/
public DefaultSpdyDataFrame(int streamID) {
setStreamID(streamID);
public DefaultSpdyDataFrame(int streamId) {
setStreamId(streamId);
}
@Override
public int getStreamID() {
return streamID;
public int getStreamId() {
return streamId;
}
@Override
public void setStreamID(int streamID) {
if (streamID <= 0) {
public void setStreamId(int streamId) {
if (streamId <= 0) {
throw new IllegalArgumentException(
"Stream-ID must be positive: " + streamID);
"Stream-ID must be positive: " + streamId);
}
this.streamID = streamID;
this.streamId = streamId;
}
@Override
@ -102,7 +102,7 @@ public class DefaultSpdyDataFrame implements SpdyDataFrame {
buf.append(')');
buf.append(StringUtil.NEWLINE);
buf.append("--> Stream-ID = ");
buf.append(streamID);
buf.append(streamId);
buf.append(StringUtil.NEWLINE);
buf.append("--> Size = ");
buf.append(data.readableBytes());

View File

@ -24,30 +24,30 @@ import io.netty.util.internal.StringUtil;
public class DefaultSpdyHeadersFrame extends DefaultSpdyHeaderBlock
implements SpdyHeadersFrame {
private int streamID;
private int streamId;
private boolean last;
/**
* Creates a new instance.
*
* @param streamID the Stream-ID of this frame
* @param streamId the Stream-ID of this frame
*/
public DefaultSpdyHeadersFrame(int streamID) {
setStreamID(streamID);
public DefaultSpdyHeadersFrame(int streamId) {
setStreamId(streamId);
}
@Override
public int getStreamID() {
return streamID;
public int getStreamId() {
return streamId;
}
@Override
public void setStreamID(int streamID) {
if (streamID <= 0) {
public void setStreamId(int streamId) {
if (streamId <= 0) {
throw new IllegalArgumentException(
"Stream-ID must be positive: " + streamID);
"Stream-ID must be positive: " + streamId);
}
this.streamID = streamID;
this.streamId = streamId;
}
@Override
@ -69,7 +69,7 @@ public class DefaultSpdyHeadersFrame extends DefaultSpdyHeaderBlock
buf.append(')');
buf.append(StringUtil.NEWLINE);
buf.append("--> Stream-ID = ");
buf.append(streamID);
buf.append(streamId);
buf.append(StringUtil.NEWLINE);
buf.append("--> Headers:");
buf.append(StringUtil.NEWLINE);

View File

@ -22,42 +22,42 @@ import io.netty.util.internal.StringUtil;
*/
public class DefaultSpdyRstStreamFrame implements SpdyRstStreamFrame {
private int streamID;
private int streamId;
private SpdyStreamStatus status;
/**
* Creates a new instance.
*
* @param streamID the Stream-ID of this frame
* @param streamId the Stream-ID of this frame
* @param statusCode the Status code of this frame
*/
public DefaultSpdyRstStreamFrame(int streamID, int statusCode) {
this(streamID, SpdyStreamStatus.valueOf(statusCode));
public DefaultSpdyRstStreamFrame(int streamId, int statusCode) {
this(streamId, SpdyStreamStatus.valueOf(statusCode));
}
/**
* Creates a new instance.
*
* @param streamID the Stream-ID of this frame
* @param streamId the Stream-ID of this frame
* @param status the status of this frame
*/
public DefaultSpdyRstStreamFrame(int streamID, SpdyStreamStatus status) {
setStreamID(streamID);
public DefaultSpdyRstStreamFrame(int streamId, SpdyStreamStatus status) {
setStreamId(streamId);
setStatus(status);
}
@Override
public int getStreamID() {
return streamID;
public int getStreamId() {
return streamId;
}
@Override
public void setStreamID(int streamID) {
if (streamID <= 0) {
public void setStreamId(int streamId) {
if (streamId <= 0) {
throw new IllegalArgumentException(
"Stream-ID must be positive: " + streamID);
"Stream-ID must be positive: " + streamId);
}
this.streamID = streamID;
this.streamId = streamId;
}
@Override
@ -76,7 +76,7 @@ public class DefaultSpdyRstStreamFrame implements SpdyRstStreamFrame {
buf.append(getClass().getSimpleName());
buf.append(StringUtil.NEWLINE);
buf.append("--> Stream-ID = ");
buf.append(streamID);
buf.append(streamId);
buf.append(StringUtil.NEWLINE);
buf.append("--> Status: ");
buf.append(status.toString());

View File

@ -23,30 +23,30 @@ import io.netty.util.internal.StringUtil;
public class DefaultSpdySynReplyFrame extends DefaultSpdyHeaderBlock
implements SpdySynReplyFrame {
private int streamID;
private int streamId;
private boolean last;
/**
* Creates a new instance.
*
* @param streamID the Stream-ID of this frame
* @param streamId the Stream-ID of this frame
*/
public DefaultSpdySynReplyFrame(int streamID) {
setStreamID(streamID);
public DefaultSpdySynReplyFrame(int streamId) {
setStreamId(streamId);
}
@Override
public int getStreamID() {
return streamID;
public int getStreamId() {
return streamId;
}
@Override
public void setStreamID(int streamID) {
if (streamID <= 0) {
public void setStreamId(int streamId) {
if (streamId <= 0) {
throw new IllegalArgumentException(
"Stream-ID must be positive: " + streamID);
"Stream-ID must be positive: " + streamId);
}
this.streamID = streamID;
this.streamId = streamId;
}
@Override
@ -68,7 +68,7 @@ public class DefaultSpdySynReplyFrame extends DefaultSpdyHeaderBlock
buf.append(')');
buf.append(StringUtil.NEWLINE);
buf.append("--> Stream-ID = ");
buf.append(streamID);
buf.append(streamId);
buf.append(StringUtil.NEWLINE);
buf.append("--> Headers:");
buf.append(StringUtil.NEWLINE);

View File

@ -22,32 +22,32 @@ import io.netty.util.internal.StringUtil;
*/
public class DefaultSpdyWindowUpdateFrame implements SpdyWindowUpdateFrame {
private int streamID;
private int streamId;
private int deltaWindowSize;
/**
* Creates a new instance.
*
* @param streamID the Stream-ID of this frame
* @param streamId the Stream-ID of this frame
* @param deltaWindowSize the Delta-Window-Size of this frame
*/
public DefaultSpdyWindowUpdateFrame(int streamID, int deltaWindowSize) {
setStreamID(streamID);
public DefaultSpdyWindowUpdateFrame(int streamId, int deltaWindowSize) {
setStreamId(streamId);
setDeltaWindowSize(deltaWindowSize);
}
@Override
public int getStreamID() {
return streamID;
public int getStreamId() {
return streamId;
}
@Override
public void setStreamID(int streamID) {
if (streamID <= 0) {
public void setStreamId(int streamId) {
if (streamId <= 0) {
throw new IllegalArgumentException(
"Stream-ID must be positive: " + streamID);
"Stream-ID must be positive: " + streamId);
}
this.streamID = streamID;
this.streamId = streamId;
}
@Override
@ -71,7 +71,7 @@ public class DefaultSpdyWindowUpdateFrame implements SpdyWindowUpdateFrame {
buf.append(getClass().getSimpleName());
buf.append(StringUtil.NEWLINE);
buf.append("--> Stream-ID = ");
buf.append(streamID);
buf.append(streamId);
buf.append(StringUtil.NEWLINE);
buf.append("--> Delta-Window-Size = ");
buf.append(deltaWindowSize);

View File

@ -26,12 +26,12 @@ public interface SpdyDataFrame {
/**
* Returns the Stream-ID of this frame.
*/
int getStreamID();
int getStreamId();
/**
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
*/
void setStreamID(int streamID);
void setStreamId(int streamID);
/**
* Returns {@code true} if this frame is the last frame to be transmitted

View File

@ -407,17 +407,17 @@ public class SpdyFrameDecoder extends ByteToMessageDecoder<Object> {
return null;
}
int lastGoodStreamID = getUnsignedInt(buffer, buffer.readerIndex());
int lastGoodStreamId = getUnsignedInt(buffer, buffer.readerIndex());
buffer.skipBytes(4);
if (version < 3) {
return new DefaultSpdyGoAwayFrame(lastGoodStreamID);
return new DefaultSpdyGoAwayFrame(lastGoodStreamId);
}
statusCode = getSignedInt(buffer, buffer.readerIndex());
buffer.skipBytes(4);
return new DefaultSpdyGoAwayFrame(lastGoodStreamID, statusCode);
return new DefaultSpdyGoAwayFrame(lastGoodStreamId, statusCode);
case SPDY_WINDOW_UPDATE_FRAME:
if (buffer.readableBytes() < 8) {
@ -447,7 +447,7 @@ public class SpdyFrameDecoder extends ByteToMessageDecoder<Object> {
int offset = buffer.readerIndex();
streamID = getUnsignedInt(buffer, offset);
int associatedToStreamID = getUnsignedInt(buffer, offset + 4);
int associatedToStreamId = getUnsignedInt(buffer, offset + 4);
byte priority = (byte) (buffer.getByte(offset + 8) >> 5 & 0x07);
if (version < 3) {
priority >>= 1;
@ -462,7 +462,7 @@ public class SpdyFrameDecoder extends ByteToMessageDecoder<Object> {
}
SpdySynStreamFrame spdySynStreamFrame =
new DefaultSpdySynStreamFrame(streamID, associatedToStreamID, priority);
new DefaultSpdySynStreamFrame(streamID, associatedToStreamId, priority);
spdySynStreamFrame.setLast((flags & SPDY_FLAG_FIN) != 0);
spdySynStreamFrame.setUnidirectional((flags & SPDY_FLAG_UNIDIRECTIONAL) != 0);

View File

@ -96,7 +96,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
ByteBuf data = spdyDataFrame.getData();
byte flags = spdyDataFrame.isLast() ? SPDY_DATA_FLAG_FIN : 0;
out.ensureWritableBytes(SPDY_HEADER_SIZE + data.readableBytes());
out.writeInt(spdyDataFrame.getStreamID() & 0x7FFFFFFF);
out.writeInt(spdyDataFrame.getStreamId() & 0x7FFFFFFF);
out.writeByte(flags);
out.writeMedium(data.readableBytes());
out.writeBytes(data, data.readerIndex(), data.readableBytes());
@ -157,7 +157,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
out.writeShort(SPDY_SYN_REPLY_FRAME);
out.writeByte(flags);
out.writeMedium(length);
out.writeInt(spdySynReplyFrame.getStreamID());
out.writeInt(spdySynReplyFrame.getStreamId());
if (version < 3) {
if (headerBlockLength == 0) {
out.writeInt(0);
@ -174,7 +174,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
out.writeShort(version | 0x8000);
out.writeShort(SPDY_RST_STREAM_FRAME);
out.writeInt(8);
out.writeInt(spdyRstStreamFrame.getStreamID());
out.writeInt(spdyRstStreamFrame.getStreamId());
out.writeInt(spdyRstStreamFrame.getStatus().getCode());
} else if (msg instanceof SpdySettingsFrame) {
@ -262,7 +262,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
out.writeShort(SPDY_HEADERS_FRAME);
out.writeByte(flags);
out.writeMedium(length);
out.writeInt(spdyHeadersFrame.getStreamID());
out.writeInt(spdyHeadersFrame.getStreamId());
if (version < 3 && headerBlockLength != 0) {
out.writeShort(0);
}
@ -275,7 +275,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
out.writeShort(version | 0x8000);
out.writeShort(SPDY_WINDOW_UPDATE_FRAME);
out.writeInt(8);
out.writeInt(spdyWindowUpdateFrame.getStreamID());
out.writeInt(spdyWindowUpdateFrame.getStreamId());
out.writeInt(spdyWindowUpdateFrame.getDeltaWindowSize());
} else {
throw new UnsupportedMessageTypeException(msg);

View File

@ -23,12 +23,12 @@ public interface SpdyHeadersFrame extends SpdyHeaderBlock {
/**
* Returns the Stream-ID of this frame.
*/
int getStreamID();
int getStreamId();
/**
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
*/
void setStreamID(int streamID);
void setStreamId(int streamID);
/**
* Returns {@code true} if this frame is the last frame to be transmitted

View File

@ -74,11 +74,11 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
if (SpdyCodecUtil.isServerID(streamID)) {
// SYN_STREAM frames initiated by the server are pushed resources
int associatedToStreamID = spdySynStreamFrame.getAssociatedToStreamId();
int associatedToStreamId = spdySynStreamFrame.getAssociatedToStreamId();
// If a client receives a SYN_STREAM with an Associated-To-Stream-ID of 0
// it must reply with a RST_STREAM with error code INVALID_STREAM
if (associatedToStreamID == 0) {
if (associatedToStreamId == 0) {
SpdyRstStreamFrame spdyRstStreamFrame =
new DefaultSpdyRstStreamFrame(streamID, SpdyStreamStatus.INVALID_STREAM);
ctx.write(spdyRstStreamFrame);
@ -98,8 +98,8 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
HttpResponse httpResponse = createHttpResponse(spdyVersion, spdySynStreamFrame);
// Set the Stream-ID, Associated-To-Stream-ID, Priority, and URL as headers
SpdyHttpHeaders.setStreamID(httpResponse, streamID);
SpdyHttpHeaders.setAssociatedToStreamID(httpResponse, associatedToStreamID);
SpdyHttpHeaders.setStreamId(httpResponse, streamID);
SpdyHttpHeaders.setAssociatedToStreamId(httpResponse, associatedToStreamId);
SpdyHttpHeaders.setPriority(httpResponse, spdySynStreamFrame.getPriority());
SpdyHttpHeaders.setUrl(httpResponse, URL);
@ -122,7 +122,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
HttpRequest httpRequest = createHttpRequest(spdyVersion, spdySynStreamFrame);
// Set the Stream-ID as a header
SpdyHttpHeaders.setStreamID(httpRequest, streamID);
SpdyHttpHeaders.setStreamId(httpRequest, streamID);
if (spdySynStreamFrame.isLast()) {
return httpRequest;
@ -145,13 +145,13 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
} else if (msg instanceof SpdySynReplyFrame) {
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
int streamID = spdySynReplyFrame.getStreamID();
int streamID = spdySynReplyFrame.getStreamId();
try {
HttpResponse httpResponse = createHttpResponse(spdyVersion, spdySynReplyFrame);
// Set the Stream-ID as a header
SpdyHttpHeaders.setStreamID(httpResponse, streamID);
SpdyHttpHeaders.setStreamId(httpResponse, streamID);
if (spdySynReplyFrame.isLast()) {
HttpHeaders.setContentLength(httpResponse, 0);
@ -171,7 +171,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
} else if (msg instanceof SpdyHeadersFrame) {
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
Integer streamID = new Integer(spdyHeadersFrame.getStreamID());
Integer streamID = new Integer(spdyHeadersFrame.getStreamId());
HttpMessage httpMessage = messageMap.get(streamID);
// If message is not in map discard HEADERS frame.
@ -187,7 +187,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
} else if (msg instanceof SpdyDataFrame) {
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
Integer streamID = new Integer(spdyDataFrame.getStreamID());
Integer streamID = new Integer(spdyDataFrame.getStreamId());
HttpMessage httpMessage = messageMap.get(streamID);
// If message is not in map discard Data Frame.
@ -222,7 +222,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<Object, HttpMessage
} else if (msg instanceof SpdyRstStreamFrame) {
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
Integer streamID = new Integer(spdyRstStreamFrame.getStreamID());
Integer streamID = new Integer(spdyRstStreamFrame.getStreamId());
messageMap.remove(streamID);
}

View File

@ -121,7 +121,7 @@ import java.util.Map;
public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
private final int spdyVersion;
private volatile int currentStreamID;
private volatile int currentStreamId;
/**
* Creates a new instance.
@ -165,7 +165,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
addContent(out, streamID, httpResponse);
} else {
SpdySynReplyFrame spdySynReplyFrame = createSynReplyFrame(httpResponse);
int streamID = spdySynReplyFrame.getStreamID();
int streamID = spdySynReplyFrame.getStreamId();
out.add(spdySynReplyFrame);
addContent(out, streamID, httpResponse);
}
@ -173,7 +173,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
} else if (msg instanceof HttpChunk) {
HttpChunk chunk = (HttpChunk) msg;
SpdyDataFrame spdyDataFrame = new DefaultSpdyDataFrame(currentStreamID);
SpdyDataFrame spdyDataFrame = new DefaultSpdyDataFrame(currentStreamId);
spdyDataFrame.setData(chunk.getContent());
spdyDataFrame.setLast(chunk.isLast());
@ -184,7 +184,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
out.add(spdyDataFrame);
} else {
// Create SPDY HEADERS frame out of trailers
SpdyHeadersFrame spdyHeadersFrame = new DefaultSpdyHeadersFrame(currentStreamID);
SpdyHeadersFrame spdyHeadersFrame = new DefaultSpdyHeadersFrame(currentStreamId);
for (Map.Entry<String, String> entry: trailers) {
spdyHeadersFrame.addHeader(entry.getKey(), entry.getValue());
}
@ -221,13 +221,13 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
boolean chunked = httpMessage.isChunked();
// Get the Stream-ID, Associated-To-Stream-ID, Priority, URL, and scheme from the headers
int streamID = SpdyHttpHeaders.getStreamID(httpMessage);
int associatedToStreamID = SpdyHttpHeaders.getAssociatedToStreamID(httpMessage);
int streamID = SpdyHttpHeaders.getStreamId(httpMessage);
int associatedToStreamId = SpdyHttpHeaders.getAssociatedToStreamId(httpMessage);
byte priority = SpdyHttpHeaders.getPriority(httpMessage);
String URL = SpdyHttpHeaders.getUrl(httpMessage);
String scheme = SpdyHttpHeaders.getScheme(httpMessage);
SpdyHttpHeaders.removeStreamID(httpMessage);
SpdyHttpHeaders.removeAssociatedToStreamID(httpMessage);
SpdyHttpHeaders.removeStreamId(httpMessage);
SpdyHttpHeaders.removeAssociatedToStreamId(httpMessage);
SpdyHttpHeaders.removePriority(httpMessage);
SpdyHttpHeaders.removeUrl(httpMessage);
SpdyHttpHeaders.removeScheme(httpMessage);
@ -240,7 +240,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
httpMessage.removeHeader(HttpHeaders.Names.TRANSFER_ENCODING);
SpdySynStreamFrame spdySynStreamFrame =
new DefaultSpdySynStreamFrame(streamID, associatedToStreamID, priority);
new DefaultSpdySynStreamFrame(streamID, associatedToStreamId, priority);
// Unfold the first line of the message into name/value pairs
if (httpMessage instanceof HttpRequest) {
@ -275,7 +275,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
}
if (chunked) {
currentStreamID = streamID;
currentStreamId = streamID;
spdySynStreamFrame.setLast(false);
} else {
spdySynStreamFrame.setLast(httpMessage.getContent().readableBytes() == 0);
@ -289,8 +289,8 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
boolean chunked = httpResponse.isChunked();
// Get the Stream-ID from the headers
int streamID = SpdyHttpHeaders.getStreamID(httpResponse);
SpdyHttpHeaders.removeStreamID(httpResponse);
int streamID = SpdyHttpHeaders.getStreamId(httpResponse);
SpdyHttpHeaders.removeStreamId(httpResponse);
// The Connection, Keep-Alive, Proxy-Connection, and Transfer-ENcoding
// headers are not valid and MUST not be sent.
@ -311,7 +311,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
}
if (chunked) {
currentStreamID = streamID;
currentStreamId = streamID;
spdySynReplyFrame.setLast(false);
} else {
spdySynReplyFrame.setLast(httpResponse.getContent().readableBytes() == 0);

View File

@ -60,28 +60,28 @@ public final class SpdyHttpHeaders {
/**
* Removes the {@code "X-SPDY-Stream-ID"} header.
*/
public static void removeStreamID(HttpMessage message) {
public static void removeStreamId(HttpMessage message) {
message.removeHeader(Names.STREAM_ID);
}
/**
* Returns the value of the {@code "X-SPDY-Stream-ID"} header.
*/
public static int getStreamID(HttpMessage message) {
public static int getStreamId(HttpMessage message) {
return HttpHeaders.getIntHeader(message, Names.STREAM_ID);
}
/**
* Sets the {@code "X-SPDY-Stream-ID"} header.
*/
public static void setStreamID(HttpMessage message, int streamID) {
HttpHeaders.setIntHeader(message, Names.STREAM_ID, streamID);
public static void setStreamId(HttpMessage message, int streamId) {
HttpHeaders.setIntHeader(message, Names.STREAM_ID, streamId);
}
/**
* Removes the {@code "X-SPDY-Associated-To-Stream-ID"} header.
*/
public static void removeAssociatedToStreamID(HttpMessage message) {
public static void removeAssociatedToStreamId(HttpMessage message) {
message.removeHeader(Names.ASSOCIATED_TO_STREAM_ID);
}
@ -91,15 +91,15 @@ public final class SpdyHttpHeaders {
* @return the header value or {@code 0} if there is no such header or
* if the header value is not a number
*/
public static int getAssociatedToStreamID(HttpMessage message) {
public static int getAssociatedToStreamId(HttpMessage message) {
return HttpHeaders.getIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, 0);
}
/**
* Sets the {@code "X-SPDY-Associated-To-Stream-ID"} header.
*/
public static void setAssociatedToStreamID(HttpMessage message, int associatedToStreamID) {
HttpHeaders.setIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, associatedToStreamID);
public static void setAssociatedToStreamId(HttpMessage message, int associatedToStreamId) {
HttpHeaders.setIntHeader(message, Names.ASSOCIATED_TO_STREAM_ID, associatedToStreamId);
}
/**

View File

@ -23,12 +23,12 @@ public interface SpdyRstStreamFrame {
/**
* Returns the Stream-ID of this frame.
*/
int getStreamID();
int getStreamId();
/**
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
*/
void setStreamID(int streamID);
void setStreamId(int streamID);
/**
* Returns the status of this frame.

View File

@ -44,7 +44,7 @@ public class SpdySessionHandler
}
private final SpdySession spdySession = new SpdySession();
private volatile int lastGoodStreamID;
private volatile int lastGoodStreamId;
private volatile int remoteConcurrentStreams;
private volatile int localConcurrentStreams;
@ -148,11 +148,11 @@ public class SpdySessionHandler
*/
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
int streamID = spdyDataFrame.getStreamID();
int streamID = spdyDataFrame.getStreamId();
// Check if we received a data frame for a Stream-ID which is not open
if (!spdySession.isActiveStream(streamID)) {
if (streamID <= lastGoodStreamID) {
if (streamID <= lastGoodStreamId) {
issueStreamError(ctx, streamID, SpdyStreamStatus.PROTOCOL_ERROR);
} else if (!sentGoAwayFrame) {
issueStreamError(ctx, streamID, SpdyStreamStatus.INVALID_STREAM);
@ -247,7 +247,7 @@ public class SpdySessionHandler
}
// Stream-IDs must be monotonically increasing
if (streamID <= lastGoodStreamID) {
if (streamID <= lastGoodStreamId) {
issueSessionError(ctx, SpdySessionStatus.PROTOCOL_ERROR);
return;
}
@ -271,7 +271,7 @@ public class SpdySessionHandler
*/
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
int streamID = spdySynReplyFrame.getStreamID();
int streamID = spdySynReplyFrame.getStreamId();
// Check if we received a valid SYN_REPLY frame
if (spdySynReplyFrame.isInvalid() ||
@ -306,7 +306,7 @@ public class SpdySessionHandler
*/
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
removeStream(ctx, spdyRstStreamFrame.getStreamID());
removeStream(ctx, spdyRstStreamFrame.getStreamId());
} else if (msg instanceof SpdySettingsFrame) {
@ -365,7 +365,7 @@ public class SpdySessionHandler
} else if (msg instanceof SpdyHeadersFrame) {
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
int streamID = spdyHeadersFrame.getStreamID();
int streamID = spdyHeadersFrame.getStreamId();
// Check if we received a valid HEADERS frame
if (spdyHeadersFrame.isInvalid()) {
@ -397,7 +397,7 @@ public class SpdySessionHandler
if (flowControl) {
SpdyWindowUpdateFrame spdyWindowUpdateFrame = (SpdyWindowUpdateFrame) msg;
int streamID = spdyWindowUpdateFrame.getStreamID();
int streamID = spdyWindowUpdateFrame.getStreamId();
int deltaWindowSize = spdyWindowUpdateFrame.getDeltaWindowSize();
// Ignore frames for half-closed streams
@ -471,7 +471,7 @@ public class SpdySessionHandler
if (msg instanceof SpdyDataFrame) {
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
final int streamID = spdyDataFrame.getStreamID();
final int streamID = spdyDataFrame.getStreamId();
// Frames must not be sent on half-closed streams
if (spdySession.isLocalSideClosed(streamID)) {
@ -582,7 +582,7 @@ public class SpdySessionHandler
} else if (msg instanceof SpdySynReplyFrame) {
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
int streamID = spdySynReplyFrame.getStreamID();
int streamID = spdySynReplyFrame.getStreamId();
// Frames must not be sent on half-closed streams
if (!isRemoteInitiatedID(streamID) || spdySession.isLocalSideClosed(streamID)) {
@ -598,7 +598,7 @@ public class SpdySessionHandler
} else if (msg instanceof SpdyRstStreamFrame) {
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
removeStream(ctx, spdyRstStreamFrame.getStreamID());
removeStream(ctx, spdyRstStreamFrame.getStreamId());
} else if (msg instanceof SpdySettingsFrame) {
@ -646,7 +646,7 @@ public class SpdySessionHandler
} else if (msg instanceof SpdyHeadersFrame) {
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
int streamID = spdyHeadersFrame.getStreamID();
int streamID = spdyHeadersFrame.getStreamId();
// Frames must not be sent on half-closed streams
if (spdySession.isLocalSideClosed(streamID)) {
@ -747,8 +747,8 @@ public class SpdySessionHandler
private synchronized void updateInitialSendWindowSize(int newInitialWindowSize) {
int deltaWindowSize = newInitialWindowSize - initialSendWindowSize;
initialSendWindowSize = newInitialWindowSize;
for (Integer StreamID: spdySession.getActiveStreams()) {
spdySession.updateSendWindowSize(StreamID.intValue(), deltaWindowSize);
for (Integer streamId: spdySession.getActiveStreams()) {
spdySession.updateSendWindowSize(streamId.intValue(), deltaWindowSize);
}
}
@ -759,7 +759,7 @@ public class SpdySessionHandler
spdySession.updateAllReceiveWindowSizes(deltaWindowSize);
}
// need to synchronize accesses to sentGoAwayFrame, lastGoodStreamID, and initial window sizes
// need to synchronize accesses to sentGoAwayFrame, lastGoodStreamId, and initial window sizes
private synchronized boolean acceptStream(
int streamID, byte priority, boolean remoteSideClosed, boolean localSideClosed) {
// Cannot initiate any new streams after receiving or sending GOAWAY
@ -776,7 +776,7 @@ public class SpdySessionHandler
streamID, priority, remoteSideClosed, localSideClosed,
initialSendWindowSize, initialReceiveWindowSize);
if (isRemoteInitiatedID(streamID)) {
lastGoodStreamID = streamID;
lastGoodStreamId = streamID;
}
return true;
}
@ -896,7 +896,7 @@ public class SpdySessionHandler
ChannelHandlerContext ctx, SpdySessionStatus status) {
if (!sentGoAwayFrame) {
sentGoAwayFrame = true;
SpdyGoAwayFrame spdyGoAwayFrame = new DefaultSpdyGoAwayFrame(lastGoodStreamID, status);
SpdyGoAwayFrame spdyGoAwayFrame = new DefaultSpdyGoAwayFrame(lastGoodStreamId, status);
ctx.nextOutboundMessageBuffer().add(spdyGoAwayFrame);
}
}

View File

@ -23,12 +23,12 @@ public interface SpdySynReplyFrame extends SpdyHeaderBlock {
/**
* Returns the Stream-ID of this frame.
*/
int getStreamID();
int getStreamId();
/**
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
*/
void setStreamID(int streamID);
void setStreamId(int streamID);
/**
* Returns {@code true} if this frame is the last frame to be transmitted

View File

@ -23,12 +23,12 @@ public interface SpdyWindowUpdateFrame {
/**
* Returns the Stream-ID of this frame.
*/
int getStreamID();
int getStreamId();
/**
* Sets the Stream-ID of this frame. The Stream-ID must be positive.
*/
void setStreamID(int streamID);
void setStreamId(int streamID);
/**
* Returns the Delta-Window-Size of this frame.

View File

@ -55,7 +55,7 @@ public class SpdySessionHandlerTest {
Assert.assertNotNull(msg);
Assert.assertTrue(msg instanceof SpdyDataFrame);
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
Assert.assertTrue(spdyDataFrame.getStreamID() == streamID);
Assert.assertTrue(spdyDataFrame.getStreamId() == streamID);
Assert.assertTrue(spdyDataFrame.isLast() == last);
}
@ -63,7 +63,7 @@ public class SpdySessionHandlerTest {
Assert.assertNotNull(msg);
Assert.assertTrue(msg instanceof SpdySynReplyFrame);
SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
Assert.assertTrue(spdySynReplyFrame.getStreamID() == streamID);
Assert.assertTrue(spdySynReplyFrame.getStreamId() == streamID);
Assert.assertTrue(spdySynReplyFrame.isLast() == last);
assertHeaderBlock(spdySynReplyFrame, headers);
}
@ -72,7 +72,7 @@ public class SpdySessionHandlerTest {
Assert.assertNotNull(msg);
Assert.assertTrue(msg instanceof SpdyRstStreamFrame);
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
Assert.assertTrue(spdyRstStreamFrame.getStreamID() == streamID);
Assert.assertTrue(spdyRstStreamFrame.getStreamId() == streamID);
Assert.assertTrue(spdyRstStreamFrame.getStatus().equals(status));
}
@ -94,7 +94,7 @@ public class SpdySessionHandlerTest {
Assert.assertNotNull(msg);
Assert.assertTrue(msg instanceof SpdyHeadersFrame);
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
Assert.assertTrue(spdyHeadersFrame.getStreamID() == streamID);
Assert.assertTrue(spdyHeadersFrame.getStreamId() == streamID);
assertHeaderBlock(spdyHeadersFrame, headers);
}
@ -207,18 +207,18 @@ public class SpdySessionHandlerTest {
Assert.assertNull(sessionHandler.readOutbound());
// Check if session handler rejects HEADERS for closed streams
int testStreamID = spdyDataFrame.getStreamID();
int testStreamID = spdyDataFrame.getStreamId();
sessionHandler.writeInbound(spdyDataFrame);
assertDataFrame(sessionHandler.readOutbound(), testStreamID, spdyDataFrame.isLast());
Assert.assertNull(sessionHandler.readOutbound());
spdyHeadersFrame.setStreamID(testStreamID);
spdyHeadersFrame.setStreamId(testStreamID);
sessionHandler.writeInbound(spdyHeadersFrame);
assertRstStream(sessionHandler.readOutbound(), testStreamID, SpdyStreamStatus.INVALID_STREAM);
Assert.assertNull(sessionHandler.readOutbound());
// Check if session handler returns PROTOCOL_ERROR if it receives
// an invalid HEADERS frame
spdyHeadersFrame.setStreamID(localStreamID);
spdyHeadersFrame.setStreamId(localStreamID);
spdyHeadersFrame.setInvalid();
sessionHandler.writeInbound(spdyHeadersFrame);
assertRstStream(sessionHandler.readOutbound(), localStreamID, SpdyStreamStatus.PROTOCOL_ERROR);
@ -248,7 +248,7 @@ public class SpdySessionHandlerTest {
// Check if session handler ignores Data frames after sending
// a GOAWAY frame
spdyDataFrame.setStreamID(localStreamID);
spdyDataFrame.setStreamId(localStreamID);
sessionHandler.writeInbound(spdyDataFrame);
Assert.assertNull(sessionHandler.readOutbound());