0
votes

I have an application which uses Apache Camel to build an API. It basically uses blueprint.xml to define routes and processing is done by a bean(please note its not any processor bean. Just a plain Java bean). It uses Jersey client to invoke the backend system Rest API.

My requirement is to get the http headers in the code to be able to send them to our custom logging system.

a) I tried @httpHeaders annotation but this does not inject the headers on my code. b) Since its not using any BeanProcessor i dont have an Exchange object from where i can get the header values.

Please help with a way to get header values on the code.

1

1 Answers

1
votes

Add the request context to your class

 @Context
 private HttpServletRequest request;

and get the headers in your endpoint using request.getHeader

Returns the value of the specified request header as a String.