简体   繁体   English

如何在httpClient 4.3.x中强制http客户端不自动处理身份验证挑战?

[英]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.

相关问题 在HttpClient 4.3.x中更正基本身份验证 - Correct Basic Authentication in HttpClient 4.3.x 使用 4.3.x 重用 HttpClient 连接 - HttpClient connection reusing with 4.3.x 有一种简单的方法可以手动强制缓存HttpClient 4.3.x绕过缓存吗? - Is there an easy way to manually force a caching HttpClient 4.3.x to bypass the cache? 如何使用Ajax从网页上使用httpclient 4.3.x获取信息 - how to use httpclient 4.3.x grabbing infomation from web page with ajax 使用HttpClient 4.3.x,为特定URL执行HttpHead会产生NoHttpResponseException - With HttpClient 4.3.x, executing a HttpHead for a specific URL gives NoHttpResponseException apache httpclient 4.4:HostnameVerifier从4.3.x过渡 - apache httpclient 4.4: HostnameVerifier transition from 4.3.x 使用非ASCII凭据在httpclient 4.3.x中不起作用 - Use of non-ascii credentials not working in httpclient 4.3.x HttpClient 4.3.x,修复不推荐使用的代码以使用当前的 HttpClient 实现 - HttpClient 4.3.x, fixing deprecated code to use current HttpClient implementations 带有Hibernate 4.3.x的BoneCP - BoneCP with Hibernate 4.3.x 获取Apache httpconents HttpClient 4.3.x OSGi包以解决Apache Karaf 2.3.x的问题 - Problems with getting Apache httpcomponents HttpClient 4.3.x OSGi bundle to work on Apache Karaf 2.3.x
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM