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.
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 can
manage the state of a session, automatically keeping track of cookies
across multiple requests.
If you have a Maven project that needs to use Jakarta HttpClient, add
a dependency on Jakarta HttpClient 3.0 with the following section in
project.xml
:
<dependencies> <dependency> <id>httpclient</id> <version>3.0</version> </dependency> ....other dependencies... </dependencies>
For more information about the Jakarta HttpClient project, see the project page (http://jakarta.apache.org/commons/httpclient).
The Jakarta Commons HttpClient recently voted itself out of the Jakarta Commons and into Jakarta as a subproject. Be aware that the URLs specified in this recipe may not be accurate after HttpClient “graduates” from the Jakarta Commons.
If you have questions about using HttpClient, please feel free to join the http://[email protected] mailing list. Instructions for joining the user mailing list can be found in Recipe 1.2. Note that as Jakarta Commons HttpClient becomes Jakarta HttpClient, the commons-user mailing list may stop being the place to ask questions about Jakarta HttpClient. Investigate the current status of HttpClient before joining these mailing lists.
For information on obtaining the source code for Commons HttpClient, see Recipe 11.2.
18.191.29.22