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


Java HttpResponseEncoder類代碼示例

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


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

示例1: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
  ChannelPipeline pipeline = Channels.pipeline();
  if (sslFactory != null) {
    pipeline.addLast("ssl", new SslHandler(sslFactory.createSSLEngine()));
  }
  pipeline.addLast("decoder", new HttpRequestDecoder());
  pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16));
  pipeline.addLast("encoder", new HttpResponseEncoder());
  pipeline.addLast("chunking", new ChunkedWriteHandler());
  pipeline.addLast("shuffle", SHUFFLE);
  return pipeline;
  // TODO factor security manager into pipeline
  // TODO factor out encode/decode to permit binary shuffle
  // TODO factor out decode of index to permit alt. models
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:17,代碼來源:ShuffleHandler.java

示例2: startHttpServer

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
private ServerBootstrap startHttpServer(int port,
    final Token<DelegationTokenIdentifier> token, final URI url) {
  ServerBootstrap bootstrap = new ServerBootstrap(
      new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
          Executors.newCachedThreadPool()));

  bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
    @Override
    public ChannelPipeline getPipeline() throws Exception {
      return Channels.pipeline(new HttpRequestDecoder(),
          new HttpChunkAggregator(65536), new HttpResponseEncoder(),
          new CredentialsLogicHandler(token, url.toString()));
    }
  });
  bootstrap.bind(new InetSocketAddress("localhost", port));
  return bootstrap;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:18,代碼來源:TestDelegationTokenRemoteFetcher.java

示例3: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
	HttpRequestHandler httpRequestHandler = new HttpRequestHandler();
	httpRequestHandler.setSettings(settings);
	httpRequestHandler.setApplicationContext(applicationContext);

	ChannelPipeline pipeline = Channels.pipeline();

	if (settings.getKeepAliveTimeout() > 0) {
		pipeline.addLast("idle", new IdleStateHandler(timer, 0, 0, settings.getKeepAliveTimeout()));
		pipeline.addLast("timeout", httpTimeoutHandler);
	}

	pipeline.addLast("decoder", new HttpRequestDecoder());
	pipeline.addLast("encoder", new HttpResponseEncoder());
	pipeline.addLast("handler", httpRequestHandler);

	return pipeline;
}
 
開發者ID:iceize,項目名稱:netty-http-3.x,代碼行數:20,代碼來源:HttpPipelineFactory.java

示例4: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
	RemoteRequestHandler remoteRequestHandler = new RemoteRequestHandler();
	remoteRequestHandler.setSettings(settings);
	remoteRequestHandler.setApplicationContext(applicationContext);

	ChannelPipeline pipeline = Channels.pipeline();

	if (settings.getKeepAliveTimeout() > 0) {
		pipeline.addLast("idle", new IdleStateHandler(timer, 0, 0, settings.getKeepAliveTimeout()));
		pipeline.addLast("timeout", httpTimeoutHandler);
	}

	pipeline.addLast("decoder", new HttpRequestDecoder());
	pipeline.addLast("encoder", new HttpResponseEncoder());
	pipeline.addLast("handler", remoteRequestHandler);

	return pipeline;
}
 
開發者ID:iceize,項目名稱:netty-http-3.x,代碼行數:20,代碼來源:RemotePipelineFactory.java

