File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Http 1.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Http 1.0" Watch "Http 1.0" New topic

Http 1.0

Brian Mozhdehi
Ranch Hand

Joined: Aug 17, 2006
Posts: 81
Hi - I need to use the HTTP 1.0 protocol for a web server I am trying to post to. In that, I need the request headers to send explicitly

When I use HttpURLConnection, I cant seem to find a way for it to send 1.0 instead of 1.1, i.e it sends HTTP/1.1. Also, it seems to send only the resource in the <URL> paramater, i.e for it sends /bar when I need it to send

This requirement is being driven by a government server, so I cannot change it. Do I need to manually code the transmission of the request headers or is there a way to make HttpURLConnection do whats needed? Or is there another object that might work in place of HttpURLConnection?

Thanks much for any help.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
The HttpClient library provides a number of options that HttpURLConnection doesn't have; maybe selecting the protocol version is one of them.

As to sending the complete URL, I don't think that's possible. Does the ptotocol specification even allow that? It would in any case be superfluous, as the connection to the server has been established at that point, so sending the server name again doesn't provide any information.
Brian Mozhdehi
Ranch Hand

Joined: Aug 17, 2006
Posts: 81
Thanks much for this, much appreciated. I agree with what you are saying on the specification/entire URL. It isnt part of the specification I dont think. I may end up having to write directly to the stream. But at least I can try HttpClient and see what happens. Maybe I can "extend" to allow the variation. On a side note, this whole project is crazy - its a Canadian government thing, this is among their many requirements that make no sense
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

You send the whole URL in that location when you're talking to a proxy server; is that what's going on here?

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: Http 1.0
It's not a secret anymore!