Java Code Examples for io.vertx.ext.web.client.WebClientOptions#setVerifyHost()
The following examples show how to use
io.vertx.ext.web.client.WebClientOptions#setVerifyHost() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyResource.java From redpipe with Apache License 2.0 | 6 votes |
@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"); }
Example 2
Source File: MyResource.java From redpipe with Apache License 2.0 | 6 votes |
@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; }
Example 3
Source File: MyResource.java From redpipe with Apache License 2.0 | 6 votes |
@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; }
Example 4
Source File: MyResource.java From redpipe with Apache License 2.0 | 6 votes |
@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()); }
Example 5
Source File: MyResource.java From redpipe with Apache License 2.0 | 6 votes |
@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()); }
Example 6
Source File: MyResource.java From redpipe with Apache License 2.0 | 6 votes |
@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(); }); }