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
Conversation
Hello, The-Huginn. I'm waiting for one of the admins to verify this patch with /ok-to-test in a comment. |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also need to be added to the documentation in the RESTEasy_Client_Framework.xml
in the docbook
directory as well.
@@ -279,5 +281,7 @@ public enum HostnameVerificationPolicy { | |||
*/ | |||
public abstract ResteasyClientBuilder setFollowRedirects(boolean followRedirects); | |||
|
|||
public abstract ResteasyClientBuilder setFollowRedirects(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed since there is a setter above.
|
||
@Message(id = BASE + 195, value = "Unable to set follow redirects policy.") | ||
String unableToSetFollowRedirects(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the comment below we likely don't need this.
ClientConfiguration config = new ClientConfiguration(getProviderFactory()); | ||
try { | ||
if (config.hasProperty(ResteasyClientBuilder.PROPERTY_FOLLOW_REDIRECTS)) { | ||
Object enabled = config.getProperty(ResteasyClientBuilder.PROPERTY_FOLLOW_REDIRECTS); | ||
if (enabled instanceof Boolean) { | ||
this.followRedirects = (Boolean) enabled; | ||
} else if (enabled instanceof String) { | ||
this.followRedirects = Boolean.parseBoolean((String) enabled); | ||
} | ||
} | ||
} catch (Exception e) { | ||
// catch possible exceptions (in this case we do not set follow-redirects at all) | ||
LogMessages.LOGGER.warn(Messages.MESSAGES.unableToSetFollowRedirects(), e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't quite right. We need to remove this whole method and check the property in the build()
method. In the build()
method it should just look something like:
final Object localFollowRedirects = config.getProperty(PROPERTY_FOLLOW_REDIRECTS);
if (localFollowRedirects != null) {
followRedirects = Boolean.parseBoolean(String.valueOf(localFollowRedirects));
}
@@ -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 = "org.jboss.resteasy.jaxrs.client.follow-redirects"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have started to change the prefix we use. This should be something like dev.resteasy.client.follow.redirects
.
b5e1405
to
7caca71
Compare
Currently I assume, the property has higher priority. Is that expected or do I add additional logic to allow overriding property by |
It's a tough one, but yes we are saying the property wins. If a user did something like:
The latter would win. However, I think that's okay as then the user doesn't need to use the |
https://issues.redhat.com/browse/RESTEASY-3324