Search code examples
javahttpclientapache-httpclient-4.x

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.

With httpClient 3.x I used setDoAuthentication(false) which ensured that the method would not try to handle the authentication challenges automatically. How can I set the same functionality with httpClient 4.3.x?

I already went through the javadocs of httpmethods and httpclient and there is no way to do it. The closest I have been is the use of disableAuthCaching() in httpClientBuilder, but not sure whether it would serve the purpose.

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.


Solution

  • I think I got it. I guess it can be done by setting the setDoAuthentication() method to false in the requestConfig for httpClient.