camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dunnlow <dunn...@yahoo.com>
Subject Accessing a Map header via Simple?
Date Tue, 31 Jan 2012 17:12:41 GMT
Hi.  I have a Map<String,Object> in my header and I am trying to access it
via Simple in my spring dsl.

I see an example using body in the documentation and am extrapolating that
for my header purposes.  However, I'm getting a NullPointerException, so I
am thinking I've got bad syntax.

My map holds key/value pairs like ->
{("user1","http://127.0.0.1/serv/s1"),("user2","http://127.0.0.1/serv/s2)}
and has been added to the headers and is named uriMap.

I want to do a lookup on "user1" for example.

I'm trying: 

   <simple>user1=${in.header.uriMap[user1]}</simple>

Question:
 -  Is it ok without quotes around user1?
 -  If there is no user1 in the map, can I use the .? to avoid a NPE like:
in.header?.uriMap[user1]?

Thanks!
-J

--
View this message in context: http://camel.465427.n5.nabble.com/Accessing-a-Map-header-via-Simple-tp5445156p5445156.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message