我有一个文件夹说“MyFiles”,我有很多文件。现在我需要通过HTTP上传这些文件。方法是什么?
我尝试过以下但是错了
<flow name="testFlow1" doc:name="testFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<http:rest-service-component
serviceUrl="http://localhost:8280/rest/xyz"
httpMethod="POST">
</http:rest-service-component>
<http:endpoint host="localhost" port="5430" encoding="UTF-8"
method="POST" connector-ref="fileHttp" path="fileuploader" name="muleFileUploader">
</http:endpoint>
</flow>
请帮忙。由于输入文件夹将包含多个文件,我们如何才能实现呢?
由于
答案 0 :(得分:2)
您的流不使用文件入站端点并使用通用(非非输出)HTTP端点,因此无法使用此功能。
以下是成功将文件上载到HTTP端点的配置。没有object-to-byte-array-transformer
我不能让它工作(同一个文件一次又一次地被轮询 - bug?),所以我希望你的文件不是很大......
<flow name="fileUploader">
<file:inbound-endpoint path="/tmp/mule/in"
pollingFrequency="5000" moveToDirectory="/tmp/mule/done" />
<object-to-byte-array-transformer />
<http:outbound-endpoint address="http://..."
method="POST" exchange-pattern="request-response" />
</flow>