*
* @author Cache John
*
*/
public class GetHttpResponseHeader
{
public static void main(String[] args)
{
try
{
URL obj = new URL("http://www.huawei.com");
URLConnection conn = obj.openConnection();
Map
System.out.println("显示响应Header信息\n");
for (Map.Entry
{
System.out.println("Key : " + entry.getKey() + " ,Value : " + entry.getValue());
}
System.out.println("\n使用key获得响应Header信息 \n");
List
if (server == null)
{
System.out.println("Key 'Server' is not found!");
}
else
{
for (String values : server)
{
System.out.println(values);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}