Reputation: 629
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
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