MaDHaN MinHo
MaDHaN MinHo

Reputation: 529

Conditional operator AND in Simple Expression doesnt work in Camel

I want to show log only if both param id and name value are null in rest url using filter but for all the cases it got executed

The block should be executed only if below case

http://localhost:9098/myapi/student?age=12

But filter is always got executed even condition fails

for the url cases like below

http://localhost:9098/myapi/student?id=100&age=16

http://localhost:9098/myapi/student?name=john&age=12

Here the id/name param is not null Code

<filter id="_filter1">
                <simple>" ${in.header.name} == null and ${in.header.id}==null"</simple>
          <log  message="Both param are null"/>
 </filter>

Any suggestions?

Upvotes: 0

Views: 4296

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55555

If you study the documentation of the simple language, then it says that you must use space around the operators. And it should not be in a quote either

This

<simple>" ${in.header.name} == null and ${in.header.id}==null"</simple>

Should be

<simple>${in.header.name} == null and ${in.header.id} == null</simple>

Upvotes: 1

Related Questions