How to Create a HTTP Client

In this tutorial I am going to tell you how to access HTTP resources from a java class. I am using apache HTTP Client 4.2 libraries. I have developed a simple demo web app using HTTP GET method. In that application when you pass a sentence as parameter it gives how many words are in that sentence. You can check that web app following URL.

First you need to download the required library files from click on this link. Download the HttpClient 4.1.2(GA) binary file according to your operating system. If you are using linux machine download 4.1.2.tar.gz or if you are using windows machine download 4.1.2.zip file.  Then extract the zip file and go to lib folder. In there add httpclient and httpcore jar files to your libry path.

Continue Reading