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


Java HttpServer.setPort方法代碼示例

本文整理匯總了Java中com.neverwinterdp.netty.http.HttpServer.setPort方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpServer.setPort方法的具體用法?Java HttpServer.setPort怎麽用?Java HttpServer.setPort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.neverwinterdp.netty.http.HttpServer的用法示例。


在下文中一共展示了HttpServer.setPort方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import com.neverwinterdp.netty.http.HttpServer; //導入方法依賴的package包/類
static public void main(String[] args) throws Exception {
  Options options = new Options() ;
  JCommander jcommander = new JCommander(options, args) ;
  jcommander.usage(); 
  
  LoggerFactory lfactory = new LoggerFactory() ;
  MetricRegistry mRegistry = new MetricRegistry() ;
  
  HttpServer server = new HttpServer() ;
  server.setLoggerFactory(lfactory) ;
  server.setPort(options.httpListenPort) ;
  
  MessageForwarder forwarder = null ;
  if("kafka".equals(options.forwarder)) {
    forwarder = new KafkaMessageForwarder(lfactory, mRegistry, options.kafkaParams) ;
  } else {
    forwarder = new NullDevMessageForwarder(options.sparknginParams) ;
  }
  Sparkngin sparkngin = new Sparkngin(mRegistry, forwarder, options.dataDir) ;
  server.add("/message/json", new JSONMessageRouteHandler(sparkngin));
  server.add("/message/jbinary", new JBinaryMessageRouteHandler(sparkngin));
  server.add("/tracker/:trackerName/:site", new TrackingPixelRouteHandler(sparkngin, options.sparknginParams));
  server.startAsDeamon() ;
  Thread.currentThread().join();
}
 
開發者ID:DemandCube,項目名稱:Sparkngin,代碼行數:26,代碼來源:Main.java

示例2: start

import com.neverwinterdp.netty.http.HttpServer; //導入方法依賴的package包/類
public void start() throws Exception {
  logger.info("Start start()");
  logger.info("Properties:\n" + JSONSerializer.INSTANCE.toString(serviceInfo)) ;
  server = new HttpServer() ;
  server.setPort(serviceInfo.httpListenPort()) ;
  server.setLoggerFactory(loggerFactory) ;
  if(serviceInfo.wwwDir() != null) {
    StaticFileHandler fileHandler = new StaticFileHandler(serviceInfo.wwwDir()) ;
    fileHandler.setLogger(loggerFactory.getLogger(StaticFileHandler.class)) ;
    server.setDefault(fileHandler) ;
  }
  
  server.add("/message/json", new JSONMessageRouteHandler(sparkngin));
  server.add("/message/jbinary", new JBinaryMessageRouteHandler(sparkngin));
  server.add("/tracker/:trackerName/:site", new TrackingPixelRouteHandler(sparkngin, serviceInfo.getProperties()));
  server.startAsDeamon();
  logger.info("Finish start()");
}
 
開發者ID:DemandCube,項目名稱:Sparkngin,代碼行數:19,代碼來源:SparknginHttpConnectorService.java

示例3: HttpServerSimulator

import com.neverwinterdp.netty.http.HttpServer; //導入方法依賴的package包/類
public HttpServerSimulator(int numOfWorkers, int minProcessTime, int maxProcessTime) {
  server = new HttpServer();
  handler = new MessageHandler();
  server.add("/message", handler);
  server.setPort(7080);
  server.setNumberOfWorkers(numOfWorkers);
  handler.setMinProcessTime(minProcessTime);
  handler.setMaxProcessTime(maxProcessTime);
}
 
開發者ID:DemandCube,項目名稱:DemandSpike,代碼行數:10,代碼來源:HttpServerSimulator.java

示例4: NettyHttpService

import com.neverwinterdp.netty.http.HttpServer; //導入方法依賴的package包/類
public NettyHttpService(AppMaster appMaster, int port) throws Exception {
  server = new HttpServer();
  server.setPort(port) ;
  InfoRouteHandler infoHandler = new InfoRouteHandler(appMaster) ;
  server.add("/"    ,         infoHandler);
  server.add("/info",         infoHandler);
  server.add("/info/:view",   infoHandler);
  server.add("/info/container/:id",   infoHandler);
  server.add("/rest/:res",  new AppRestRouteHandler(appMaster));
}
 
開發者ID:DemandCube,項目名稱:NeverwinterDP-Commons,代碼行數:11,代碼來源:NettyHttpService.java

示例5: setup

import com.neverwinterdp.netty.http.HttpServer; //導入方法依賴的package包/類
@Before
public void setup() throws Exception {
  FileUtil.removeIfExist("build/queue", false) ;
  forwarder = new NullDevMessageForwarder() ;
  server = new HttpServer() ;
  server.setPort(7080) ;
  metricRegistry = new MetricRegistry() ;
  sparkngin = new Sparkngin(metricRegistry, forwarder, "build/queue/data") ;
  server.add("/message/json", new JSONMessageRouteHandler(sparkngin)) ;
  server.startAsDeamon() ;
}
 
開發者ID:DemandCube,項目名稱:Sparkngin,代碼行數:12,代碼來源:SparknginAppenderUnitTest.java

示例6: SparknginServer

import com.neverwinterdp.netty.http.HttpServer; //導入方法依賴的package包/類
public SparknginServer() throws Exception {
  FileUtil.removeIfExist("build/queue", false) ;
  forwarder = new NullDevMessageForwarder() ;
  server = new HttpServer() ;
  server.setPort(7080) ;
  metricRegistry = new MetricRegistry() ;
  server.add("/message/json", new JSONMessageRouteHandler(new Sparkngin(metricRegistry, forwarder, "build/queue/data"))) ;
  server.setDefault(new StaticFileHandler(".")) ;
  server.startAsDeamon() ;
  Thread.sleep(2000) ;
}
 
開發者ID:DemandCube,項目名稱:Sparkngin,代碼行數:12,代碼來源:SparknginServer.java


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