This week's giveaway is in the Java/Jakarta EE forum. We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line! See Things work until I need to re-authenticate to the same website. This is important, since the password to the website may have changed since the first connection, or there is some reason to login with different authentication credentials. I find that I can't do this since getPasswordAuthentication never gets called again, but rather the same PasswordAuthentication object (with the now incorrect information) is used.
So my question is: How does the system cache the PasswordAuthentication? Is it based on: the URL you go to? the realm you connect to? it is always the same on regardless of where you connect?
Is there something I can do to force the system to re-authenticate?
Not a direct answer, but you can use authentication with [Http]UrlConnection in a more direct way, which is outlined here (applets and other Java code are equal in this regard). That should also handle changing credentials, since no caching takes place.