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

[RESTEASY-3324] Enable redirects using property. #3710

Merged
merged 1 commit into from
Aug 2, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -676,13 +676,20 @@ ApacheHttpClient43Engine engine = new ApacheHttpClient43Engine(httpClient,
}
});
</programlisting>

<section id="http_redirect">
<section id="http_redirect">
<title>HTTP redirect</title>
<para>
The <classname>ClientHttpEngine</classname> implementations based on Apache
<classname>HttpClient</classname> support HTTP redirection.
The feature is disabled by default and has to be enabled by users explicitly:
The feature is disabled by default and has to be enabled by users explicitly.
Either by setting up the following property:
<itemizedlist>
<listitem><classname>dev.resteasy.client.follow.redirects</classname></listitem>
</itemizedlist>
<programlisting>
Client client = ClientBuilder.newBuilder().property("dev.resteasy.client.follow.redirects", "true").build();
</programlisting>
or by explicitly calling the API method as following:
<programlisting>
ApacheHttpClient43Engine engine = new ApacheHttpClient43Engine();
engine.setFollowRedirects(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public enum HostnameVerificationPolicy {
*/
public static final String PROPERTY_PROXY_SCHEME = "org.jboss.resteasy.jaxrs.client.proxy.scheme";

public static final String PROPERTY_FOLLOW_REDIRECTS = "dev.resteasy.client.follow.redirects";

/**
* Changing the providerFactory will wipe clean any registered components or properties.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ public ResteasyClient build() {
}
}

final Object localFollowRedirects = config.getProperty(PROPERTY_FOLLOW_REDIRECTS);
if (localFollowRedirects != null) {
this.followRedirects = Boolean.parseBoolean(String.valueOf(localFollowRedirects));
}

ClientHttpEngine engine = httpEngine != null ? httpEngine
: new ClientHttpEngineBuilder43().resteasyClientBuilder(this).build();
if (resetProxy) {
Expand Down