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[] args) throws Exception {
URL url = new URL("http://192.168.10.211:8080");
HttpURLConnection connection = (HttpURLConnection) url.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 |
|