apache - 使用 apache camel 从 http 位置下载
问题描述
我需要使用 apache camel 从 http 位置将文件下载到本地系统。当我给出以下代码时
from("http://url/filename.xml")
.to("file://C:location")
它适用于 ftp,但当 url 为“http”时不起作用。也就是说,它不会将文件从 http 位置下载到“to()”中提供的本地地址。
解决方案
http 组件不能用作消费者,即。你不能有一个路由 from("http://...")
您需要使用将启动路由的消费者组件。你可以试试这样的
from("timer:foo?fixedRate=true&period=5000")
.to("http://url/filename.xml")
.to("file://C:location")
推荐阅读
- groovy - groovy中的自定义隐式强制
- sql - 从 SQL Server 2008 中的日期时间字段中删除毫秒
- javascript - 点击后如何关闭移动导航栏
- vhdl - vhdl:对象子类型不是本地静态的
- java - GeckoView 中有 shouldOverrideUrlLoading 吗?
- google-chrome - 表初始化后,数据表列标题在 Chrome 窗口中消失
- reactjs - 将组件作为变量传递时如何修复 TypeScript React 道具类型?
- python - 将具有多个循环和逻辑的代码简化为查询集聚合
- c# - 鼠标按钮一直被按下而不是单击
- regex - 在 Google 表格中使用正则表达式进行聚合