當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpContentDecompressor類代碼示例

本文整理匯總了Java中io.netty.handler.codec.http.HttpContentDecompressor的典型用法代碼示例。如果您正苦於以下問題:Java HttpContentDecompressor類的具體用法?Java HttpContentDecompressor怎麽用?Java HttpContentDecompressor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HttpContentDecompressor類屬於io.netty.handler.codec.http包,在下文中一共展示了HttpContentDecompressor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
/**
 * Adds pipelines to channel.
 * 
 *  @param ch channel to be operated on
 */
protected void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline pipe = ch.pipeline();

  if (ssl) {
    // HTTPs connection
    SSLEngine sslEng = getSsl(null);
    sslEng.setUseClientMode(true);
    pipe.addLast("SSL", new SslHandler(sslEng, false));
  }

  pipe.addFirst("Timer", new ReadTimeoutHandler(30));
  pipe.addLast("Codec", new HttpClientCodec());
  pipe.addLast("Inflater", new HttpContentDecompressor());
  pipe.addLast("Handler", new HTTPMessageHandler(builder));
}
 
開發者ID:didclab,項目名稱:onedatashare,代碼行數:21,代碼來源:HTTPInitializer.java

示例2: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
    public void initChannel(SocketChannel ch) throws Exception {
        // Create a default pipeline implementation.
        ChannelPipeline p = ch.pipeline();

        p.addLast("log", new LoggingHandler(LogLevel.INFO));
        // Enable HTTPS if necessary.
/*        if (ssl) {
            SSLEngine engine =
                SecureChatSslContextFactory.getClientContext().createSSLEngine();
            engine.setUseClientMode(true);

            p.addLast("ssl", new SslHandler(engine));
        }*/

        p.addLast("codec", new HttpClientCodec());

        // Remove the following line if you don't want automatic content decompression.
        p.addLast("inflater", new HttpContentDecompressor());

        // Uncomment the following line if you don't want to handle HttpChunks.
        //p.addLast("aggregator", new HttpObjectAggregator(1048576));

        p.addLast("handler", new HttpSnoopClientHandler());
    }
 
開發者ID:eBay,項目名稱:ServiceCOLDCache,代碼行數:26,代碼來源:HttpSnoopClientInitializer.java

示例3: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline pipeline = ch.pipeline();

    if (sslCtx != null) {
        pipeline.addLast("ssl", sslCtx.newHandler(ch.alloc()));
    }

    pipeline.addLast("codec", new HttpClientCodec());

    // Remove the following line if you don't want automatic content decompression.
    pipeline.addLast("inflater", new HttpContentDecompressor());

    // to be used since huge file transfer
    pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());

    pipeline.addLast("handler", new HttpUploadClientHandler());
}
 
開發者ID:cowthan,項目名稱:JavaAyo,代碼行數:19,代碼來源:HttpUploadClientIntializer.java

示例4: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();

    // Enable HTTPS if necessary.
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }

    p.addLast(new HttpClientCodec());

    // Remove the following line if you don't want automatic content decompression.
    p.addLast(new HttpContentDecompressor());

    // Uncomment the following line if you don't want to handle HttpContents.
    //p.addLast(new HttpObjectAggregator(1048576));

    p.addLast(new HttpSnoopClientHandler());
}
 
開發者ID:cowthan,項目名稱:JavaAyo,代碼行數:20,代碼來源:HttpSnoopClientInitializer.java

示例5: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
	public void initChannel(SocketChannel ch) {
		ChannelPipeline pipeline = ch.pipeline();

		// Enable HTTPS if necessary.
//		if (sslCtx != null) {
//			pipeline.addLast(sslCtx.newHandler(ch.alloc()));
//		}

		pipeline.addLast(new HttpClientCodec());
		// Remove the following line if you don't want automatic content decompression.
		pipeline.addLast(new HttpContentDecompressor());

		// Uncomment the following line if you don't want to handle HttpContents.
		//pipeline.addLast(new HttpObjectAggregator(65536));
		pipeline.addLast(new HttpObjectAggregator(65536 * 3));

		
//		pipeline.addLast(new HttpClientHandler(null, mHttpClientListener));
	}
 
開發者ID:iotoasis,項目名稱:SI,代碼行數:21,代碼來源:HttpClientInitializer.java

