Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to configure vertx http client options in RESTEasy Reactive client #15189

Merged
merged 1 commit into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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