commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul C. Bryan" <em...@pbryan.net>
Subject Re: HTTPClient - setting default request headers impl Q
Date Fri, 11 Jan 2002 01:16:13 GMT
otisg@ivillage.com wrote:

 > Yes, yes, I'm aware of those two, but I was wondering what I should do
 > when the default header is set.
 >
 > I guess I will just add another pair of methods:
 >
 > setDefaultRequestHeader(String,String)
 > addDefaultRequestHeader(String,String)

My vote: only *one* method: setDefaultRequestHeader(String name, String 
value). In this case, if multiple headers are required, chain them 
together in the value parameter with semicolons.

meth.addRequestHeader allows addition of multiple header values when 
some already exist. With setDefaultRequestHeader, you are assigning the 
values, presumably for the duration of the use of the method.

 > However, what should happen when someone calls
 > setRequestHeader("header", "FOO") or addRequestHeader("header", "BAR")
 > after already specifying the value for that header using:
 > setDefaultRequestHeader("header", "BAR"), for instance?

My vote: setRequestHeader should override the default value. 
addRequestHeader should add the value to the existing header value.

 > Should setRequestHeader override the default one?

In my opinion, yes. However, if the method is recycled, then the default 
value should be reinstated.

Paul


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message