我正在写一个Java客户端,发布到需要身份验证的HTTP服务器。
我必须至少支持以下三种身份验证方法:基本,摘要或协商。此外,POST可能非常大(超过2MB),所以我需要使用流媒体。 正如记载为HttpURLConnection如何使用HttpURLConnection处理HTTP身份验证?
When output streaming is enabled, authentication and redirection cannot be handled automatically. A HttpRetryException will be thrown when reading the response if authentication or redirection are required.
所以,我需要处理验证自己。我搜索,并再次搜索的方式来雇用,已编码的类 - 但没有办法...
我可以从here(因为他们是GPLv2类路径异常)采摘所需的来源。这是正确的方式吗?
谢谢。
什么样的认证? HTTP基本身份验证?还是更复杂的东西? – Tim 2011-02-03 06:58:17
可以是_Basic_,_Digest_或_Negotiate_。基本是**简单**。另外两个不是:) – Opher 2011-02-03 12:00:07