示例5: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
    // Create a default pipeline implementation.
    ChannelPipeline pipeline = Channels.pipeline();

    SslHandler sslHandler = configureServerSSLOnDemand();
    if (sslHandler != null) {
        LOG.debug("Server SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
        pipeline.addLast("ssl", sslHandler);
    }

    pipeline.addLast("decoder", new HttpRequestDecoder(4096, configuration.getMaxHeaderSize(), 8192));
    if (configuration.isChunked()) {
        pipeline.addLast("aggregator", new HttpChunkAggregator(configuration.getChunkedMaxContentLength()));
    }
    pipeline.addLast("encoder", new HttpResponseEncoder());
    if (configuration.isCompression()) {
        pipeline.addLast("deflater", new HttpContentCompressor());
    }

    pipeline.addLast("handler", channelFactory.getChannelHandler());

    return pipeline;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:25,代碼來源:HttpServerSharedPipelineFactory.java

示例6: initServer

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
/**
 * Start WebImageViewer.
 * @param fsimage the fsimage to load.
 * @throws IOException if fail to load the fsimage.
 */
@VisibleForTesting
public void initServer(String fsimage) throws IOException {
  FSImageLoader loader = FSImageLoader.load(fsimage);

  ChannelPipeline pipeline = Channels.pipeline();
  pipeline.addLast("channelTracker", new SimpleChannelUpstreamHandler() {
    @Override
    public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
        throws Exception {
      allChannels.add(e.getChannel());
    }
  });
  pipeline.addLast("httpDecoder", new HttpRequestDecoder());
  pipeline.addLast("requestHandler", new FSImageHandler(loader));
  pipeline.addLast("stringEncoder", new StringEncoder());
  pipeline.addLast("httpEncoder", new HttpResponseEncoder());
  bootstrap.setPipeline(pipeline);
  channel = bootstrap.bind(address);
  allChannels.add(channel);

  address = (InetSocketAddress) channel.getLocalAddress();
  LOG.info("WebImageViewer started. Listening on " + address.toString()
      + ". Press Ctrl+C to stop the viewer.");
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:30,代碼來源:WebImageViewer.java

示例7: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
  ChannelPipeline pipeline = Channels.pipeline();
  if (sslFactory != null) {
    pipeline.addLast("ssl", new SslHandler(sslFactory.createSSLEngine()));
  }
  pipeline.addLast("decoder", new HttpRequestDecoder());
  pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16));
  pipeline.addLast("encoder", new HttpResponseEncoder());
  pipeline.addLast("chunking", new ChunkedWriteHandler());
  pipeline.addLast("shuffle", SHUFFLE);
  pipeline.addLast("idle", idleStateHandler);
  pipeline.addLast(TIMEOUT_HANDLER, new TimeoutHandler());
  return pipeline;
  // TODO factor security manager into pipeline
  // TODO factor out encode/decode to permit binary shuffle
  // TODO factor out decode of index to permit alt. models
}
 
開發者ID:hopshadoop,項目名稱:hops,代碼行數:19,代碼來源:ShuffleHandler.java

示例8: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
public ChannelPipeline getPipeline() throws Exception {
  // Create a default pipeline implementation.
  ChannelPipeline pipeline = pipeline();

  // Uncomment the following line if you want HTTPS
  // SSLEngine engine =
  // SecureChatSslContextFactory.getServerContext().createSSLEngine();
  // engine.setUseClientMode(false);
  // pipeline.addLast("ssl", new SslHandler(engine));

  pipeline.addLast("decoder", new HttpRequestDecoder());
  //pipeline.addLast("aggregator", new HttpChunkAggregator(65536));
  pipeline.addLast("encoder", new HttpResponseEncoder());
  pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
  //pipeline.addLast("deflater", new HttpContentCompressor());
  pipeline.addLast("handler", new HttpDataServerHandler(ret));
  return pipeline;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:19,代碼來源:HttpDataServerPipelineFactory.java

示例9: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
public ChannelPipeline getPipeline() throws Exception {
  // Create a default pipeline implementation.
  ChannelPipeline pipeline = pipeline();

  // Uncomment the following line if you want HTTPS
  // SSLEngine engine =
  // SecureChatSslContextFactory.getServerContext().createSSLEngine();
  // engine.setUseClientMode(false);
  // pipeline.addLast("ssl", new SslHandler(engine));

  pipeline.addLast("decoder", new HttpRequestDecoder());
  //pipeline.addLast("aggregator", new HttpChunkAggregator(65536));
  pipeline.addLast("encoder", new HttpResponseEncoder());
  pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
  pipeline.addLast("deflater", new HttpContentCompressor());
  pipeline.addLast("handler", new HttpDataServerHandler(userName, appId));
  return pipeline;
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:19,代碼來源:HttpDataServerPipelineFactory.java

示例10: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
@Override
    public ChannelPipeline getPipeline( ) throws Exception
    {
        ChannelPipeline pipeline = pipeline( ) ;
        
        //Descomentar se for usar HTTPS
//        SSLEngine engine = SecureChatSslContextFactory.getServerContext( ).createSSLEngine( ) ;
//        engine.setUseClientMode( false ) ;
//        pipeline.addLast( "ssl", new SslHandler( engine ) ) ;
        
        pipeline.addLast( "decoder", new HttpRequestDecoder( ) ) ;
        pipeline.addLast( "aggregator", new HttpChunkAggregator( 65536 ) ) ;
        pipeline.addLast( "encoder", new HttpResponseEncoder( ) ) ;
        pipeline.addLast( "chunkedWriter", new ChunkedWriteHandler( ) ) ;
        
        pipeline.addLast( "handler", new BettaUdpFileServerHandler( ) ) ;
        
        return pipeline ;
    }
 
開發者ID:wsyssantos,項目名稱:BettaServer,代碼行數:20,代碼來源:BettaUdpFileServerPipelineFactory.java

示例11: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
public ChannelPipeline getPipeline() throws Exception {

        Integer max = Integer.valueOf(Play.configuration.getProperty("play.netty.maxContentLength", "-1"));
           
        ChannelPipeline pipeline = pipeline();
        PlayHandler playHandler = new PlayHandler();
        
        pipeline.addLast("flashPolicy", new FlashPolicyHandler()); 
        pipeline.addLast("decoder", new HttpRequestDecoder());
        pipeline.addLast("aggregator", new StreamChunkAggregator(max));
        pipeline.addLast("encoder", new HttpResponseEncoder());
        pipeline.addLast("chunkedWriter", playHandler.chunkedWriteHandler);
        pipeline.addLast("handler", playHandler);

        return pipeline;
    }
 
開發者ID:eBay,項目名稱:restcommander,代碼行數:17,代碼來源:HttpServerPipelineFactory.java

示例12: run

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
public void run() {
	// Configure the server.
	ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));

	// Set up the event pipeline factory.
	bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
		public ChannelPipeline getPipeline() {
			ChannelPipeline pipeline = Channels.pipeline();

			pipeline.addLast("decoder", new HttpRequestDecoder());
			pipeline.addLast("aggregator", new HttpChunkAggregator(65536));
			pipeline.addLast("encoder", new HttpResponseEncoder());
			pipeline.addLast("handler", new HttpHandler());
			return pipeline;
		}
	});

	bootstrap.setOption("child.reuseAddress", true);
	bootstrap.setOption("child.tcpNoDelay", true);
	bootstrap.setOption("child.keepAlive", false);

	// Bind and start to accept incoming connections.
	bootstrap.bind(new InetSocketAddress(port));
}
 
