11.1. Obtaining Jakarta HttpClient
Problem
You need to use Jakarta HttpClient to write a program to interact with a server over HTTP.
Solution
Download Jakarta HttpClient 3.0. Following the steps outlined in
Recipe 1.1, download
“Commons HttpClient 3.0” instead of
Commons Lang. The HttpClient
archive—commons-httpclient-3.0.zip—will
contain a file named commons-httpclient-3.0.jar;
place this JAR file in your classpath, and you will be ready to use
Jakarta HttpClient.
Jakarta HttpClient depends on Jakarta Commons Logging, which can be obtained from the same binary download page as HttpClient. To download Commons Logging, see Recipe 7.9. Jakarta HttpClient also depends on Jakarta Commons Codec, which can also be obtained from the same binary download page as HttpClient. To download Commons Codec, see Recipe 2.15.
Discussion
Jakarta HttpClient is a client library for the HTTP protocol.
HttpClient is very feature-rich, supporting all HTTP methods defined
in RFC 2616 (Hypertext Transfer Protocol, HTTP/1.1). Jakarta
HttpClient supports GET, POST, PUT, OPTIONS, HEAD, and DELETE using
the command pattern; HttpMethod objects are
instantiated and executed by an HttpClient object that manages server interaction and state across multiple requests. HttpClient has support for various authentication mechanisms, including Basic, Digest, and NTLM authentication. HttpClient supports both HTTP and HTTPS, and the library can manage the complexity involved in using both schemes with an HTTP proxy. HttpClient ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access