Search in sources :

Example 66 with ChannelPipeline

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project cxf by apache.

the class NettyHttpClientPipelineFactory method initChannel.

@Override
protected void initChannel(Channel ch) throws Exception {
    ChannelPipeline pipeline = ch.pipeline();
    SslHandler sslHandler = configureClientSSLOnDemand();
    if (sslHandler != null) {
        LOG.log(Level.FINE, "Server SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
        pipeline.addLast("ssl", sslHandler);
    }
    pipeline.addLast("decoder", new HttpResponseDecoder());
    pipeline.addLast("aggregator", new HttpObjectAggregator(maxContentLength));
    pipeline.addLast("encoder", new HttpRequestEncoder());
    pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
    if (readTimeout > 0) {
        pipeline.addLast("readTimeoutHandler", new ReadTimeoutHandler(readTimeout, TimeUnit.MILLISECONDS));
    }
    pipeline.addLast("client", new NettyHttpClientHandler());
}
Also used : HttpObjectAggregator(io.netty.handler.codec.http.HttpObjectAggregator) ChunkedWriteHandler(io.netty.handler.stream.ChunkedWriteHandler) HttpRequestEncoder(io.netty.handler.codec.http.HttpRequestEncoder) ReadTimeoutHandler(io.netty.handler.timeout.ReadTimeoutHandler) HttpResponseDecoder(io.netty.handler.codec.http.HttpResponseDecoder) ChannelPipeline(io.netty.channel.ChannelPipeline) SslHandler(io.netty.handler.ssl.SslHandler)

Example 67 with ChannelPipeline

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project cxf by apache.

the class NettyHttpServletPipelineFactory method initChannel.

@Override
protected void initChannel(Channel ch) throws Exception {
    if (!enableHttp2) {
        final ChannelPipeline pipeline = getDefaultHttpChannelPipeline(ch);
        pipeline.addLast(applicationExecutor, "handler", this.getServletHandler());
    } else {
        getDefaultHttp2ChannelPipeline(ch);
    }
}
Also used : ChannelPipeline(io.netty.channel.ChannelPipeline)

Example 68 with ChannelPipeline

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project cxf by apache.

the class NettyHttpServletPipelineFactory method getDefaultHttpChannelPipeline.

protected ChannelPipeline getDefaultHttpChannelPipeline(Channel channel) throws Exception {
    // Create a default pipeline implementation.
    ChannelPipeline pipeline = channel.pipeline();
    SslHandler sslHandler = configureServerHttpSSLOnDemand();
    if (sslHandler != null) {
        LOG.log(Level.FINE, "Server SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
        pipeline.addLast("ssl", sslHandler);
    }
    configureDefaultHttpPipeline(pipeline);
    return pipeline;
}
Also used : ChannelPipeline(io.netty.channel.ChannelPipeline) SslHandler(io.netty.handler.ssl.SslHandler)

Example 69 with ChannelPipeline

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project qpid-broker-j by apache.

the class AbstractFrameTransport method connect.

public AbstractFrameTransport<I> connect() {
    try {
        Bootstrap b = new Bootstrap();
        b.group(_workerGroup);
        b.channel(NioSocketChannel.class);
        b.option(ChannelOption.SO_KEEPALIVE, true);
        b.handler(new ChannelInitializer<SocketChannel>() {

            @Override
            public void initChannel(SocketChannel ch) throws Exception {
                ChannelPipeline pipeline = ch.pipeline();
                buildInputOutputPipeline(pipeline);
            }
        });
        _channel = b.connect(_brokerAddress).sync().channel();
        _channel.closeFuture().addListener(future -> {
            _channelClosedSeen = true;
            _queue.add(CHANNEL_CLOSED_RESPONSE);
        });
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
    return this;
}
Also used : NioSocketChannel(io.netty.channel.socket.nio.NioSocketChannel) SocketChannel(io.netty.channel.socket.SocketChannel) Bootstrap(io.netty.bootstrap.Bootstrap) ChannelPipeline(io.netty.channel.ChannelPipeline)

Example 70 with ChannelPipeline

use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline in project ambry by linkedin.

the class Http2BlockingChannelStreamChannelInitializer method initChannel.

@Override
protected void initChannel(Channel ch) throws Exception {
    ChannelPipeline p = ch.pipeline();
    p.addLast(http2StreamFrameToHttpObjectCodec);
    p.addLast(new HttpObjectAggregator(http2ClientConfig.http2MaxContentLength));
    p.addLast(http2BlockingChannelResponseHandler);
    p.addLast(ambrySendToHttp2Adaptor);
}
Also used : HttpObjectAggregator(io.netty.handler.codec.http.HttpObjectAggregator) ChannelPipeline(io.netty.channel.ChannelPipeline)

Aggregations

ChannelPipeline (io.netty.channel.ChannelPipeline)370 SocketChannel (io.netty.channel.socket.SocketChannel)107 Channel (io.netty.channel.Channel)90 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)90 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)80 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)78 Bootstrap (io.netty.bootstrap.Bootstrap)77 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)69 ChannelFuture (io.netty.channel.ChannelFuture)68 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)62 HttpObjectAggregator (io.netty.handler.codec.http.HttpObjectAggregator)62 EventLoopGroup (io.netty.channel.EventLoopGroup)54 SslHandler (io.netty.handler.ssl.SslHandler)52 InetSocketAddress (java.net.InetSocketAddress)49 HttpServerCodec (io.netty.handler.codec.http.HttpServerCodec)43 LoggingHandler (io.netty.handler.logging.LoggingHandler)37 IOException (java.io.IOException)37 StringDecoder (io.netty.handler.codec.string.StringDecoder)36 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)36 StringEncoder (io.netty.handler.codec.string.StringEncoder)33