Java HTTP library

Being in need to issue POST requests from within a Java application, and wanting re-usable code, I created a very simple Java library for issuing POST and GET requests to a remote server.

POST source codeGET source code

Usage (POST example):

POST post = new POST();
post.postRequest("http://www.myservice.com/service", "param1=foo&param2=bar", "Mozilla/5.0");

In other words, the arguments are:

post.postRequest(SERVER_URL, PARAMETERS, AGENT);

The output can be manipulated as desired, depending on what you response you except you should use a corresponding element/object.

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s