Class SpdyHttpEncoder
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelOutboundHandlerAdapter
io.netty.handler.codec.MessageToMessageEncoder<HttpObject>
io.netty.handler.codec.spdy.SpdyHttpEncoder
- All Implemented Interfaces:
ChannelHandler, ChannelOutboundHandler
Encodes
HttpRequests, HttpResponses, and HttpContents
into SpdySynStreamFrames and SpdySynReplyFrames.
Request Annotations
SPDY specific headers must be added toHttpRequests:
| 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. |
Response Annotations
SPDY specific headers must be added toHttpResponses:
| Header Name | Header Value |
|---|---|
"X-SPDY-Stream-ID" |
The Stream-ID of the request corresponding to this response. |
Pushed Resource Annotations
SPDY specific headers must be added to pushedHttpRequests:
| 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. |
Required Annotations
SPDY requires that all Requests and Pushed Resources contain an HTTP "Host" header.Optional Annotations
Requests and Pushed Resources must contain a SPDY scheme header. This can be set via the"X-SPDY-Scheme" header but otherwise
defaults to "https" as that is the most common SPDY deployment.
Chunked Content
This encoder associates allHttpContents that it receives
with the most recently received 'chunked' HttpRequest
or HttpResponse.
Pushed Resources
All pushed resources should be sent before sending the response that corresponds to the initial request.-
Nested Class Summary
Nested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.SharableModifier and TypeInterfaceDescriptionstatic @interfaceIndicates that the same instance of the annotatedChannelHandlercan be added to one or moreChannelPipelines multiple times without a race condition. -
Constructor Summary
ConstructorsConstructorDescriptionSpdyHttpEncoder(SpdyVersion version) Creates a new instance.SpdyHttpEncoder(SpdyVersion version, boolean headersToLowerCase, boolean validateHeaders) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidencode(ChannelHandlerContext ctx, HttpObject msg, List<Object> out) Encode from one message to an other.Methods inherited from class MessageToMessageEncoder
acceptOutboundMessage, writeModifier and TypeMethodDescriptionbooleanReturnstrueif the given message should be handled.voidwrite(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) CallsChannelOutboundInvoker.write(Object, ChannelPromise)to forward to the nextChannelOutboundHandlerin theChannelPipeline.Methods inherited from class ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, readModifier and TypeMethodDescriptionvoidbind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) CallsChannelOutboundInvoker.bind(SocketAddress, ChannelPromise)to forward to the nextChannelOutboundHandlerin theChannelPipeline.voidclose(ChannelHandlerContext ctx, ChannelPromise promise) CallsChannelOutboundInvoker.close(ChannelPromise)to forward to the nextChannelOutboundHandlerin theChannelPipeline.voidconnect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) CallsChannelOutboundInvoker.connect(SocketAddress, SocketAddress, ChannelPromise)to forward to the nextChannelOutboundHandlerin theChannelPipeline.voidderegister(ChannelHandlerContext ctx, ChannelPromise promise) CallsChannelOutboundInvoker.deregister(ChannelPromise)to forward to the nextChannelOutboundHandlerin theChannelPipeline.voiddisconnect(ChannelHandlerContext ctx, ChannelPromise promise) CallsChannelOutboundInvoker.disconnect(ChannelPromise)to forward to the nextChannelOutboundHandlerin theChannelPipeline.voidCallsChannelHandlerContext.flush()to forward to the nextChannelOutboundHandlerin theChannelPipeline.voidCallsChannelHandlerContext.read()to forward to the nextChannelOutboundHandlerin theChannelPipeline.Methods inherited from class ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableModifier and TypeMethodDescriptionprotected voidvoidexceptionCaught(ChannelHandlerContext ctx, Throwable cause) Deprecated.voidDo nothing by default, sub-classes may override this method.voidDo nothing by default, sub-classes may override this method.booleanReturntrueif the implementation isChannelHandler.Sharableand so can be added to differentChannelPipelines.
-
Constructor Details
-
SpdyHttpEncoder
Creates a new instance.- Parameters:
version- the protocol version
-
SpdyHttpEncoder
Creates a new instance.- Parameters:
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 theSpdyHeaders
-
-
Method Details
-
encode
Description copied from class:MessageToMessageEncoderEncode from one message to an other. This method will be called for each written message that can be handled by this encoder.- Specified by:
encodein classMessageToMessageEncoder<HttpObject>- Parameters:
ctx- theChannelHandlerContextwhich thisMessageToMessageEncoderbelongs tomsg- the message to encode to an other oneout- theListinto which the encoded msg should be added needs to do some kind of aggregation- Throws:
Exception- is thrown if an error occurs
-
ChannelInboundHandler