Java Code Examples for io.vertx.ext.web.client.WebClientOptions#setSsl()
The following examples show how to use
io.vertx.ext.web.client.WebClientOptions#setSsl() .
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: WebClientOptionsFactory.java From ethsigner with Apache License 2.0 | 6 votes |
private void applyTlsOptions(final WebClientOptions webClientOptions, final Config config) { final Optional<ClientTlsOptions> optionalClientTlsOptions = config.getClientTlsOptions(); if (optionalClientTlsOptions.isEmpty()) { return; } webClientOptions.setSsl(true); final ClientTlsOptions clientTlsOptions = optionalClientTlsOptions.get(); applyTrustOptions( webClientOptions, clientTlsOptions.getKnownServersFile(), clientTlsOptions.isCaAuthEnabled()); applyKeyStoreOptions(webClientOptions, clientTlsOptions.getKeyStoreOptions()); }
Example 2
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 3
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 4
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 5
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 6
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 7
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(); }); }
Example 8
Source File: HttpAuthenticationProviderConfiguration.java From graviteeio-access-management with Apache License 2.0 | 6 votes |
@Bean @Qualifier("idpHttpAuthWebClient") public WebClient httpClient() { WebClientOptions httpClientOptions = new WebClientOptions(); httpClientOptions .setUserAgent(DEFAULT_USER_AGENT) .setConnectTimeout(configuration.getConnectTimeout()) .setMaxPoolSize(configuration.getMaxPoolSize()); if (configuration.getAuthenticationResource().getBaseURL() != null && configuration.getAuthenticationResource().getBaseURL().startsWith("https://")) { httpClientOptions.setSsl(true); httpClientOptions.setTrustAll(true); } return WebClient.create(vertx, httpClientOptions); }
Example 9
Source File: HttpUserProviderConfiguration.java From graviteeio-access-management with Apache License 2.0 | 6 votes |
@Bean @Qualifier("idpHttpUsersWebClient") public WebClient httpClient() { WebClientOptions httpClientOptions = new WebClientOptions(); httpClientOptions .setUserAgent(DEFAULT_USER_AGENT) .setConnectTimeout(configuration.getConnectTimeout()) .setMaxPoolSize(configuration.getMaxPoolSize()); if (configuration.getUsersResource().getBaseURL() != null && configuration.getUsersResource().getBaseURL().startsWith("https://")) { httpClientOptions.setSsl(true); httpClientOptions.setTrustAll(true); } return WebClient.create(vertx, httpClientOptions); }
Example 10
Source File: AbstractAdapterConfig.java From hono with Eclipse Public License 2.0 | 6 votes |
/** * Creates a new instance of {@link ResourceLimitChecks} based on prometheus metrics data. * * @return A ResourceLimitChecks instance. */ @Bean @ConditionalOnClass(name = "io.micrometer.prometheus.PrometheusMeterRegistry") @ConditionalOnProperty(name = "hono.resource-limits.prometheus-based.host") public ResourceLimitChecks resourceLimitChecks() { final PrometheusBasedResourceLimitChecksConfig config = resourceLimitChecksConfig(); final WebClientOptions webClientOptions = new WebClientOptions(); webClientOptions.setDefaultHost(config.getHost()); webClientOptions.setDefaultPort(config.getPort()); webClientOptions.setTrustOptions(config.getTrustOptions()); webClientOptions.setKeyCertOptions(config.getKeyCertOptions()); webClientOptions.setSsl(config.isTlsEnabled()); return new PrometheusBasedResourceLimitChecks( WebClient.create(vertx(), webClientOptions), config, newCaffeineCache(config.getCacheMinSize(), config.getCacheMaxSize()), getTracer()); }