public class SpdyHttpEncoder extends java.lang.Object implements ChannelDownstreamHandler
HttpRequests, HttpResponses, and HttpChunks
into SpdySynStreamFrames and SpdySynReplyFrames.
HttpRequests:
| Header Name | Header Value |
|---|---|
"X-SPDY-Stream-ID" |
The Stream-ID for this request. Stream-IDs must be odd, positive integers, and must increase monotonically. |
"X-SPDY-Priority" |
The priority value for this request. The priority should be between 0 and 7 inclusive. 0 represents the highest priority and 7 represents the lowest. This header is optional and defaults to 0. |
HttpResponses:
| Header Name | Header Value |
|---|---|
"X-SPDY-Stream-ID" |
The Stream-ID of the request corresponding to this response. |
HttpResponses:
| Header Name | Header Value |
|---|---|
"X-SPDY-Stream-ID" |
The Stream-ID for this resource. Stream-IDs must be even, positive integers, and must increase monotonically. |
"X-SPDY-Associated-To-Stream-ID" |
The Stream-ID of the request that initiated this pushed resource. |
"X-SPDY-Priority" |
The priority value for this resource. The priority should be between 0 and 7 inclusive. 0 represents the highest priority and 7 represents the lowest. This header is optional and defaults to 0. |
"X-SPDY-URL" |
The absolute path for the resource being pushed. |
"X-SPDY-Scheme" header but otherwise
defaults to "https" as that is the most common SPDY deployment.
HttpChunks that it receives
with the most recently received 'chunked' HttpRequest
or HttpResponse.
| Modifier and Type | Class and Description |
|---|---|
private static class |
SpdyHttpEncoder.SpdyFrameWriter |
ChannelHandler.Sharable| Modifier and Type | Field and Description |
|---|---|
private int |
currentStreamId |
private int |
spdyVersion |
| Constructor and Description |
|---|
SpdyHttpEncoder(SpdyVersion spdyVersion)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
private SpdyDataFrame[] |
createSpdyDataFrames(int streamId,
ChannelBuffer content) |
private SpdySynReplyFrame |
createSynReplyFrame(HttpResponse httpResponse) |
private SpdySynStreamFrame |
createSynStreamFrame(HttpMessage httpMessage) |
private static ChannelFuture |
getDataFuture(ChannelHandlerContext ctx,
ChannelFuture future,
SpdyDataFrame[] spdyDataFrames,
java.net.SocketAddress remoteAddress) |
private ChannelFuture |
getMessageFuture(ChannelHandlerContext ctx,
MessageEvent e,
int streamId,
HttpMessage httpMessage) |
void |
handleDownstream(ChannelHandlerContext ctx,
ChannelEvent evt)
Handles the specified downstream event.
|
protected void |
writeChunk(ChannelHandlerContext ctx,
ChannelFuture future,
int streamId,
HttpChunk chunk,
java.net.SocketAddress remoteAddress)
Writes an HTTP chunk downstream as one or more SPDY frames.
|
private final int spdyVersion
private volatile int currentStreamId
public SpdyHttpEncoder(SpdyVersion spdyVersion)
spdyVersion - the protocol versionpublic void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws java.lang.Exception
ChannelDownstreamHandlerhandleDownstream in interface ChannelDownstreamHandlerctx - the context object for this handlerevt - the downstream event to process or interceptjava.lang.Exceptionprotected void writeChunk(ChannelHandlerContext ctx, ChannelFuture future, int streamId, HttpChunk chunk, java.net.SocketAddress remoteAddress)
private ChannelFuture getMessageFuture(ChannelHandlerContext ctx, MessageEvent e, int streamId, HttpMessage httpMessage)
private static ChannelFuture getDataFuture(ChannelHandlerContext ctx, ChannelFuture future, SpdyDataFrame[] spdyDataFrames, java.net.SocketAddress remoteAddress)
private SpdySynStreamFrame createSynStreamFrame(HttpMessage httpMessage) throws java.lang.Exception
java.lang.Exceptionprivate SpdySynReplyFrame createSynReplyFrame(HttpResponse httpResponse) throws java.lang.Exception
java.lang.Exceptionprivate SpdyDataFrame[] createSpdyDataFrames(int streamId, ChannelBuffer content)