I'm writing a Java client that POSTs to a HTTP server that requires authentication.
I have to support at least the following three authentication methods: Basic, Digest or Negotiate. Additionally the POST may be very large (over 2MB), so I need to use streaming.
As is documented for HttpURLConnection
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.
So, I need to handle authentication myself. I searched, and searched again, for a way to employ the, already coded, classes - but found no way...
I could just pluck the needed sources from here (as they are GPLv2 with Classpath exception). Is this the right way?
Thanks.
See Question&Answers more detail:os