我对这应该如何工作非常困惑。我尝试过这样的事情:
con = (HttpURLConnection) url2.openConnection();
con.setReadTimeout(10000);
con.setInstanceFollowRedirects(true);
con.setAllowUserInteraction(true);
con.setDoOutput(true);
con.setDoInput(true);
Authenticator.setDefault(new MyAuthenticator());
con.connect();
class MyAuthenticator extends Authenticator {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("myUser", "MyPassword".toCharArray());
}
}
我收到这个方法返回的401错误,所以显然我错过了这一点。根据这个chart NTLMv2应该在JRE 6中得到支持。我的困惑在于它在Android上运行。在getOutputStream
引发的异常的堆栈跟踪中,我看到正在引用的HttpURLConnection
的Apache实现。
根据我的研究结果,由于许可问题,Apache无法包含NTLMv2协议。这是为什么它不适用于android?
无论哪种方式,我都想知道如何在Java中完成,而不仅仅是Android。
答案 0 :(得分:1)
没有实施。看看这个问题:http://code.google.com/p/android/issues/detail?id=4962。还要考虑Android不是JRE 6的事实,它是标准Java的修改版本。