3.11. http メソッドを HTTP プロデューサーに設定する方法
HTTP コンポーネントは、メッセージヘッダーを設定して HTTP リクエストメソッドを設定する方法を提供します。以下に例を示します。
from("direct:start")
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.to("ahc:http://www.google.com")
.to("mock:results");
同等の Spring サンプルは次のとおりです。
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
<from uri="direct:start"/>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<to uri="ahc:http://www.google.com"/>
<to uri="mock:results"/>
</route>
</camelContext>