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[] args) throws Exception {
URL url = new URL("http://192.168.10.211:8080");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
//Returns the key for the nth header field.
System.out.println(connection.getHeaderFieldKey(4));
System.out.println(connection.getHeaderField(4));
}
} |
|