You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2009/08/07 10:04:35 UTC

[jira] Created: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Lookup headers from a Camel Message should be case agnostic
-----------------------------------------------------------

                 Key: CAMEL-1886
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
             Project: Apache Camel
          Issue Type: Improvement
          Components: camel-core
    Affects Versions: 2.0-M3
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 2.0.0


Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.

And for some protocols the header case do not matter such as
- http
- mail
etc.

And who would in real life want to send 2 headers that are different only depending on the case
- Foo=me
- foo=you



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-1886:
-------------------------------

    Fix Version/s: 2.1.0

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0, 2.1.0
>
>         Attachments: CAMEL_1886.patch, CaseInsensitiveMap.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-1886.
--------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.1.0)

trunk: 802700.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: AnotherCaseInsensitiveMap.java, CAMEL_1886.patch, CaseInsensitiveMap.java, KeyValuePair.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Ryadh Amar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57368#action_57368 ] 

Ryadh Amar commented on CAMEL-1886:
-----------------------------------

I agree with Christian on this one, we are also using Business Works, and case-sensitive headers are expected, I was actually going to comment on this issue a long time ago.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: AnotherCaseInsensitiveMap.java, CAMEL_1886.patch, CaseInsensitiveMap.java, KeyValuePair.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Christian Schneider (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57360#action_57360 ] 

Christian Schneider edited comment on CAMEL-1886 at 2/3/10 11:10 PM:
---------------------------------------------------------------------

We have the case where we want to send out case sensitive headers. CXF expects the soap action to be written SOAPAction, Tibco Business Works expects it like SoapAction (at least when using SOAP/JMS). 

So I vote for reverting this change and bring back the normal map.  Perhaps the case insensitive lookup can be implemented in a way that does not affect people who need case sensitive headers.

      was (Author: chris@die-schneider.net):
    We have the case where we want to send out case sensitive headers. CXF expects the soap action to be written SOAPAction, Tibco Business Works expects it like SoapAction (at least when using SOAP/JMS). 

So I vote for reverting this change and bring back the normal map. 
  
> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: AnotherCaseInsensitiveMap.java, CAMEL_1886.patch, CaseInsensitiveMap.java, KeyValuePair.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-1886:
-------------------------------

    Attachment:     (was: CaseInsensitiveMap.java)

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0, 2.1.0
>
>         Attachments: AnotherCaseInsensitiveMap.java, CAMEL_1886.patch, CaseInsensitiveMap.java, KeyValuePair.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53538#action_53538 ] 

Claus Ibsen commented on CAMEL-1886:
------------------------------------

Started discussion on dev forum
http://www.nabble.com/-DISCUSS----Camel-2.0---Case-insensitive-headers-on-Camel-Message-td24877029s22882.html

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53544#action_53544 ] 

Hadrian Zbarcea commented on CAMEL-1886:
----------------------------------------

Claus, what about a Map<lowercase-header, <header, Object>> ?

The key would always be the lowercase header for searches and what not, but on the wire and where it matters the original header value would be used.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: CAMEL_1886.patch, CaseInsensitiveMap.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53544#action_53544 ] 

Hadrian Zbarcea edited comment on CAMEL-1886 at 8/8/09 10:50 AM:
-----------------------------------------------------------------

Claus, what about a Map<lowercase-header, <header, Object>> ?

The key would always be the lowercase header for searches and what not, but on the wire and where it matters the original header value would be used.

I agree that having case sensitive headers doesn't make sense (i.e. having 'Foo' and 'foo' as different headers).

      was (Author: hadrian):
    Claus, what about a Map<lowercase-header, <header, Object>> ?

The key would always be the lowercase header for searches and what not, but on the wire and where it matters the original header value would be used.

I agree that having cases sensitive headers doesn't make sense (i.e. having 'Foo' and 'foo' as different headers).
  
> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: CAMEL_1886.patch, CaseInsensitiveMap.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Christian Schneider (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57360#action_57360 ] 

Christian Schneider commented on CAMEL-1886:
--------------------------------------------

We have the case where we want to send out case sensitive headers. CXF expects the soap action to be written SOAPAction, Tibco Business Works expects it like SoapAction (at least when using SOAP/JMS). 

So I vote for reverting this change and bring back the normal map. 

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: AnotherCaseInsensitiveMap.java, CAMEL_1886.patch, CaseInsensitiveMap.java, KeyValuePair.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53550#action_53550 ] 

Claus Ibsen commented on CAMEL-1886:
------------------------------------

As this change isn't a blocker for 2.0 I think we could take our time and maybe introduce it post 2.0 release?

As Hadrian also points out sending Foo and foo as two headers is not what end users want.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0, 2.1.0
>
>         Attachments: CAMEL_1886.patch, CaseInsensitiveMap.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53559#action_53559 ] 

Claus Ibsen commented on CAMEL-1886:
------------------------------------

I am going for example b as the other cases to much trouble elsewhere.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0, 2.1.0
>
>         Attachments: AnotherCaseInsensitiveMap.java, CAMEL_1886.patch, CaseInsensitiveMap.java, KeyValuePair.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53524#action_53524 ] 

Claus Ibsen commented on CAMEL-1886:
------------------------------------

See the commit on tuning-experiment branch that we need to backport to trunk
svn tuning: 801918.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-1886:
-------------------------------

    Attachment: CAMEL_1886.patch

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: CAMEL_1886.patch
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53540#action_53540 ] 

Claus Ibsen commented on CAMEL-1886:
------------------------------------

I had another implementation that was compacter and in a single class.

Attached as AnotherCaseInsensitiveMap.java
However its issue is to retain the case of the keys we need to override entrySet and use the original keys.
That works, however then scripting engines such as Freemarker have an issue doing lookup. But I just got that resolved using a 2nd lookup using a pseudo lookup.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: CAMEL_1886.patch
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-1886:
-------------------------------

    Attachment: CaseInsensitiveMap.java

A much better implementation that only requires one file and do *not* store holder objects such as a KeyValuePair.

And it works out of the box with scripting engines such as Velocity and Freemarker as well.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: CAMEL_1886.patch, CaseInsensitiveMap.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-1886:
-------------------------------

    Attachment: KeyValuePair.java
                AnotherCaseInsensitiveMap.java

*example a*
- AnotherCaseInsensitiveMap
- KeyValuePair

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0, 2.1.0
>
>         Attachments: AnotherCaseInsensitiveMap.java, CAMEL_1886.patch, CaseInsensitiveMap.java, CaseInsensitiveMap.java, KeyValuePair.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-1886:
-------------------------------

    Attachment: CaseInsensitiveMap.java

*example b*
- CaseInsensitiveMap

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0, 2.1.0
>
>         Attachments: AnotherCaseInsensitiveMap.java, CAMEL_1886.patch, CaseInsensitiveMap.java, CaseInsensitiveMap.java, KeyValuePair.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53519#action_53519 ] 

Claus Ibsen commented on CAMEL-1886:
------------------------------------

[09:55]  <davsclaus> jstrachan i wonder if we should add a case insensitve header lookup
[09:56]  <davsclaus> the mail component is kinda relying on people can spell the headers as they like
[09:56]  <davsclaus> Reply-TO
[09:56]  <davsclaus> reply-to
[09:56]  <davsclaus> Reply-To
[09:56]  <davsclaus> etc.
[09:56]  <davsclaus> different providers might have different case
[09:56]  <davsclaus> and we got that behavior now for camel mail
[09:56]  <davsclaus> wonder if that should be extended to a core feature
[09:56]  <davsclaus> eg
[09:56]  <davsclaus> content-type
[09:56]  <davsclaus> Content-type
[09:57]  <davsclaus> Content-Type
[09:57]  <jstrachan> yeah - http is the same
[09:57]  <davsclaus> can be spelt different
[09:57]  <davsclaus> I doubt anyone want to send 2 headers with dfferent case
[09:57]  <davsclaus> Foo=me
[09:57]  <davsclaus> foo=you
[09:57]  <jstrachan> yeah
[09:57]  <davsclaus> cool as the tuning kinda changes a bit as its a bit more lazy on headers
[09:58]  <davsclaus> so if you lookup directly on the source object (MailMessage etc.) then the case can change when its later extracted to the camel message headers
[09:58]  <davsclaus> so its confusing
[09:58]  <jstrachan> yeah
[09:58]  <davsclaus> okay i think we should add that to the camel-core so whenever you do a getHeader(name) it can lookup regardless of case
[09:59]  <davsclaus> how can we do that fast, eg use some Entry object as Key instead of string? so we can do a equals/hashCode contract?
[09:59]  <davsclaus> where we can control the equals to be in case sensitve
[09:59]  <davsclaus> as you may want to retrieve the headers out in the original case
[10:00]  <jstrachan> I guess we could always use a custom Map which just converts all keys to lower case before storing/looking up?
[10:00]  <davsclaus> so we cannot just do .toLowerCase when adding a header/headers
[10:00]  <davsclaus> but when you get the keys back they will be lower now? do we want that
[10:00]  <davsclaus> We also got some speical camel headers: CamelFileName
[10:01]  <davsclaus> easier to read when its Camel cased :)
[10:01]  <jstrachan> I guess we could have 2 maps; the map which preserves case; and a lower-case-index used to lookup headers in a case insensitive way? bit icky mind you
[10:01]  <jstrachan> I guess the latter could kick in if folks do a get() which doesn't find anything
[10:01]  <jstrachan> so to avoid creating 2 maps, we only use the case-insensiive index when folks do get(String) and don't find anything
[10:01]  <davsclaus> ah yeah try the regular map first and if null then the 2nd as lowered cased
[10:02]  <jstrachan> Object getHeader(String name) { Object answer = map.get(name); if (answer == null) { answer = getLowerCaseMap().get(name.toLowerCase())
[10:02]  <davsclaus> so we create the 2nd map lazy?
[10:02]  <jstrachan> yeah
[10:02]  <davsclaus> ah clever
[10:02]  <davsclaus> let me grab coffee and try it on the pesky mail
[10:02]  <jstrachan> so its zero cost when folks never do lookups; when we just copy headers from message to message we don't bother with the lower case map
[10:02]  <jstrachan> :)
[10:03]  <davsclaus> and doing a map empty check as well to avoid creating the 2nd if empty
[10:03]  <jstrachan> yeah
[10:03]  <davsclaus> btw about 50% of the componetns now tests with tuning


> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53544#action_53544 ] 

Hadrian Zbarcea edited comment on CAMEL-1886 at 8/8/09 9:57 AM:
----------------------------------------------------------------

Claus, what about a Map<lowercase-header, <header, Object>> ?

The key would always be the lowercase header for searches and what not, but on the wire and where it matters the original header value would be used.

I agree that having cases sensitive headers doesn't make sense (i.e. having 'Foo' and 'foo' as different headers).

      was (Author: hadrian):
    Claus, what about a Map<lowercase-header, <header, Object>> ?

The key would always be the lowercase header for searches and what not, but on the wire and where it matters the original header value would be used.
  
> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: CAMEL_1886.patch, CaseInsensitiveMap.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53551#action_53551 ] 

Claus Ibsen commented on CAMEL-1886:
------------------------------------

Hadrian I have now a solution using the KeyValuePair object as holder.

It works as well with the scripting engines when I go the extra mile and _washes the KeyValuePair object away_ when they get hold on the headers.

The other solution that does *not* use KeyValuePair do not need to do this and thus is more elegant. However it requires to keep booking of the lower case keys -> original key in a 2nd internal map.

So in result we got 2 possible solutions
a) Use KeyValuePair holder objects (that holds original key and value)
b) Use internal 2nd map to keep booking of lower case key -> original key

