Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get HTTP version from Response Header using HttpURLConnection

807606Mar 20 2007 — edited Mar 21 2007
For the response header, HTTP/1.1 200 OK, I wish to get the "HTTP/1.1"
portion, how should I do so if I am using HttpURLConnection?

URL url=new URL("http://lapdog.47ronin.com:8080/images/icons/Apple.gif");
URLConnection connection=url.openConnection();

HttpURLConnection httpConnection = (HttpURLConnection)connection;
httpConnection.setRequestMethod("GET");
httpConnection.connect();

System.out.println(httpConnection.getResponseCode());//getting 200 System.out.println(httpConnection.getResponseMessage());//getting OK
//How should I get HTTP version??
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 18 2007
Added on Mar 20 2007
3 comments
931 views