io.netty.handler.codec.http.HttpServerExpectContinueHandler Java Examples

The following examples show how to use io.netty.handler.codec.http.HttpServerExpectContinueHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpServerInitializer.java    From blade with Apache License 2.0 6 votes vote down vote up
@Override
protected void initChannel(SocketChannel ch) {
    ChannelPipeline pipeline = ch.pipeline();
    try {
        if (sslCtx != null) {
            pipeline.addLast(sslCtx.newHandler(ch.alloc()));
        }

        pipeline.addLast(new HttpServerCodec());
        pipeline.addLast(new HttpServerExpectContinueHandler());

        if (useGZIP) {
            pipeline.addLast(new HttpContentCompressor());
        }

        if (isWebSocket) {
            pipeline.addLast(new WebSocketHandler(blade));
        }
        pipeline.addLast(new MergeRequestHandler());
        pipeline.addLast(httpServerHandler);
    } catch (Exception e) {
        log.error("Add channel pipeline error", e);
    }
}
 
Example #2
Source File: HttpHelloWorldServerInitializer.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }
    p.addLast(new HttpServerCodec());
    p.addLast(new HttpServerExpectContinueHandler());
    p.addLast(new HttpHelloWorldServerHandler());
}
 
Example #3
Source File: HttpHelloWorldServerInitializer.java    From netty-learning-example with Apache License 2.0 5 votes vote down vote up
@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();
    /**
     * 或者使用HttpRequestDecoder & HttpResponseEncoder
     */
    p.addLast(new HttpServerCodec());
    /**
     * 在处理POST消息体时需要加上
     */
    p.addLast(new HttpObjectAggregator(1024*1024));
    p.addLast(new HttpServerExpectContinueHandler());
    p.addLast(new HttpHelloWorldServerHandler());
}
 
Example #4
Source File: WebsocketHandlerBuilder.java    From hxy-socket with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void buildChannelPipeline(ChannelPipeline pipeline) {
    pipeline.addLast(new HttpServerCodec());
    pipeline.addLast(new HttpServerExpectContinueHandler());
    pipeline.addLast(MsgOutboundHandler.INSTANCE);
    if(socketConfiguration.getProtocolType() == SocketConfiguration.ProtocolType.TEXT){
        pipeline.addLast(new DefaultTextWebSocketServerHandler());
    }else{
        pipeline.addLast(new ProtocolWebSocketServerHandler());
    }
}
 
Example #5
Source File: HttpHelloWorldServerInitializer.java    From tools-journey with Apache License 2.0 5 votes vote down vote up
@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }
    p.addLast(new HttpServerCodec());
    p.addLast(new HttpServerExpectContinueHandler());
    p.addLast(new HttpHelloWorldServerHandler());
}
 
Example #6
Source File: HttpMatcher.java    From cute-proxy with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void handlePipeline(ChannelPipeline pipeline) {
    pipeline.addLast(new HttpServerCodec());
    pipeline.addLast(new HttpServerExpectContinueHandler());
    pipeline.addLast(new HttpObjectAggregator(65536));
    pipeline.addLast(new ChunkedWriteHandler());
    pipeline.addLast(new HttpContentCompressor());
    pipeline.addLast(new HttpRequestHandler(sslContextManager));
}
 
Example #7
Source File: SSLDetector.java    From cute-proxy with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setHttpInterceptor(ChannelHandlerContext ctx, boolean ssl) {
    ctx.pipeline().addLast("http-codec", new HttpServerCodec());
    ctx.pipeline().addLast(new HttpServerExpectContinueHandler());
    ctx.pipeline().addLast("replay-handler", new ReplayHandler(outboundChannel));

    outboundChannel.pipeline().addLast("http-codec", new HttpClientCodec());
    var httpUpgradeHandler = new HttpUpgradeHandler(ssl, address, messageListener, ctx.pipeline());
    outboundChannel.pipeline().addLast("http-upgrade-handler", httpUpgradeHandler);
    var httpInterceptor = new HttpInterceptor(ssl, address, messageListener);
    outboundChannel.pipeline().addLast("http-interceptor", httpInterceptor);
    outboundChannel.pipeline().addLast("replay-handler", new ReplayHandler(ctx.channel()));
}
 
Example #8
Source File: WebWhoisProtocolsModule.java    From nomulus with Apache License 2.0 5 votes vote down vote up
@Provides
@HttpWhoisProtocol
static ImmutableList<Provider<? extends ChannelHandler>> providerHttpWhoisHandlerProviders(
    Provider<HttpServerCodec> httpServerCodecProvider,
    Provider<HttpServerExpectContinueHandler> httpServerExpectContinueHandlerProvider,
    @HttpWhoisProtocol Provider<WebWhoisRedirectHandler> webWhoisRedirectHandlerProvides) {
  return ImmutableList.of(
      httpServerCodecProvider,
      httpServerExpectContinueHandlerProvider,
      webWhoisRedirectHandlerProvides);
}
 
Example #9
Source File: WebWhoisProtocolsModule.java    From nomulus with Apache License 2.0 5 votes vote down vote up
@Provides
@HttpsWhoisProtocol
static ImmutableList<Provider<? extends ChannelHandler>> providerHttpsWhoisHandlerProviders(
    @HttpsWhoisProtocol
        Provider<SslServerInitializer<NioSocketChannel>> sslServerInitializerProvider,
    Provider<HttpServerCodec> httpServerCodecProvider,
    Provider<HttpServerExpectContinueHandler> httpServerExpectContinueHandlerProvider,
    @HttpsWhoisProtocol Provider<WebWhoisRedirectHandler> webWhoisRedirectHandlerProvides) {
  return ImmutableList.of(
      sslServerInitializerProvider,
      httpServerCodecProvider,
      httpServerExpectContinueHandlerProvider,
      webWhoisRedirectHandlerProvides);
}
 
Example #10
Source File: HttpProxyMatcher.java    From cute-proxy with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void handlePipeline(ChannelPipeline pipeline) {
    pipeline.addLast(new HttpServerCodec());
    pipeline.addLast("", new HttpServerExpectContinueHandler());
    pipeline.addLast(new HttpProxyHandler(messageListener, proxyHandlerSupplier));
}
 
Example #11
Source File: WebWhoisProtocolsModule.java    From nomulus with Apache License 2.0 4 votes vote down vote up
@Provides
static HttpServerExpectContinueHandler provideHttpServerExpectContinueHandler() {
  return new HttpServerExpectContinueHandler();
}