简单表达式中的条件运算符AND在Camel中不起作用

时间:2017-09-04 11:13:11

标签: apache-camel

我想仅在使用过滤器的rest url中的参数 id name 值都为null时显示日志,但是对于所有已执行的情况< / p>

只有在大小写

的情况下才能执行该块
http://localhost:9098/myapi/student?age=12

但即使条件失败,也总会执行过滤器

用于下面的网址案例

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

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

这里id / name param不为null 代码

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

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

如果您研究简单语言的文档,那么它表示您必须在运算符周围使用空间。它也不应该在引用中

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

应该是

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