示例6: configNewChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
public void configNewChannel(NioSocketChannel channel) {
    super.configNewChannel(channel);
    ChannelPipeline pipeline = channel.pipeline();
    // 添加 SSL 數據支持
    if (requestConfig.https()) {
        SslContext sslContent = NettyCenter.singleInstance().getSimpleClientSslContext();
        SSLEngine engine = sslContent.newEngine(channel.alloc());
        pipeline.addLast("ssl", new SslHandler(engine));
    }
    // 客戶端接收到的是httpResponse響應,所以要使用HttpResponseDecoder進行解碼
    pipeline.addLast("decoder", new HttpResponseDecoder());
    // 客戶端發送的是httprequest,所以要使用HttpRequestEncoder進行編碼
    pipeline.addLast("encoder", new HttpRequestEncoder());
    // 接收的請求累計器
    pipeline.addLast("aggegator", new HttpObjectAggregator(0x30000));
    // mime 類型寫出
    pipeline.addLast("streamew", new ChunkedWriteHandler());
    // 添加解壓器
    pipeline.addLast("decompressor", new HttpContentDecompressor());
    // add new handler
    pipeline.addLast("handler", new NettyHttpRequestChannelHandler());
}
 
開發者ID:316181444,項目名稱:GameServerFramework,代碼行數:24,代碼來源:NHttpRequest.java

示例7: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
protected void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline pipeline = ch.pipeline();
  //inbound handler
  pipeline.addLast(new HttpRequestDecoder());
  pipeline.addLast(new HttpContentDecompressor());

  //outbound handler
  pipeline.addLast(new HttpResponseEncoder());
  pipeline.addLast(new HttpContentCompressor());
  //pipeline.addLast(new ChunkedWriteHandler());
  
  pipeline.addLast(new HttpObjectAggregator(this.sc.getSize()));
  pipeline.addLast(this.galeHttpHandler);
  
}
 
開發者ID:dadooteam,項目名稱:gale,代碼行數:17,代碼來源:GaleServerInitializer.java

示例8: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();

    // Enable HTTPS if necessary.
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }

    p.addLast(new HttpClientCodec());

    // Remove the following line if you don't want automatic content decompression.
    p.addLast(new HttpContentDecompressor());

    // Uncomment the following line if you don't want to handle HttpContents.
    //p.addLast(new HttpObjectAggregator(1048576));
    p.addLast(handler);
}
 
開發者ID:FIWARE-Middleware,項目名稱:KIARA,代碼行數:19,代碼來源:URILoader.java

示例9: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
public void initChannel(SocketChannel ch) throws Exception {
    // Create a default pipeline implementation.
    ChannelPipeline pipeline = ch.pipeline();

    if (ssl) {
        SSLEngine engine = SecureChatSslContextFactory.getClientContext().createSSLEngine();
        engine.setUseClientMode(true);
        pipeline.addLast("ssl", new SslHandler(engine));
    }

    pipeline.addLast("codec", new HttpClientCodec());

    // Remove the following line if you don't want automatic content decompression.
    pipeline.addLast("inflater", new HttpContentDecompressor());

    // to be used since huge file transfer
    pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());

    pipeline.addLast("handler", new HttpUploadClientHandler());
}
 
開發者ID:kyle-liu,項目名稱:netty4study,代碼行數:22,代碼來源:HttpUploadClientIntializer.java

示例10: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
public void initChannel(SocketChannel ch) throws Exception {
    // Create a default pipeline implementation.
    ChannelPipeline p = ch.pipeline();

    p.addLast("log", new LoggingHandler(LogLevel.INFO));
    // Enable HTTPS if necessary.
    if (ssl) {
        SSLEngine engine =
            SecureChatSslContextFactory.getClientContext().createSSLEngine();
        engine.setUseClientMode(true);

        p.addLast("ssl", new SslHandler(engine));
    }

    p.addLast("codec", new HttpClientCodec());

    // Remove the following line if you don't want automatic content decompression.
    p.addLast("inflater", new HttpContentDecompressor());

    // Uncomment the following line if you don't want to handle HttpChunks.
    //p.addLast("aggregator", new HttpObjectAggregator(1048576));

    p.addLast("handler", new HttpSnoopClientHandler());
}
 
開發者ID:kyle-liu,項目名稱:netty4study,代碼行數:26,代碼來源:HttpSnoopClientInitializer.java

示例11: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();

    // Enable HTTPS if necessary.
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }

    p.addLast(new HttpClientCodec());

    // Remove the following line if you don't want automatic content decompression.
    p.addLast(new HttpContentDecompressor());

    // Uncomment the following line if you don't want to handle HttpContents.
    p.addLast(new HttpObjectAggregator(1048576));

    p.addLast(nettyHttpClientHandler);
}
 
開發者ID:apptik,項目名稱:jus,代碼行數:20,代碼來源:NettyClientInit.java

