Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java XML路由中的Apache Camel简单谓词不工作-需要将标头转换为字符串吗?_Java_Xml_Spring Boot_Apache Camel - Fatal编程技术网

Java XML路由中的Apache Camel简单谓词不工作-需要将标头转换为字符串吗?

Java XML路由中的Apache Camel简单谓词不工作-需要将标头转换为字符串吗?,java,xml,spring-boot,apache-camel,Java,Xml,Spring Boot,Apache Camel,如有任何帮助,我们将不胜感激:) 我的骆驼路线XML文件中有以下代码: <choice> <when> <simple>${header.CamelHttpQuery} not contains '%'</simple> <process ref="firstResponseTransformer"/> </when> <otherwise>

如有任何帮助,我们将不胜感激:)

我的骆驼路线XML文件中有以下代码:

<choice>
    <when>
        <simple>${header.CamelHttpQuery} not contains '%'</simple>
        <process ref="firstResponseTransformer"/>
    </when>
    <otherwise>
        <process ref="secondResponseTransformer"/>
    </otherwise>
</choice>

${header.CamelHttpQuery}不包含“%”
(我也尝试过
!contains

正如你所看到的,我想去不同的课程,根据条件准备我的回答

通过在路由中前面命中的处理器中使用断点,我可以看到exchange>in>headers>CamelHttpQuery的值是
“”
,但无论该条件是否为真,否则标记中的转换器始终是要命中的

基于Camel文档,simple语句在我看来是正确的,我在代码库中还有其他简单语句,它们似乎工作得很好

有人知道为什么简单的在它应该是真实的时候不起作用吗

完全卡住了。提前谢谢

驼峰版本2.12.4


编辑:我想这是因为我需要将
标题转换为字符串。CamelHttpQuery
从字符转换为字符串,有人知道如何简单地做到这一点吗?

问题是我的标题。CamelHttpQuery是字符而不是字符串

正如Bedla在上述评论中所建议的,我修正了:
${headerAs(CamelHttpQuery,String)}不包含“%”

头可以使用
headerAs
函数转换为字符串<代码>${headerAs(CamelHttpQuery,字符串)}不包含“%”@Bedla perfect:)谢谢!