You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Cristiano Costantini <cr...@gmail.com> on 2015/06/09 10:01:21 UTC

simple language for filters on values of HTTP headers

Hi All,
in a camel route starting with a Jetty endpoint,
I want to enable gzipping if the input sends the http header:
"Accept-Encoding: gzip"

However, the Accept-Encoding may have multiple comma separated values for
different encoding accepted, typical it is

Accept-Encoding: gzip, deflate

As the values are comma separated, I thought about a filter like this to be
fine (xml dsl):

<filter>
<simple>'gzip' in ${header[Accept-Encoding]}</simple>
... do gizipping ...
</filter>

the problem is that it works with a header value of "gzip, deflate" but it
won't work for a header value for example of "compress, deflate, exi, gzip,
identity", because the token split by in operator is ' gzip', (note the
extra space in front of it.

Do you have any suggestion to better handle this "dilemma" :-) ?


FYI I'm reverting to use:
<filter>
<simple>${header[Accept-Encoding]} contains 'gzip'</simple>
... do gizipping ...
</filter>
but using "in" would seem cleaner to me...

Thanks,
Cristiano