What is HttpClient?
Any program or software that can make call to any url or webapplication using http proptocol is HttpClient.

What are the dependencies of HttpClient?
1. commons-codec jar 1.2
2. commons-logging jar 1.0.4
3. junit
What are the steps for using HttpClient?
1. Intantiate HttpClient.
2. Use any methods (GetMethod/Post etc) .The URL can be passed in the constructor
3. Invoke HttpClient to execute the method.
4. Read the response using stream and store it as string or any other object.
5. Release the connection.
6. Use the response.
Method that can be used in HttpClient
Options: It helps to retrive the options available.
Get: The get method which has the url and query parameters.
Head: The HEAD method similar GET except here message-body is not present in the response.
Post: For a POST request, with large request in the body
Multipart: Generally it is used for file uploads etc.
Put, Delete and Trace are also usable

Leave a Reply