差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
java:ant:http_methods [2018/10/07 20:20] tony [HttpMethods] |
java:ant:http_methods [2023/06/25 09:48] (目前版本) |
||
---|---|---|---|
行 8: | 行 8: | ||
==== Get Artifacts ==== | ==== Get Artifacts ==== | ||
Ant-Http的原始碼可以從GitHub上取得,可以直接透過git從https://github.com/antlibs/ant-http.git clone。我是透過eclipse匯入的,因為它專案libraries是透過ivy resolve,所以整個在eclipse上跑起來沒什麼問題;build ant lib可以直接執行它提供的build.xml,以下是專案結構內容:\\ | Ant-Http的原始碼可以從GitHub上取得,可以直接透過git從https://github.com/antlibs/ant-http.git clone。我是透過eclipse匯入的,因為它專案libraries是透過ivy resolve,所以整個在eclipse上跑起來沒什麼問題;build ant lib可以直接執行它提供的build.xml,以下是專案結構內容:\\ | ||
- | {{:java:ant:ant-http-project-arch.png|}} | + | {{:java:ant:ant-http-project-arch.png|}}\\ |
- | ==== HttpMethods ==== | + | \\ |
+ | 在設定上,dist有一個ant-http所提供的範例,所以應該不會有什麼問題。使用的部分我直接提供範例給大家參考。 | ||
+ | ==== HTTP PUT ==== | ||
+ | PUT我用於上傳檔案。source file透過entity指定;如果你的http server需要basic認證,可以使用credentials。 | ||
<code xml> | <code xml> | ||
<target name="put-artifact"> | <target name="put-artifact"> | ||
行 20: | 行 22: | ||
</target> | </target> | ||
</code> | </code> | ||
+ | 假如你要上傳的檔案非文字檔而是二進位檔,如執行檔、zip檔等,記得要在entity宣告binary為true: | ||
+ | <code xml> | ||
+ | <entity file="test.zip" binary="true"/> | ||
+ | </code> | ||
+ | ==== HTTP DELETE ==== | ||
<code xml> | <code xml> | ||
<target name="delete-artifact"> | <target name="delete-artifact"> |