Ant 的 RESTful httpclient
我需要一个用于 Ant 的 RESTful httpclient。
与 contrib 相关的任务似乎都不再起作用了。
还没有人桥接 Commons-HTTPClient 和 Ant 吗?
I need a RESTful httpclient for Ant.
None of the contrib related tasks seem to work anymore..
Hasn't anyone bridged Commons-HTTPClient and Ant yet?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(4)
倚栏听风2024-08-30 03:33:39
我已经使用 CURL 从 ANT 到 POST 文件并使用以下宏定义:
<pathconvert property="curl.path" targetos="windows">
<path location="${lib.dir}/curl/curl.exe"/>
</pathconvert>
<macrodef name="post-file" description="Use Curl to post the file to the WEBDAV path">
<attribute name="file"/>
<attribute name="url" />
<attribute name="username" default="${username}" />
<attribute name="password" default="${password}" />
<sequential>
<echo message="Using CURL to upload @{file} to @{url}" />
<!--Execute curl to post the file to the URL -->
<exec executable="${curl.path}">
<arg value='-L'/>
<arg value='-k'/>
<arg value='-f'/>
<arg value='-s'/>
<arg value="--anyauth"/>
<arg value="-u"/>
<arg value="@{username}:@{password}"/>
<arg value="-T" />
<arg value='"@{file}"' />
<arg value='@{url}'/>
</exec>
</sequential>
</macrodef>
像这样执行宏定义:
<target name="test-upload">
<post-file file="${file}"
url="${url}"
username="${username}"
password="${password}" />
</target>
慢慢从新开始2024-08-30 03:33:39
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
尝试使用 Ant exec 任务和 curl。
Try using an Ant exec task and curl.