To use Commons HttpClient 3.1 in a Maven 2 project, add the
following dependency to your project's
pom.xml
:
Example 11.1. Adding a Dependency on Commons HttpClient
<dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency>
If you are not sure what this means, I'd suggest reading Maven: The Definitive
Guide. When you depend on a library in Maven 2, all you need to
do is add the dependency groupId
,
artifactId
, and version
to your
project's dependencies. Once you do this, Maven 2 will download the
dependency and make it available on your project's classpath.
Apache 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). Apache 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.
For more information about the HttpClient 3.1 project, see the project page (http://hc.apache.org/httpclient-3.x/).