A simple example developing a Rest Client in Java
1. Using Apache HttpClient
The Apache HttpClient library simplifies handling HTTP requests. To use this library you have to download the binaries with dependencies from their website.
Here is the code for HTTP GET method:
And for Post method; for sending simple string in post:
You can also send full JSON or XML of a POJO by putting String representing JSON or XML as a parameter of StringEntity and then set the input content type. Something like this:
For JSON you can use JSONObject…
View original post 138 more words