commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Dever <>
Subject [HttpClient] HttpURLConnection wrapper problems caused by deficiencies in HttpClient
Date Mon, 02 Sep 2002 16:07:56 GMT

We have a problem with the getHeaderField and getHeaderFieldKey methods in the
HttpURLConnection wrapper.

Problem1) You make a note about being unable to get the status line as a header,
and attempt to generate one in the wrapper.  This is non-ideal, but I see no
other choice.  readStatusLine() in HttpMethodBase is where the status line is
read, but it is never stored and is not available outside the method.

Problem 2) The headers are not returned by getResponseHeaders() in the order
that they are read from the stream.  The headers are stored in a HashMap and are
effectively just the values() which are in no particular order.

Both of these problems show deficiencies in HttpClient in my opinion, and should
be fixed.

For Problem1 we could store the status line as a string and add a getStatusLine
method.  Alternatively, we could create a header for it with the name StatusLine
(or perhaps just null) which would preserve the interface.

For Problem2 we could use a Vector in place of a HashMap for the headers so that
the order is preserved, but would have abstract away the lookups by the name
field (which there are many).  Alternatively, we could mirror the contents in
the hashmap in a vector (or array) so that we still have fast and convienent
lookups, but still have order preservation of the headers.

What do you all say?

Jeff Dever wrote:

> Patch applied.
> There has been no significant changes to the wrapper since it was added to
> the repository (at least untill now, that is :-)
> Vincent Massol wrote:
> > Hi,
> >
> > I haven't been following what has happened with the HttpURLConnection
> > that I have submitted some time ago but here are some corrections I made
> > to the Cactus wrapper (I will move Cactus to use the HttpClient wrapper
> > very soon now).
> >
> > Thanks
> > -Vincent
> >
> > PS: Sorry it isn't in diff format, I am very much in hurry right now.
> >
> >   ------------------------------------------------------------------------
> >                                    Name: httpurlconnectionpatches.txt
> >    httpurlconnectionpatches.txt    Type: Plain Text (text/plain)
> >                                Encoding: quoted-printable
> >
> >    Part 1.3Type: Plain Text (text/plain)
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message