本文整理汇总了Java中io.vertx.ext.web.client.WebClientOptions.setSsl方法的典型用法代码示例。如果您正苦于以下问题:Java WebClientOptions.setSsl方法的具体用法?Java WebClientOptions.setSsl怎么用?Java WebClientOptions.setSsl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.ext.web.client.WebClientOptions
的用法示例。
在下文中一共展示了WebClientOptions.setSsl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hello7
import io.vertx.ext.web.client.WebClientOptions; //导入方法依赖的package包/类
@Path("7")
@GET
public CompletionStage<String> hello7(@Context Vertx vertx){
io.vertx.rxjava.core.Vertx rxVertx = io.vertx.rxjava.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.rxjava.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
CompletableFuture<String> ret = new CompletableFuture<>();
responseHandler.subscribe(body -> {
System.err.println("Got body");
ret.complete(body.body().toString());
});
System.err.println("Created client");
return ret;
}
示例2: hello6
import io.vertx.ext.web.client.WebClientOptions; //导入方法依赖的package包/类
@Path("6")
@GET
public void hello6(@Suspended final AsyncResponse asyncResponse,
// Inject the Vertx instance
@Context Vertx vertx){
io.vertx.rxjava.core.Vertx rxVertx = io.vertx.rxjava.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.rxjava.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
responseHandler.subscribe(body -> {
System.err.println("Got body");
asyncResponse.resume(Response.ok(body.body().toString()).build());
});
System.err.println("Created client");
}
示例3: hello7Error
import io.vertx.ext.web.client.WebClientOptions; //导入方法依赖的package包/类
@Path("7error")
@GET
public CompletionStage<String> hello7Error(@Context Vertx vertx){
io.vertx.rxjava.core.Vertx rxVertx = io.vertx.rxjava.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.rxjava.core.buffer.Buffer>> responseHandler = client.get(443,
"www.google.com",
"/robots.txt").rxSend();
CompletableFuture<String> ret = new CompletableFuture<>();
responseHandler.subscribe(body -> {
System.err.println("Got body");
ret.completeExceptionally(new MyException());
});
System.err.println("Created client");
return ret;
}
示例4: hello8
import io.vertx.ext.web.client.WebClientOptions; //导入方法依赖的package包/类
@Path("8")
@GET
public Single<String> hello8(@Context io.vertx.rxjava.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.rxjava.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();
});
}
示例5: hello8User
import io.vertx.ext.web.client.WebClientOptions; //导入方法依赖的package包/类
@Path("8user")
@Produces("text/json")
@GET
public Single<DataClass> hello8User(@Context io.vertx.rxjava.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.rxjava.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());
});
}
示例6: hello8Error
import io.vertx.ext.web.client.WebClientOptions; //导入方法依赖的package包/类
@Path("8error")
@GET
public Single<String> hello8Error(@Context io.vertx.rxjava.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.rxjava.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");
throw new MyException();
});
}