URLConnection getDefaultRequestProperty Example

URLConnection class getDefaultRequestProperty example. This example shows you how to use getDefaultRequestProperty method.


URLConnection class getDefaultRequestProperty example. public static String getDefaultRequestProperty(String key) Returns the value of the default request property. Default request properties are set for every connection.

Here is the code
/*
 * @ # GetDefaultAllowUserInteraction.java
 * A class repersenting use to GetDefaultAllowUserInteraction 
 * method of URLConnection class in java.net package
 * version 23 June 2008
 * author Rose India 
 */

import java.net.*;

public class GetDefaultRequestProperty {

    public static void main(String args[]) throws Exception {


        SocketAddress socketAddress =
                new InetSocketAddress("192.168.10.80"9090);
        Proxy proxy = new Proxy(Proxy.Type.HTTP, socketAddress);

        URL url = new URL("http://google.com");
        URLConnection connection = url.openConnection(proxy);

        System.out.println("Default Request Property " +
                connection.getDefaultRequestProperty("name"));
    }
}

Output
Default Request Property null

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

HOME | COPYRIGHT | CONTACT US