Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.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 如何从blueprint动态设置HTTP方法(驼峰HTTP)_Java_Apache Camel_Apache Servicemix_Blueprint Osgi_Camel Http - Fatal编程技术网

Java 如何从blueprint动态设置HTTP方法(驼峰HTTP)

Java 如何从blueprint动态设置HTTP方法(驼峰HTTP),java,apache-camel,apache-servicemix,blueprint-osgi,camel-http,Java,Apache Camel,Apache Servicemix,Blueprint Osgi,Camel Http,我使用驼峰apache Companient驼峰http。我正在尝试从自定义头设置http方法。我使用蓝图 覆盖过程: exchange.getOut() 蓝图路线: <route> <from uri="activemq://for_redmine" /> <setHeader headerName="Content-Type"> <constant>application/json

我使用驼峰apache Companient驼峰http。我正在尝试从自定义头设置http方法。我使用蓝图

覆盖过程:
exchange.getOut()

蓝图路线:

    <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>

应用程序/json;字符集=utf-8
beb50ea768f5d16c96030a9dbbf3cb5c4a5ccdcd
${header.custom_http_method}
错误: org.apache.camel.TypeConversionException:从类型java.lang.String转换为所需类型时出错:org.apache.camel.http.common.HttpMethods,值为${header.custom_http_method}due java.lang.IllegalArgumentException:没有枚举常量org.apache.camel.http.common.HttpMethods.${header.custom_http_method}

据我所知,${header.custom_http_method}没有返回值


toD uri=“${header.url}”-工作正常

在设置标头CamelHttpMethod时,请尝试使用简单而不是常量

 <route>
        <from uri="activemq://for_redmine" />
        ....
         <setHeader headerName="CamelHttpMethod">
          <simple>${header.custom_http_method}</simple> 
         </setHeader> 
        <toD uri="${header.url}"/>
    </route>

....
${header.custom_http_method}

在设置标头CamelHttpMethod时,请尝试使用简单而不是常量

 <route>
        <from uri="activemq://for_redmine" />
        ....
         <setHeader headerName="CamelHttpMethod">
          <simple>${header.custom_http_method}</simple> 
         </setHeader> 
        <toD uri="${header.url}"/>
    </route>

....
${header.custom_http_method}