您好我需要通过https服务器发送一个文件和一些身份验证数据我在camel exchange中使用文件组件获取文件。
from("file:/home/r2/Desktop/ofBizFile?fileName=someFile")
.process(new ProcessorSetReq())
.setHeader(Exchange.HTTP_QUERY,constant("USERNAME=__&PASSWORD=__"))
.to("https4://someAddress")
.to("stream:out");
我期待处理器代码
中有类似的东西public void process(Exchange exchange)throws Exception{
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
File file =new File(exchange.getIn().getBody(String.class));
builder.addPart("configId",new StringBody("I_ORDER"));
builder.addPart("EnumId",new StringBody("CSV_FILE"));
builder.addPart("uploadedFile",new FileBody(file));//There is a problem
exchange.getIn().setBody(builder.build());
}
如何在所需参数中发送文件。还有其他方法吗?