• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get the http version from the http server response

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This will help: http://www.roseindia.net/java/java-get-example/http-headers.shtml
 
them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic