我用骆驼-阿帕奇公司的骆驼-http。我正在尝试从我的自定义头设置http方法。我用蓝图
覆盖过程:exchange.getOut().setHeader("custom_http_method", "GET");
蓝图路线:
<route>
<from uri="activemq://for_redmine" />
<setHeader headerName="Content-Type">
<constant>application/json; charset=utf-8</constant>
</setHeader>
<setHeader headerName="X-Redmine-API-Key">
<constant>beb50ea768f5d16c96030a9dbbf3cb5c4a5ccdcd</constant>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>${header.custom_http_method}</constant>
</setHeader>
<toD uri="${header.url}"/>
</route>错误: org.apache.camel.TypeConversionException:在类型转换过程中从类型: java.lang.String转换为所需的类型:值为${header.custom_http_method}的org.apache.camel.http.common.HttpMethods : No枚举常量java.lang.IllegalArgumentException
据我所知,$ {header.custom_http_method}没有返回值。
toD uri="${header.url}“-工作正常
发布于 2019-02-08 07:08:35
在设置标头时尝试使用简单而不是常量。
<route>
<from uri="activemq://for_redmine" />
....
<setHeader headerName="CamelHttpMethod">
<simple>${header.custom_http_method}</simple>
</setHeader>
<toD uri="${header.url}"/>
</route>https://stackoverflow.com/questions/54587354
复制相似问题