• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get the http version from the http server response  RSS feed

 
Tracy Tse
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all:
i am a web-related programming newbie,so this question might be simple to you all.Please be little patient.
i wrote a simple program to retrieve the html content from a http server (http://www.yahoo.com),but the first several lines of the file are


i wanna get the http protocol version in use by the server and have no idea how to achieve this ? Please help me .
PS: the full file content can be viewed from the attachment file .
Thanks in advance!
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you are printing in the post is the HTTP response content which is HTML data.
The protocol version is reported in the HTTP headers. You would see e.g. HTTP/1.1 200 OK and the rest of the HTTP headers followed by the response body
 
Tracy Tse
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim Akmer wrote:What you are printing in the post is the HTTP response content which is HTML data.
The protocol version is reported in the HTTP headers. You would see e.g. HTTP/1.1 200 OK and the rest of the HTTP headers followed by the response body

thank you,then how to get the http header info in java?
 
Lester Burnham
Rancher
Posts: 1337
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!