Search in sources :

Example 66 with HttpServerCodec

use of io.netty.handler.codec.http.HttpServerCodec in project async-http-client by AsyncHttpClient.

the class HttpStaticFileServerInitializer method initChannel.

@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline pipeline = ch.pipeline();
    pipeline.addLast(new HttpServerCodec());
    pipeline.addLast(new HttpObjectAggregator(65536));
    pipeline.addLast(new ChunkedWriteHandler());
    pipeline.addLast(new HttpStaticFileServerHandler());
}
Also used : HttpObjectAggregator(io.netty.handler.codec.http.HttpObjectAggregator) ChunkedWriteHandler(io.netty.handler.stream.ChunkedWriteHandler) HttpServerCodec(io.netty.handler.codec.http.HttpServerCodec) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

HttpServerCodec (io.netty.handler.codec.http.HttpServerCodec)64 ChannelPipeline (io.netty.channel.ChannelPipeline)41 HttpObjectAggregator (io.netty.handler.codec.http.HttpObjectAggregator)35 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)12 ChunkedWriteHandler (io.netty.handler.stream.ChunkedWriteHandler)12 HttpServerUpgradeHandler (io.netty.handler.codec.http.HttpServerUpgradeHandler)11 Test (org.junit.Test)11 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)10 ChannelHandler (io.netty.channel.ChannelHandler)10 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)9 Channel (io.netty.channel.Channel)8 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)8 WebSocketServerProtocolHandler (io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler)7 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)7 ChannelDuplexHandler (io.netty.channel.ChannelDuplexHandler)6 ChannelHandlerAdapter (io.netty.channel.ChannelHandlerAdapter)6 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)6 SocketChannel (io.netty.channel.socket.SocketChannel)6 LineBasedFrameDecoder (io.netty.handler.codec.LineBasedFrameDecoder)6 HttpContentCompressor (io.netty.handler.codec.http.HttpContentCompressor)5