HTTP Component
The http: component provides HTTP based endpoints for consuming external HTTP resources.
URI format
http:hostname[:port][/resourceUri]
Usage
You can only produce to endpoints generated by the HTTP component. Therefore it should never be used aas input into your camel Routes. To bind/expose an HTTP endpoint via an http server as input to a camel route, you can use the Jetty Component
How to set the POST/PUT/INFO/DELETE/GET to the HTTP producer
The HTTP component provides a way to set the HTTP request method by setting the message header. Here is an example;
new RouteBuilder() {
public void configure() {
from("direct:start")
.setHeader(org.apache.camel.component.http.HttpMethods.HTTP_METHOD, org.apache.camel.component.http.HttpMethods.POST)
.to("http:)
.to("mock:results");
}
};
And the equivalent spring sample:
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
<from uri="direct:start"/>
<setHeader headerName="http.requestMethod">
<constant>POST</constant>
</setHeader>
<to uri="http://www.google.com"/>
<to uri="mock:results"/>
</route>
</camelContext>
See Also