本文整理汇总了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();
}
示例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));
}
示例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);
}