Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the response status code after a camel http call

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?

like image 263
Susanna Michael Avatar asked Mar 21 '18 11:03

Susanna Michael


People also ask

How do I find HTTP response status?

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.

How do I send a status code in response?

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.

What is bridgeEndpoint true?

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.

What is http4?

The http4: component provides HTTP based endpoints for calling external HTTP resources (as a client to call external servers using HTTP).


1 Answers

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

like image 172
Themis Pyrgiotis Avatar answered Oct 12 '22 07:10

Themis Pyrgiotis