Setting the request method |
The Http class supports both GET and POST request methods. The default request method used is the GET method. To change the request method, invoke the HttpReqeust#setMethod method. Alternatively you can define the request method in the constructor.
Example
The example below changes the request method from GET (default) to POST.
// create new HttpRequest HttpRequest request = new HttpRequest("http://www.myserver.com/servlet/Xml");
// change request method to POST request.setMethod("POST");
Example
The example below creates a new HttpRequest with a POST request method.
// create new HttpRequest with POST request method HttpRequest request = new HttpRequest("http://www.myserver.com/servlet/Xml","POST"); |