How to set type of http request, using org.apache.* library? For example, if I need POST request:
HttpPost hp=new HttpPost("http://server.com");
or GET
HttpGet hg=new HttpGet("http://server.com");
It works fine. But in my project I want to use only one function for all types of requests, because I need also PUT and DELETE requests.
So, how can I set type of request in DefaultHttpClient or (if it’s impossible) how can I create PUT and DELETE requests?
In your common function you can use
httpMethod.getName();which will return the type of HTTP call you are doing.Syntax for PUT/DELETE method are: