...
In Camel 1.5 the following algorithm is used to determine if either GET
or POST
HTTP method should be used:
1. Use method provided in header.
2. GET
if query string is provided in header.
3. GET
if endpoint is configured with a query string.
4. POST
if there is data to send (body is not null).
5. GET
otherwise.
How to get access to HttpServletRequest and HttpServletResponse
Available as of Camel 2.0
You can get access to these two using the Camel type converter system using
Code Block |
---|
HttpServletRequest request = exchange.getIn().getBody(HttpServletRequest.class);
HttpServletRequest response = exchange.getIn().getBody(HttpServletResponse.class);
|
Or you can get access to them from HttpMessage
directly using a type cast:
Code Block |
---|
HttpMessage msg = (HttpMessage) exchange.getIn();
HttpServletRequest request = msg.getRequest();
HttpServletRequest response = msg.getResponse();
|
Configuring URI to call
You can set the HTTP producer's URI directly form the endpoint URI. In the route below, Camel will call out to the external server, oldhost
, using HTTP.
...