I will attach new files with a and b code

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0, 2.1.0
>
>         Attachments: CAMEL_1886.patch, CaseInsensitiveMap.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53555#action_53555 ] 

Claus Ibsen commented on CAMEL-1886:
------------------------------------

example b works best as it can complete a test run in all Camel code with no problems.

example a currently have issues with the camel-jms component.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0, 2.1.0
>
>         Attachments: AnotherCaseInsensitiveMap.java, CAMEL_1886.patch, CaseInsensitiveMap.java, KeyValuePair.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1886) Lookup headers from a Camel Message should be case agnostic

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53549#action_53549 ] 

Claus Ibsen commented on CAMEL-1886:
------------------------------------

@Hadrian

I tried that as well. Its in the first patch but it messes up how scripting engines and other frameworks accesses the Map. To fix this we need yo copy the map to a regular Map instance for them to work with. And then we need to merge back any changes.

That is doable but the latest patch is just a single class that works in all situations - and something I wanted to try out afterwards to see if that was possible.

> Lookup headers from a Camel Message should be case agnostic
> -----------------------------------------------------------
>
>                 Key: CAMEL-1886
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1886
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M3
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: CAMEL_1886.patch, CaseInsensitiveMap.java
>
>
> Today the case matter so: getHeader("Foo") and getHeader("foo") is not the same.
> And for some protocols the header case do not matter such as
> - http
> - mail
> etc.
> And who would in real life want to send 2 headers that are different only depending on the case
> - Foo=me
> - foo=you

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.