Display Header Fields Of HttpURLConnection In Java
Posted by blogmeister on
April 30, 2009
Here is a short code to list header fields returned after you access a url.
|
1 2 3 4 5 6 7 8 |
public void display(HttpURLConnection httpcon) { Map headerfields = httpcon.getHeaderFields(); Set headers = headerfields.entrySet(); for(Iterator i = headers.iterator(); i.hasNext();){ Map.Entry map = (Map.Entry)i.next(); System.out.println(map.getKey() + " : " + map.getValue()); } } |










2 Responses to “Display Header Fields Of HttpURLConnection In Java”
Fantastic site, where did you come up with the information in this post? Im glad I found it though, ill be checking back soon to see what other articles you have.
By Ray Dopp on Apr 11, 2010