HttpURLConnection GetRequestMethod() Example

Get the request method


HttpURLConnectionclass GetRequestMethod() method example. This example shows you how to use GetRequestMethod() method.This method Get the request method

Here is the code:-
/* 
 * @Program that Get the request method.
 * GetRequestMethod.java 
 * Author:-RoseIndia Team
 * Date:-25-Jun-2008
 */

import java.net.*;

public class GetRequestMethod {

    public static void main(String[] argsthrows Exception {
        URL url = new URL("http://192.168.10.211:8080");
        HttpURLConnection connection = (HttpURLConnectionurl.openConnection();
        //Get the request method.
        String s = connection.getRequestMethod();
        System.out.println("Get the request method: " + s);
    }
}

Output of the program:-
 Get the request method: GET

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US