[英]How to force the http client to not handle the authentication challenges automatically in httpClient 4.3.x?
I am migrating my httpclient 3.x to httpclient 4.3.x. 我正在将我的httpclient 3.x迁移到httpclient4.3.x。
With httpClient 3.x I used setDoAuthentication(false)
which ensured that the method would not try to handle the authentication challenges automatically. 在httpClient 3.x中,我使用了
setDoAuthentication(false)
来确保该方法不会尝试自动处理身份验证挑战。 How can I set the same functionality with httpClient 4.3.x? 如何使用httpClient 4.3.x设置相同的功能?
I already went through the javadocs of httpmethods and httpclient and there is no way to do it. 我已经看过httpmethods和httpclient的javadocs了,没有办法做到。 The closest I have been is the use of
disableAuthCaching()
in httpClientBuilder, but not sure whether it would serve the purpose. 我最接近的是在httpClientBuilder中使用
disableAuthCaching()
,但不确定它是否能达到目的。
Can anyone please provide some pointers? 谁能提供一些建议?
I have read somewhere that there is a parameter through which we can achieve this behavior but I am not able to find it anywhere. 我在某处读到有一个参数可以通过它实现此行为,但我无法在任何地方找到它。 Sorry if it looks like a pretty basic question.
抱歉,如果它看起来像是一个非常基本的问题。
I think I got it. 我想我明白了。 I guess it can be done by setting the
setDoAuthentication()
method to false in the requestConfig
for httpClient. 我猜可以通过在
setDoAuthentication()
的requestConfig
中将setDoAuthentication()
方法设置为false来完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.