I just checked in some small changes to the HttpClient class that adds
support for secure HTTP interactions. Although this is a small change to
HttpClient itself, it does introduce a compile-time dependency on the Java
Secure Sockets Extension (JSSE), a standard java extension available from
http://java.sun.com/products/jsse. JSSE is only needed at run-time if you
want to interact with secured servers.
Now to use HTTP client with secured servers, simply pass in an https:// URL
to one of the startSession() methods. E.g.,
HttpClient client = new HttpClient();
client.startSession(new URL("https://www.verisign.com"));
GetMethod method method = new GetMethod("/");
client.executeMethod(method);
String data = method.getDataAsString();
See the notes in the README.txt file or in the HttpClient JavaDoc comments
for details on installing/configuring/enabling JSSE.
If anyone has a strong objection to this new compile-time dependency, we
could roll-back quite easily, or find a clean way to refactor it so that if
you don't want HTTPS support you don't need JSSE.
- Rod Waldhoff