Skip to content
Advertisement

Eclipse plugin dev, how to stop HttpsURLConnection of poping up user/password window when I connect

JDK IBM 1.6 Eclipse 3.6.2

Connect to a server with following code.

URL urlTemplate = new URL(uri); uc = (HttpURLConnection) urlTemplate.openConnection();

when connecting with wrong credential, it will pop up a window to enter correct credential as input, how to stop it? it seems to be built-in action and unable to stop that build-in functionality.

Another issue is that, when i connected successfully to server once, it will store the credentials and subsequent tests will all be working even though with wrong user/password. How to clear the cache, so it can test new input user and password?

Advertisement

Answer

The popup comes from the default authenticator. To remove the popup, you can plug in your own authenticator.

Refer below link

How to handle HTTP authentication using HttpURLConnection?

Advertisement