Created attachment 29443[details]
Enhancements to HttpClient including preparation for no-cookie tests
Ref: "FormAuthenticatorTest for cases without cookies - implementation issues" on the tomcat dev list.
The attached patch prepares the HttpClient abstract helper ready for use by new Authenticator unit test cases. The change includes style cleanup, new public methods, logic refactoring and new private methods.
This change leaves the class 100% backward compatible with all existing unit tests.
When each of the concrete Authenticator tests are eventually extended, the new logic in HttpClient will be fully used for existing as well as new test cases.

I wondered whether my refactoring might have broken the logic associated with processing the response body. I have reviewed my change, renamed an argument to make it self-explanatory, and fixed a typo in a comment.
I have attached a new patch file for the entire change, so please ignore the original and implement only the new patch.

Note that I removed the extractUriElements() from within the processBody() method.
The response body might be not HTML, and in >=90% of test cases this information is not needed by the test.
The extractUriElements() method was made public so that you can call it explicitly.
See r1408520

This is ASF Bugzilla: the Apache Software Foundation bug system. In case
of problems with the functioning of ASF Bugzilla, please contact
bugzilla-admin@apache.org.
Please Note: this e-mail address is only for reporting problems
with ASF Bugzilla. Mail about any other subject will be silently
ignored.