0

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?

Hariharan
  • 2,981
  • 4
  • 17
  • 30
  • 1
    The popup comes from the default authenticator. To remove the popup, you can plug in your own authenticator. Refer below link http://stackoverflow.com/questions/4883100/how-to-handle-http-authentication-using-httpurlconnection Thanks – Hariharan May 02 '13 at 08:38
  • Thanks Hariharan. After replace authenticator, it works, no window pops up. – colin_huhu May 06 '13 at 14:10

1 Answers1

0

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?

My post has been deleted by some moderator, even i suggest right answer. @user2342266 please select this as right answer, which it helped you to solve the problem.

Thanks.

Community
  • 1
  • 1
Hariharan
  • 2,981
  • 4
  • 17
  • 30