当前位置: 首页>>代码示例>>Java>>正文


Java WebClientOptions.setKeepAlive方法代码示例

本文整理汇总了Java中io.vertx.ext.web.client.WebClientOptions.setKeepAlive方法的典型用法代码示例。如果您正苦于以下问题:Java WebClientOptions.setKeepAlive方法的具体用法?Java WebClientOptions.setKeepAlive怎么用?Java WebClientOptions.setKeepAlive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.ext.web.client.WebClientOptions的用法示例。


在下文中一共展示了WebClientOptions.setKeepAlive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import io.vertx.ext.web.client.WebClientOptions; //导入方法依赖的package包/类
@Override
 public void start() throws Exception {
tradingPair = config().getString("tradingPair");
handleFillsMessage = MessageDefinitions.HANDLE_FILLS+":"+tradingPair;
initOrderBookMessage = MessageDefinitions.INIT_ORDERBOOK+":"+tradingPair;
updateOrderBookMessage = MessageDefinitions.UPDATE_ORDERBOOK+":"+tradingPair;
setTicksMessage = MessageDefinitions.SET_LASTTICKS+":"+tradingPair;

tickIntervalStrings = new HashMap<Integer, String>();
tickIntervalStrings.put(1, "oneMin");
tickIntervalStrings.put(5, "fiveMin");
tickIntervalStrings.put(30, "thirtyMin");
tickIntervalStrings.put(60, "hour");
tickIntervalStrings.put(24*60, "day");

String userAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36";
WebClientOptions options = new WebClientOptions().setUserAgent(userAgent);
headers.add("User-Agent", userAgent);
   
options.setKeepAlive(false);
restclient = WebClient.create(vertx, options);
getConnectionToken();



 }
 
开发者ID:AlxGDev,项目名称:BittrexGatherer,代码行数:27,代码来源:BittrexRemoteVerticle.java

示例2: start

import io.vertx.ext.web.client.WebClientOptions; //导入方法依赖的package包/类
@Override
 public void start() throws Exception {
 String tradingPair="BTC-ARK";
 config = new JsonObject()
			.put("tradingPair", tradingPair);
 
String userAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36";
WebClientOptions webclientoptions = new WebClientOptions().setUserAgent(userAgent);
webclientoptions.setKeepAlive(false);
restclient = WebClient.create(vertx, webclientoptions);

vertx.eventBus()
  	.<String>consumer(MessageDefinitions.REDEPLOYBITTREXVERTICLES)
  	.handler(handleVerticleRedeploy());

options = new DeploymentOptions();
options.setConfig(config);
redeployVerticles(options);


Router router = Router.router(vertx);
router.route("/eventbus/*").handler(eventBusHandler());
router.get("/api/tradingpairs")
      .handler(this::handleGetTradingPairs);
      router.route().failureHandler(errorHandler());
      router.route("/*").handler(StaticHandler.create("static").setCachingEnabled(false));
      router.route().handler(FaviconHandler.create("static/favicon.ico"));

      vertx.createHttpServer()
          .requestHandler(router::accept)
          .listen(config().getInteger("http.port", 8080));
     
      
}
 
开发者ID:AlxGDev,项目名称:BittrexGatherer,代码行数:35,代码来源:BittrexVerticle.java

示例3: createFromOptions

import io.vertx.ext.web.client.WebClientOptions; //导入方法依赖的package包/类
public void createFromOptions(Vertx vertx) {
  WebClientOptions options = new WebClientOptions()
    .setUserAgent("My-App/1.2.3");
  options.setKeepAlive(false);
  WebClient client = WebClient.create(vertx, options);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:7,代码来源:WebClientExamples.java


注:本文中的io.vertx.ext.web.client.WebClientOptions.setKeepAlive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。