org.jboss.netty.handler.codec.http.HttpClientCodec Java Examples

The following examples show how to use org.jboss.netty.handler.codec.http.HttpClientCodec. 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: FileClientPipelineFactory.java    From netty-file-parent with Apache License 2.0 5 votes vote down vote up
public ChannelPipeline getPipeline() throws Exception {
	ChannelPipeline pipeline = Channels.pipeline();
	this.clientHandler = new FileClientHandler();
	pipeline.addLast("codec", new HttpClientCodec());
	pipeline.addLast("inflater", new HttpContentDecompressor());
	pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
	pipeline.addLast("handler", this.clientHandler); //具体文件处理句柄
	return pipeline;
}
 
Example #2
Source File: NettyAsyncHttpProvider.java    From ck with Apache License 2.0 5 votes vote down vote up
void configure(final boolean useSSL, final ConnectListener<?> cl){

		bootstrap.setPipelineFactory(new ChannelPipelineFactory() {

			/* @Override */
			public ChannelPipeline getPipeline() throws Exception {
				ChannelPipeline pipeline = pipeline();

				if (useSSL){
					try{
						SSLEngine sslEngine = config.getSSLEngine();
						if (sslEngine == null){
							sslEngine = SslUtils.getSSLEngine();
						}
						pipeline.addLast("ssl", new SslHandler(sslEngine));
					} catch (Throwable ex){
						cl.future().abort(ex);
					}
				}

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

				if (config.isCompressionEnabled()) {
					pipeline.addLast("inflater", new HttpContentDecompressor());
				}
				pipeline.addLast("httpProcessor", NettyAsyncHttpProvider.this);
				return pipeline;
			}
		});
	}
 
Example #3
Source File: HttpInvoker.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("codec", new HttpClientCodec());
    pipeline.addLast("aggregator", new HttpChunkAggregator(settings.getAsInt("http.client.maxchunksize", 10 * 1024 * 1024)));
    pipeline.addLast("inflater", new HttpContentDecompressor());
    pipeline.addLast("handler", new HttpInvoker.HttpResponseHandler());
    return pipeline;
}
 
Example #4
Source File: HttpElasticsearchClient.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("codec", new HttpClientCodec());
    pipeline.addLast("aggregator", new HttpChunkAggregator(settings.getAsInt("http.client.maxchunksize", 10 * 1024 * 1024)));
    pipeline.addLast("inflater", new HttpContentDecompressor());
    pipeline.addLast("handler", new HttpResponseHandler());
    return pipeline;
}