Results 1 to 1 of 1
Thread: Getting Header Info
-
Getting Header Info
Following code segment prints the complete header of Java Forums site.
Output:Java Code:String str = "http://www.java-forums.org"; try { URL u = new URL(str); URLConnection uc = u.openConnection( ); for (int j = 1; ; j++) { String header = uc.getHeaderField(j); if (header == null) break; System.out.println(uc.getHeaderFieldKey(j) + ": " + header); } // end for } // end try catch (MalformedURLException ex) { System.err.println(str + " is not a URL I understand."); } catch (IOException ex) { System.err.println(ex); } System.out.println( );
Java Code:Date: Mon, 26 Nov 2007 12:25:57 GMT Server: Apache/1.3.39 (Unix) PHP/4.4.7 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_ssl/2.8.30 OpenSSL/0.9.8b X-Powered-By: PHP/4.4.7 Set-Cookie: bbsessionhash=9504ff3cde4b9d424d1bf362769a7c17; path=/; HttpOnly Set-Cookie: bblastvisit=1196079957; expires=Tue, 25 Nov 2008 12:25:57 GMT; path=/ Set-Cookie: bblastactivity=0; expires=Tue, 25 Nov 2008 12:25:57 GMT; path=/ Cache-Control: private Pragma: private Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=ISO-8859-1
Similar Threads
-
problem when generating MIME header of a SOAP packet using SAAJ
By kumar.jyotish@gmail.com in forum Advanced JavaReplies: 1Last Post: 10-18-2010, 05:03 PM -
Reading file header
By mew in forum New To JavaReplies: 9Last Post: 02-19-2009, 07:29 PM -
Servlet sending the file (setting header)
By Java Tip in forum Java TipReplies: 0Last Post: 01-27-2008, 08:14 PM -
java.io.IOException: invalid header field
By osval in forum Advanced JavaReplies: 1Last Post: 08-06-2007, 11:09 PM -
header of jtable
By bbq in forum AWT / SwingReplies: 1Last Post: 07-05-2007, 04:11 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks