public class SpdyHttpEncoder extends MessageToMessageEncoder<HttpObject>
HttpRequest
s, HttpResponse
s, and HttpContent
s
into SpdySynStreamFrame
s and SpdySynReplyFrame
s.
HttpRequest
s:
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. |
HttpResponse
s:
Header Name | Header Value |
---|---|
"X-SPDY-Stream-ID" |
The Stream-ID of the request corresponding to this response. |
HttpRequest
s:
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-Scheme"
header but otherwise
defaults to "https" as that is the most common SPDY deployment.
HttpContent
s that it receives
with the most recently received 'chunked' HttpRequest
or HttpResponse
.
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
private int |
currentStreamId |
private boolean |
headersToLowerCase |
private boolean |
validateHeaders |
Constructor and Description |
---|
SpdyHttpEncoder(SpdyVersion version)
Creates a new instance.
|
SpdyHttpEncoder(SpdyVersion version,
boolean headersToLowerCase,
boolean validateHeaders)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
private SpdyHeadersFrame |
createHeadersFrame(HttpResponse httpResponse) |
private SpdySynStreamFrame |
createSynStreamFrame(HttpRequest httpRequest) |
protected void |
encode(ChannelHandlerContext ctx,
HttpObject msg,
java.util.List<java.lang.Object> out)
Encode from one message to an other.
|
private static boolean |
isLast(HttpMessage httpMessage)
Checks if the given HTTP message should be considered as a last SPDY frame.
|
acceptOutboundMessage, write
bind, close, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
private int currentStreamId
private final boolean validateHeaders
private final boolean headersToLowerCase
public SpdyHttpEncoder(SpdyVersion version)
version
- the protocol versionpublic SpdyHttpEncoder(SpdyVersion version, boolean headersToLowerCase, boolean validateHeaders)
version
- the protocol versionheadersToLowerCase
- convert header names to lowercase. In a controlled environment,
one can disable the conversion.validateHeaders
- validate the header names and values when adding them to the SpdyHeaders
protected void encode(ChannelHandlerContext ctx, HttpObject msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
MessageToMessageEncoder
encode
in class MessageToMessageEncoder<HttpObject>
ctx
- the ChannelHandlerContext
which this MessageToMessageEncoder
belongs tomsg
- the message to encode to an other oneout
- the List
into which the encoded msg should be added
needs to do some kind of aggregationjava.lang.Exception
- is thrown if an error occursprivate SpdySynStreamFrame createSynStreamFrame(HttpRequest httpRequest) throws java.lang.Exception
java.lang.Exception
private SpdyHeadersFrame createHeadersFrame(HttpResponse httpResponse) throws java.lang.Exception
java.lang.Exception
private static boolean isLast(HttpMessage httpMessage)
httpMessage
- check this HTTP message