mgunjara
mgunjara

Reputation: 21

How to set Header value as Bean method in Camel

I'm setting header value as bean like this , but not working.

.setHeader("Authorization", "Basic "+authCache.getAuthCache().getClintToken());

Upvotes: 0

Views: 2453

Answers (2)

Claus Ibsen
Claus Ibsen

Reputation: 55550

The easiest is probably to add a method on your RouteBuilder class where you define the route where you build that constant value.

public String clientToken() {
   return "Basic " + authCache.getAuthCache().getClientToken();
}

And then call this method from your Camel route

setHeader("Authorization", method(this, "clientToken"))

Upvotes: 1

pvpkiran
pvpkiran

Reputation: 27078

.setHeader("Authorization", constant("Basic "+authCache.getAuthCache().getClientToken()));

Try this

Upvotes: 0

Related Questions