示例12: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
    public void initChannel(SocketChannel ch) {
        ChannelPipeline pipeline = ch.pipeline();

        pipeline.addLast("http-request-decoder", new HttpRequestDecoder());
        pipeline.addLast("deflater", new HttpContentDecompressor());
        pipeline.addLast("http-object-aggregator", new HttpObjectAggregator(1048576));
        pipeline.addLast("http-response-encoder", new HttpResponseEncoder());
        pipeline.addLast("inflater", new HttpContentCompressor());

        // Alters the pipeline depending on either REST or WebSockets requests
        pipeline.addLast("api-protocol-switcher", apiProtocolSwitcher);
        pipeline.addLast("debugger", debugger);

        // Logging handlers for API requests
        pipeline.addLast("api-request-logger", apiRequestLogger);

//        pipeline.addLast(rxJavaGroup, "rxjava-handler", rxjavaHandler);

        // JAX-RS handlers
        pipeline.addLast(jaxRsGroup, "jax-rs-handler", jaxRsHandlers);
    }
 
開發者ID:kalixia,項目名稱:kha,代碼行數:23,代碼來源:ApiServerChannelInitializer.java

示例13: switchToHttp

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
private void switchToHttp(ChannelHandlerContext ctx, ByteBuf msg) {
    ChannelPipeline pipeline = ctx.pipeline();

    addLastIfNotPresent(pipeline, new HttpServerCodec(8192, 8192, 8192));
    addLastIfNotPresent(pipeline, new HttpContentDecompressor());
    addLastIfNotPresent(pipeline, httpContentLengthRemover);
    addLastIfNotPresent(pipeline, new HttpObjectAggregator(Integer.MAX_VALUE));

    if (mockServerLogger.isEnabled(TRACE)) {
        addLastIfNotPresent(pipeline, loggingHandler);
    }
    configurePipeline(ctx, pipeline);
    pipeline.remove(this);

    ctx.channel().attr(LOCAL_HOST_HEADERS).set(getLocalAddresses(ctx));

    // fire message back through pipeline
    ctx.fireChannelRead(msg);
}
 
開發者ID:jamesdbloom,項目名稱:mockserver,代碼行數:20,代碼來源:PortUnificationHandler.java

示例14: prepare

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override public void prepare(final Benchmark benchmark) {
  this.concurrencyLevel = benchmark.concurrencyLevel;
  this.targetBacklog = benchmark.targetBacklog;

  ChannelInitializer<SocketChannel> channelInitializer = new ChannelInitializer<SocketChannel>() {
    @Override public void initChannel(SocketChannel channel) throws Exception {
      ChannelPipeline pipeline = channel.pipeline();

      if (benchmark.tls) {
        SslClient sslClient = SslClient.localhost();
        SSLEngine engine = sslClient.sslContext.createSSLEngine();
        engine.setUseClientMode(true);
        pipeline.addLast("ssl", new SslHandler(engine));
      }

      pipeline.addLast("codec", new HttpClientCodec());
      pipeline.addLast("inflater", new HttpContentDecompressor());
      pipeline.addLast("handler", new HttpChannel(channel));
    }
  };

  bootstrap = new Bootstrap();
  bootstrap.group(new NioEventLoopGroup(concurrencyLevel))
      .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
      .channel(NioSocketChannel.class)
      .handler(channelInitializer);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:28,代碼來源:NettyHttpClient.java

示例15: initChannel

import io.netty.handler.codec.http.HttpContentDecompressor; //導入依賴的package包/類
@Override
protected void initChannel(Channel ch) throws Exception {
    ch.pipeline().addLast("openChannels", transport.serverOpenChannels);
    final HttpRequestDecoder decoder = new HttpRequestDecoder(
        Math.toIntExact(transport.maxInitialLineLength.getBytes()),
        Math.toIntExact(transport.maxHeaderSize.getBytes()),
        Math.toIntExact(transport.maxChunkSize.getBytes()));
    decoder.setCumulator(ByteToMessageDecoder.COMPOSITE_CUMULATOR);
    ch.pipeline().addLast("decoder", decoder);
    ch.pipeline().addLast("decoder_compress", new HttpContentDecompressor());
    ch.pipeline().addLast("encoder", new HttpResponseEncoder());
    final HttpObjectAggregator aggregator = new HttpObjectAggregator(Math.toIntExact(transport.maxContentLength.getBytes()));
    if (transport.maxCompositeBufferComponents != -1) {
        aggregator.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents);
    }
    ch.pipeline().addLast("aggregator", aggregator);
    if (transport.compression) {
        ch.pipeline().addLast("encoder_compress", new HttpContentCompressor(transport.compressionLevel));
    }
    if (SETTING_CORS_ENABLED.get(transport.settings())) {
        ch.pipeline().addLast("cors", new Netty4CorsHandler(transport.getCorsConfig()));
    }
    if (transport.pipelining) {
        ch.pipeline().addLast("pipelining", new HttpPipeliningHandler(transport.pipeliningMaxEvents));
    }
    ch.pipeline().addLast("handler", requestHandler);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:28,代碼來源:Netty4HttpServerTransport.java


注:本文中的io.netty.handler.codec.http.HttpContentDecompressor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。