Skip to content

Commit

Permalink
Merge pull request #15189 from geoand/jaxrs-client-httpoptions
Browse files Browse the repository at this point in the history
Add the ability to configure vertx http client options in RESTEasy Reactive client
  • Loading branch information
geoand authored Feb 19, 2021
2 parents 6dce423 + de5cfce commit cac7740
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jboss.resteasy.reactive.client.impl;

import io.vertx.core.http.HttpClientOptions;
import java.security.KeyStore;
import java.util.Map;
import java.util.concurrent.ExecutorService;
Expand All @@ -22,6 +23,7 @@ public class ClientBuilderImpl extends ClientBuilder {
private KeyStore keyStore;
private char[] keystorePassword;
private HostnameVerifier hostnameVerifier;
private HttpClientOptions httpClientOptions = new HttpClientOptions();
private static final ClientContextResolver CLIENT_CONTEXT_RESOLVER = ClientContextResolver.getInstance();

@Override
Expand Down Expand Up @@ -74,9 +76,14 @@ public ClientBuilder readTimeout(long timeout, TimeUnit unit) {
return this;
}

public ClientBuilder httpClientOptions(HttpClientOptions httpClientOptions) {
this.httpClientOptions = httpClientOptions;
return this;
}

@Override
public Client build() {
return new ClientImpl(configuration,
return new ClientImpl(httpClientOptions, configuration,
CLIENT_CONTEXT_RESOLVER.resolve(Thread.currentThread().getContextClassLoader()), hostnameVerifier,
sslContext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class ClientImpl implements Client {
final ClientRestHandler[] abortHandlerChain;
final Vertx vertx;

public ClientImpl(ConfigurationImpl configuration, ClientContext clientContext,
public ClientImpl(HttpClientOptions httpClientOptions, ConfigurationImpl configuration, ClientContext clientContext,
HostnameVerifier hostnameVerifier,
SSLContext sslContext) {
this.configuration = configuration != null ? configuration : new ConfigurationImpl(RuntimeType.CLIENT);
Expand All @@ -96,7 +96,7 @@ public Vertx get() {
});
closeVertx = true;
}
this.httpClient = this.vertx.createHttpClient();
this.httpClient = this.vertx.createHttpClient(httpClientOptions);
abortHandlerChain = new ClientRestHandler[] { new ClientErrorHandler() };
handlerChain = new ClientRestHandler[] { new ClientRequestFiltersRestHandler(), new ClientSendRequestHandler(),
new ClientResponseRestHandler() };
Expand Down

0 comments on commit cac7740

Please sign in to comment.