Class SpdyHttpEncoder

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelOutboundHandler

    public class SpdyHttpEncoder
    extends io.netty.handler.codec.MessageToMessageEncoder<HttpObject>
    Encodes HttpRequests, HttpResponses, and HttpContents into SpdySynStreamFrames and SpdySynReplyFrames.

    Request Annotations

    SPDY specific headers must be added to HttpRequests:
    Header NameHeader 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 to HttpResponses:
    Header NameHeader 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 pushed HttpRequests:
    Header NameHeader 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 all HttpContents 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 io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void encode​(io.netty.channel.ChannelHandlerContext ctx, HttpObject msg, List<Object> out)  
      • Methods inherited from class io.netty.handler.codec.MessageToMessageEncoder

        acceptOutboundMessage, write
      • Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter

        bind, close, connect, deregister, disconnect, flush, read
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
      • Methods inherited from interface io.netty.channel.ChannelHandler

        exceptionCaught, handlerAdded, handlerRemoved
    • Constructor Detail

      • SpdyHttpEncoder

        public SpdyHttpEncoder​(SpdyVersion version)
        Creates a new instance.
        Parameters:
        version - the protocol version
      • SpdyHttpEncoder

        public SpdyHttpEncoder​(SpdyVersion version,
                               boolean headersToLowerCase,
                               boolean validateHeaders)
        Creates a new instance.
        Parameters:
        version - the protocol version
        headersToLowerCase - 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
    • Method Detail

      • encode

        protected void encode​(io.netty.channel.ChannelHandlerContext ctx,
                              HttpObject msg,
                              List<Object> out)
                       throws Exception
        Specified by:
        encode in class io.netty.handler.codec.MessageToMessageEncoder<HttpObject>
        Throws:
        Exception