Azhaguvel A
Azhaguvel A

Reputation: 629

HTTPS authentication setup using camel-http?

I want to call https Rest API URL using Apache Camel API. Is this possible to call https Rest API URL using with Apache Camel API without hard code the user name and password of the https URL?

Upvotes: 1

Views: 996

Answers (1)

Peter Keller
Peter Keller

Reputation: 7636

Camel allows to read properties from files. Camel uses the {{key}} syntax to refer to a property:

 from("direct:start")
     .to("https://<your-url>?authMethod=Basic&authUsername={{username}}&authPassword={{password}}");

In this example, the properties username and password are defined in a property file that can be initialized as follows:

PropertiesComponent pc = new PropertiesComponent();
pc.setLocation("classpath:com/mycompany/myprop.properties");
context.addComponent("properties", pc);

More information can be found at http://camel.apache.org/properties.html.

Upvotes: 1

Related Questions