9

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?

Susanna Michael
  • 141
  • 1
  • 3
  • 11
  • Do the person with the close vote - why on earth is this unclear? Its a very specific question in apache camel. If you dont understand the framework, please dont throw close votes like this. – vikingsteve Mar 21 '18 at 11:46
  • 1
    see the section Message headers in the documentation [link](http://camel.apache.org/http4.html) – Aku Nour Mar 21 '18 at 12:18
  • 2
    Do yourself a favour and start reading the documentation for 5-10 minutes before asking a question here. – Claus Ibsen Mar 21 '18 at 12:22

1 Answers1

13

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

Themis Pyrgiotis
  • 876
  • 5
  • 15
  • Where did you see mention of ${header.CamelHttpResponseCode} at that link? As of July 8th, 2019, I see nothing about this header in the documentation you referenced. – Nick A. Watts Jul 08 '19 at 14:38
  • 2
    See section "Message Headers" in the above link, the header `Exchange.HTTP_RESPONSE_CODE` which value is `CamelHttpResponseCode`. Syntax `${}` is Camel Simple language (https://camel.apache.org/simple.html) that is used to fetch info such headers and more. – Themis Pyrgiotis Jul 09 '19 at 06:27
  • 3
    Thanks. I guess I just didn't realize that a header named `Exchange.HTTP_RESPONSE_CODE` would be available named as `CamelHttpResponseCode` with Simple. The HTTP4 docs do not seem to state this explicitly. – Nick A. Watts Jul 09 '19 at 11:46
  • Header name is `CamelHttpResponseCode`, which is defined as a camel constant with variable name `HTTP_RESPONSE_CODE`. Yes confusing at first. – WesternGun Jan 04 '23 at 09:00