Class BasicHttpServerCodec

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler, io.netty.handler.codec.http.HttpServerUpgradeHandler.SourceCodec

    public class BasicHttpServerCodec
    extends io.netty.channel.CombinedChannelDuplexHandler<BasicHttpRequestDecoder,​io.netty.handler.codec.http.HttpResponseEncoder>
    implements io.netty.handler.codec.http.HttpServerUpgradeHandler.SourceCodec
    • Constructor Summary

      Constructors 
      Constructor Description
      BasicHttpServerCodec()
      Creates a new instance with the default decoder options (maxInitialLineLength (4096}, maxHeaderSize (8192), and maxChunkSize (8192)).
      BasicHttpServerCodec​(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize)
      Creates a new instance with the specified decoder options.
      BasicHttpServerCodec​(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders)
      Creates a new instance with the specified decoder options.
      BasicHttpServerCodec​(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize)
      Creates a new instance with the specified decoder options.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected BasicHttpServerCodec.Decoder createDecoder​(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize)  
      protected BasicHttpServerCodec.Encoder createEncoder()  
      protected io.netty.handler.codec.http.HttpMessage createInvalidMessage​(long startTimeMillis, long startNanos)  
      protected io.netty.handler.codec.http.HttpMessage createMessage​(java.lang.String[] initialLine, boolean validateHeaders, long startTimeMillis, long startNanos)  
      void exceptionCaught​(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause)  
      void upgradeFrom​(io.netty.channel.ChannelHandlerContext ctx)
      Upgrades to another protocol from HTTP.
      • Methods inherited from class io.netty.channel.CombinedChannelDuplexHandler

        bind, channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerAdded, handlerRemoved, inboundHandler, init, outboundHandler, read, removeInboundHandler, removeOutboundHandler, userEventTriggered, write
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, isSharable
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BasicHttpServerCodec

        public BasicHttpServerCodec()
        Creates a new instance with the default decoder options (maxInitialLineLength (4096}, maxHeaderSize (8192), and maxChunkSize (8192)).
      • BasicHttpServerCodec

        public BasicHttpServerCodec​(int maxInitialLineLength,
                                    int maxHeaderSize,
                                    int maxChunkSize)
        Creates a new instance with the specified decoder options.
      • BasicHttpServerCodec

        public BasicHttpServerCodec​(int maxInitialLineLength,
                                    int maxHeaderSize,
                                    int maxChunkSize,
                                    boolean validateHeaders)
        Creates a new instance with the specified decoder options.
      • BasicHttpServerCodec

        public BasicHttpServerCodec​(int maxInitialLineLength,
                                    int maxHeaderSize,
                                    int maxChunkSize,
                                    boolean validateHeaders,
                                    int initialBufferSize)
        Creates a new instance with the specified decoder options.
    • Method Detail

      • createDecoder

        protected BasicHttpServerCodec.Decoder createDecoder​(int maxInitialLineLength,
                                                             int maxHeaderSize,
                                                             int maxChunkSize,
                                                             boolean validateHeaders,
                                                             int initialBufferSize)
      • upgradeFrom

        public void upgradeFrom​(io.netty.channel.ChannelHandlerContext ctx)
        Upgrades to another protocol from HTTP. Removes the BasicHttpRequestDecoder and HttpResponseEncoder from the pipeline.
        Specified by:
        upgradeFrom in interface io.netty.handler.codec.http.HttpServerUpgradeHandler.SourceCodec
      • createMessage

        protected io.netty.handler.codec.http.HttpMessage createMessage​(java.lang.String[] initialLine,
                                                                        boolean validateHeaders,
                                                                        long startTimeMillis,
                                                                        long startNanos)
      • createInvalidMessage

        protected io.netty.handler.codec.http.HttpMessage createInvalidMessage​(long startTimeMillis,
                                                                               long startNanos)
      • exceptionCaught

        public void exceptionCaught​(io.netty.channel.ChannelHandlerContext ctx,
                                    java.lang.Throwable cause)
                             throws java.lang.Exception
        Specified by:
        exceptionCaught in interface io.netty.channel.ChannelHandler
        Specified by:
        exceptionCaught in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        exceptionCaught in class io.netty.channel.CombinedChannelDuplexHandler<BasicHttpRequestDecoder,​io.netty.handler.codec.http.HttpResponseEncoder>
        Throws:
        java.lang.Exception