Hi I am quite new to Camel. I a executing a https4 call from camel route. I want to get the status code for the response. Where can I get this from?
To get the status code of an HTTP request made with the fetch method, access the status property on the response object. The response. status property contains the HTTP status code of the response, e.g. 200 for a successful response or 500 for a server error.
status() method on the res object will set a HTTP status code of 404 . To send the status code to the client-side, you can method chain using the . send() method. The status code 404 tells the client side that the data requested is not found.
camel-http's bridgeEndpoint=true If a route consumes from restlet/servlet, then later calls a different web endpoint (using the “http:” or “https:” components), you have to include the “? bridgeEndpoint=true” query param on that call's URI.
The http4: component provides HTTP based endpoints for calling external HTTP resources (as a client to call external servers using HTTP).
Response is located in the Camel's header CamelHttpResponseCode.
You can get the value of the header with simple language
${header.CamelHttpResponseCode}
More details about http4 component are http://camel.apache.org/http4.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With