HttpURLConnection GetHeaderFieldKey() Example

Returns the key for the nth header field


HttpURLConnectionclass GetHeaderFieldKey() method example. This example shows you how to use GetHeaderFieldKey() method.This method Returns the key for the nth header field

Here is the code:-
/* 
 * @Program that Returns the key for the nth header field.
 * GetHeaderFieldKey.java 
 * Author:-RoseIndia Team
 * Date:-25-Jun-2008
 */

import java.net.*;

public class GetHeaderFieldKey {
 public static void main(String[] argsthrows Exception {
        URL url = new URL("http://192.168.10.211:8080");
        HttpURLConnection connection = (HttpURLConnectionurl.openConnection();
        //Returns the key for the nth header field.
        System.out.println(connection.getHeaderFieldKey(4));
        System.out.println(connection.getHeaderField(4));
    }
}

Output of the program:-
 Content-Type
text/html

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

HOME | COPYRIGHT | CONTACT US