我至少知道了一些东西。看来,这种行为是一个错误。一种解决方法是使用特定于Sun的类来显式重置缓存,如下所示:
import sun.net.www.protocol.http.AuthCachevalue;import sun.net.www.protocol.http.AuthCacheImpl;....AuthCachevalue.setAuthCache(new AuthCacheImpl());Authenticator.setDefault(new URLAuthenticator(username, password));
我正在问题中描述的下载功能顶部重置AuthCache。在编译期间,您会收到有关使用这些类的警告。这不能完全解决问题:如果NTLM身份验证有效,则仍然不会调用身份验证器,但是只要服务器在没有所请求文件权限的用户下运行,就应该清除缓存出来。



