Retrieving headers from response |
To retrieve the headers returned in an HttpResponse invoke the HttpResponse#getHeaders method. This will return a java.util.Enumeration of com.jscape.inet.mime.MimeHeader. Each MimeHeader instance contains a name and value that can be retrieved by invoking the MimeHeader#getName and MimeHeader#getValue methods respectively.
Example
// get response headers Enumeration e = response.getHeaders();
// loop thru all headers printing name and value while(e.hasMoreElements()) { MimeHeader header = (MimeHeader)e.nextElement(); System.out.println("Name: " + header.getName()); System.out.println("Value: " + header.getValue()); } |