本文整理了Java中io.vertx.ext.web.client.WebClientOptions.setVerifyHost()
方法的一些代码示例,展示了WebClientOptions.setVerifyHost()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClientOptions.setVerifyHost()
方法的具体详情如下:
包路径:io.vertx.ext.web.client.WebClientOptions
类名称:WebClientOptions
方法名:setVerifyHost
暂无
代码示例来源:origin: io.vertx/vertx-consul-client
/**
* Set whether hostname verification is enabled
*
* @param verifyHost true if enabled
* @return a reference to this, so the API can be used fluently
*/
@Override
public ConsulClientOptions setVerifyHost(boolean verifyHost) {
return (ConsulClientOptions) super.setVerifyHost(verifyHost);
}
代码示例来源:origin: EnMasseProject/enmasse
@Override
protected void connect() {
this.client = WebClient.create(vertx, new WebClientOptions()
.setSsl(false)
.setTrustAll(true)
.setVerifyHost(false));
}
代码示例来源:origin: FroMage/redpipe
@Path("coroutines/1")
@GET
public Single<Response> helloAsync(@Context io.vertx.reactivex.core.Vertx rxVertx){
return Fibers.fiber(() -> {
System.err.println("Creating client");
WebClientOptions options = new WebClientOptions();
options.setSsl(true);
options.setTrustAll(true);
options.setVerifyHost(false);
WebClient client = WebClient.create(rxVertx, options);
Single<HttpResponse<io.vertx.reactivex.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
System.err.println("Got response");
HttpResponse<io.vertx.reactivex.core.buffer.Buffer> httpResponse = Fibers.await(responseHandler);
System.err.println("Got body");
client.close();
return Response.ok(httpResponse.body().toString()).build();
});
}
}
代码示例来源:origin: FroMage/redpipe
@Path("7error")
@GET
public CompletionStage<String> hello7Error(@Context Vertx vertx){
io.vertx.reactivex.core.Vertx rxVertx = io.vertx.reactivex.core.Vertx.newInstance(vertx);
System.err.println("Creating client");
WebClientOptions options = new WebClientOptions();
options.setSsl(true);
options.setTrustAll(true);
options.setVerifyHost(false);
WebClient client = WebClient.create(rxVertx, options);
Single<HttpResponse<io.vertx.reactivex.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
CompletableFuture<String> ret = new CompletableFuture<>();
responseHandler
.doAfterTerminate(() -> client.close())
.subscribe(body -> {
System.err.println("Got body");
ret.completeExceptionally(new MyException());
});
System.err.println("Created client");
return ret;
}
代码示例来源:origin: EnMasseProject/enmasse
protected void connect() {
this.client = WebClient.create(vertx, new WebClientOptions()
.setSsl(true)
// TODO: Fetch CA and use
.setTrustAll(true)
.setVerifyHost(false));
}
代码示例来源:origin: FroMage/redpipe
@Path("7")
@GET
public CompletionStage<String> hello7(@Context Vertx vertx){
io.vertx.reactivex.core.Vertx rxVertx = io.vertx.reactivex.core.Vertx.newInstance(vertx);
System.err.println("Creating client");
WebClientOptions options = new WebClientOptions();
options.setSsl(true);
options.setTrustAll(true);
options.setVerifyHost(false);
WebClient client = WebClient.create(rxVertx, options);
Single<HttpResponse<io.vertx.reactivex.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
CompletableFuture<String> ret = new CompletableFuture<>();
responseHandler
.doAfterTerminate(() -> client.close())
.subscribe(body -> {
System.err.println("Got body");
ret.complete(body.body().toString());
});
System.err.println("Created client");
return ret;
}
代码示例来源:origin: FroMage/redpipe
@Path("8error")
@GET
public Single<String> hello8Error(@Context io.vertx.reactivex.core.Vertx rxVertx){
System.err.println("Creating client");
WebClientOptions options = new WebClientOptions();
options.setSsl(true);
options.setTrustAll(true);
options.setVerifyHost(false);
WebClient client = WebClient.create(rxVertx, options);
Single<HttpResponse<io.vertx.reactivex.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
System.err.println("Created client");
return responseHandler
.doAfterTerminate(() -> client.close())
.map(body -> {
System.err.println("Got body");
throw new MyException();
});
}
代码示例来源:origin: FroMage/redpipe
@Path("8user")
@Produces("text/json")
@GET
public Single<DataClass> hello8User(@Context io.vertx.reactivex.core.Vertx rxVertx){
System.err.println("Creating client");
WebClientOptions options = new WebClientOptions();
options.setSsl(true);
options.setTrustAll(true);
options.setVerifyHost(false);
WebClient client = WebClient.create(rxVertx, options);
Single<HttpResponse<io.vertx.reactivex.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
System.err.println("Created client");
return responseHandler.map(body -> {
System.err.println("Got body");
return new DataClass(body.body().toString());
}).doAfterTerminate(() -> client.close());
}
代码示例来源:origin: FroMage/redpipe
@Path("6")
@GET
public void hello6(@Suspended final AsyncResponse asyncResponse,
// Inject the Vertx instance
@Context Vertx vertx){
io.vertx.reactivex.core.Vertx rxVertx = io.vertx.reactivex.core.Vertx.newInstance(vertx);
System.err.println("Creating client");
WebClientOptions options = new WebClientOptions();
options.setSsl(true);
options.setTrustAll(true);
options.setVerifyHost(false);
WebClient client = WebClient.create(rxVertx, options);
Single<HttpResponse<io.vertx.reactivex.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
responseHandler
.doAfterTerminate(() -> client.close())
.subscribe(body -> {
System.err.println("Got body");
asyncResponse.resume(Response.ok(body.body().toString()).build());
});
System.err.println("Created client");
}
代码示例来源:origin: FroMage/redpipe
@Path("8")
@GET
public Single<String> hello8(@Context io.vertx.reactivex.core.Vertx rxVertx){
System.err.println("Creating client");
WebClientOptions options = new WebClientOptions();
options.setSsl(true);
options.setTrustAll(true);
options.setVerifyHost(false);
WebClient client = WebClient.create(rxVertx, options);
Single<HttpResponse<io.vertx.reactivex.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
System.err.println("Created client");
return responseHandler.map(body -> {
System.err.println("Got body");
return body.body().toString();
}).doAfterTerminate(() -> client.close());
}
内容来源于网络,如有侵权,请联系作者删除!