camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dunnlow <dunn...@yahoo.com>
Subject If header (a string) exists and length is > 5, then.... via Spring DSL?
Date Mon, 26 Nov 2012 17:56:47 GMT
With camel 2.10 and Spring 3.1 I am trying to test to see if a string in a
header exists OR is too short.  The test for null works as expected, but I
seem to be unable to check the length.  Any thoughts as to why?

<camel:choice>
   <camel:when>
     <camel:javascript>
          request.headers.get('name')==null ||
request.headers.get('name').length
     </camel:javascript>
     <camel:setBody><camel:constant>Name too
small</camel:constant></camel:setBody>
   <camel:when>
</camel:choice>

Is there a better way to do this?

Oddly, while trying to figure out the issue, I added an otherwise statement
like:
<camel:otherwise>
    <camel:setBody>
       <camel:javaScript>String("Hello").length</camel:javaScript>
    </camel:setBody>
<camel:otherwise>

I get the exception
java.lang.ClassNotFoundException  org.apache.hadoop.hbase.util.Bytes

my simple little test does not use hadoop

(I also tried just "Hello".length and got the same exception)

Thanks for any insight,
-J



--
View this message in context: http://camel.465427.n5.nabble.com/If-header-a-string-exists-and-length-is-5-then-via-Spring-DSL-tp5723252.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message