我想使用Apache调用https Rest。是否可以使用Apache Camel API调用https Rest,而不需要硬代码、https URL?的用户名和密码?
发布于 2014-03-17 19:59:26
Camel允许从文件中读取属性。Camel使用{{key}}语法引用属性:
from("direct:start")
.to("https://<your-url>?authMethod=Basic&authUsername={{username}}&authPassword={{password}}");在本例中,属性username和password在可以初始化的属性文件中定义如下:
PropertiesComponent pc = new PropertiesComponent();
pc.setLocation("classpath:com/mycompany/myprop.properties");
context.addComponent("properties", pc);更多信息可以在http://camel.apache.org/properties.html上找到。
https://stackoverflow.com/questions/22462344
复制相似问题