Thursday, 12 April 2012

Java Client http / https connection


If you are facing as simple problem as hitting an URL through java code and getting response back, you are at right place. It is damn simple. Just follow steps given below :

1 ) Include myclient.jar file in your project.  click here to download jar file

2) Make an object of ClientURLConnection.

3) Pass URL you want to hit.

3) Set method you want to send request (GET or POST)

4) Add parameters (key-value pair) , if any you want to send along with request.

5) Call method yourObject.getInputStream()

And it is done !! Now do not waste time here and complete your task :)

No comments:

Post a Comment