開發者ID:violetgo,項目名稱:wifidogAuthServer,代碼行數:25,代碼來源:HttpServer.java

示例13: getChannelPipelineFactory

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
/**
 * handle http 
 */
protected ChannelPipelineFactory getChannelPipelineFactory(){
	return new ChannelPipelineFactory(){

		public ChannelPipeline getPipeline()
				throws Exception{

			// Create a default pipeline implementation.
			ChannelPipeline pipeline = Channels.pipeline();


			pipeline.addLast("decoder", new HttpRequestDecoder());
			pipeline.addLast("encoder", new HttpResponseEncoder());
			pipeline.addLast("channel", channel);

			return pipeline;
		}
	};
}
 
開發者ID:lgnlgn,項目名稱:feluca,代碼行數:22,代碼來源:LeaderServer.java

示例14: getChannelPipelineFactory

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
protected ChannelPipelineFactory getChannelPipelineFactory(){
	return new ChannelPipelineFactory(){

		public ChannelPipeline getPipeline()
				throws Exception{
			// Create a default pipeline implementation.
			ChannelPipeline pipeline = Channels.pipeline();

			pipeline.addLast("decoder", new HttpRequestDecoder());
			pipeline.addLast("encoder", new HttpResponseEncoder());
			pipeline.addLast("channel", channel);

			return pipeline;
		}
	};
}
 
開發者ID:lgnlgn,項目名稱:feluca,代碼行數:17,代碼來源:WorkerServer.java

示例15: getPipeline

import org.jboss.netty.handler.codec.http.HttpResponseEncoder; //導入依賴的package包/類
@Override
public ChannelPipeline getPipeline() {
	ChannelPipeline pipeline = Channels.pipeline();

	// decoders
	pipeline.addLast("decoder", new HttpRequestDecoder());
	pipeline.addLast("chunker", new HttpChunkAggregator(MAX_REQUEST_LENGTH));

	// encoders
	pipeline.addLast("encoder", new HttpResponseEncoder());

	// handler
	pipeline.addLast("timeout", new IdleStateHandler(timer, NetworkConstants.IDLE_TIME, 0, 0));
	pipeline.addLast("handler", handler);

	return pipeline;
}
 
開發者ID:DealerNextDoor,項目名稱:ApolloDev,代碼行數:18,代碼來源:HttpPipelineFactory.java


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