commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <>
Subject HTTP Client: HttpMethod/HttpMethodBase patches
Date Sun, 13 Jan 2002 20:33:39 GMT

I added the two methods for setting/adding default request headers for 
setting headers such as 'User-Agent', which most often stay fixed during 
the whole life of an application and do not change from request to request.

I'm including the patch to HttpMethod (interface) and HttpMethodBase 
(impl of that interface).

Originally I wanted to add the ability to set the default request 
headers for 1) efficiency, and 2) simpler code.

However, now after I added them it seems to me that this is actually not 
the most efficient way of doing it (checking 2 HashMaps vs. 1 HashMap in 
  5 of those add*RequestHeader methods).  It is probably more efficient 
to just call setRequestHeader(String, String) over and over, which is 
what I wanted to avoid in the first place, thinking that it's inefficient.

On the other hand, the call that uses HTTP Client can be a bit simpler 
and cleaner because it won't have to call setRequestHeader(String, 
String) over and over for the non-variable headers, between method 
recycling .

Therefore, a question for all: what do you think, do these patches 
improve things or not?
Please let me know if they can or cannot be applied to the versions in 
the repository.  At this point I'm fine either way :)


View raw message