You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Ortwin Glück <od...@odi.ch> on 2006/04/03 21:18:47 UTC

[HttpCore] Header should implement equals and hashCode

Oleg,

I think the Header class should implement equals and hashCode. Header is 
used in HeaderGroup in a List. The remove method of is used which uses 
equals to identify the right object.

Odi

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: [HttpCore] Header should implement equals and hashCode

Posted by Ortwin Glück <od...@odi.ch>.

Oleg Kalnichevski wrote:
> How do you see the identity equality of HTTP headers?
> 
> (1) By header name 
> 
> These headers are identity equal
> 
> "Content-Type: text/plain"
> "Content-Type: text/xml"
> 
> But these are not
> 
> "Content-Type: text/plain"
> "Content-Length: 0"
> 
> (2) By header and case-insensitive value
> 
> These headers are identity equal
> 
> "Content-Type: text/plain"
> "Content-Type: text/plain"
> "Content-Type: TEXT/PLAIN"
> 
> But these are not
> 
> "Content-Type: text/plain"
> "Content-Type: text/xml"
> "Content-Type: text/xml; charset=utf-8"
> "Content-Type: text/xml; charset = utf-8"
> 
> Anyway I look at it it just does not seem right. The only reasonable
> case I see is that an HTTP header is identity equal to itself (this),
> which I believe is the case with the current implementation
> 
> Oleg

I see the problem, Oleg. My suggestion would have been case-sensitive 
name + value. I was just thinking of any sort of serialization which 
destroys object identity. Maybe it's just because I currently work on a 
lot of J2EE code where Serialization and different classloaders are 
always an issue...

Odi

-- 
[web]  http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp]  key 0x81CF3416
        finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: [HttpCore] Header should implement equals and hashCode

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2006-04-03 at 21:18 +0200, Ortwin Glück wrote: 
> Oleg,
> 
> I think the Header class should implement equals and hashCode. Header is 
> used in HeaderGroup in a List. The remove method of is used which uses 
> equals to identify the right object.
> 
> Odi
> 

Odi,

How do you see the identity equality of HTTP headers?

(1) By header name 

These headers are identity equal

"Content-Type: text/plain"
"Content-Type: text/xml"

But these are not

"Content-Type: text/plain"
"Content-Length: 0"

(2) By header and case-insensitive value

These headers are identity equal

"Content-Type: text/plain"
"Content-Type: text/plain"
"Content-Type: TEXT/PLAIN"

But these are not

"Content-Type: text/plain"
"Content-Type: text/xml"
"Content-Type: text/xml; charset=utf-8"
"Content-Type: text/xml; charset = utf-8"

Anyway I look at it it just does not seem right. The only reasonable
case I see is that an HTTP header is identity equal to itself (this),
which I believe is the case with the current implementation

Oleg


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


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org