URLConnection getRequestProperty Example
URLConnection class getRequestProperty example. This example shows you how to use getRequestProperty method.
URLConnection class getRequestProperty example. public String getRequestProperty(String key) Returns the value of the named general request property for this connection.
Here is the code
/*
* @ # GetRequestPropertie.java
* A class repersenting use to GetRequestPropertie method
* of URL class in java.net package
* version 24 June 2008
* author Rose India
*/
import java.net.*;
public class GetRequestProperty {
public static void main(String args[]) throws Exception {
SocketAddress address = new InetSocketAddress("192.168.10.80", 9090);
Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
URL url = new URL("http://google.com");
URLConnection connection = url.openConnection(proxy);
System.out.println("Request Property "+connection.getRequestProperty("name"));
}
} |
|