As part of my Ant build process, I'd like to upload files to a webserver via HTTP Post. Ant only comes with an HTTP Get task. However, Ant Contrib seems to have an HTTP Post task. The problem is that it doesn't have any Basic Authentication (like get does) or any way to specify a file upload (despite what the docs say, "rawFile" is not part of the distro).
My question is: does Ant Contrib's Post task actually support what I want, but in a non-obvious way (perhaps I have to do it by hand)? Or is there some other way to do this?
I have created an Apache 2.0 licensed, full featured and easy to use ant http task. It utilizes code java.net.* classes and has no third party library dependencies.
It can do POST/PUT with files or in-line entities, and has flexible options for setting required headers, authentication and status code checking for build failure on unexpected results.
http://missinglinkcode.wordpress.com/2011/03/15/apache-ant-http-task/
Use the curl program called via an ANT exec task.
For curl examples read this answer
A new ant http task named "Missing Link" has been announced on the Ant User List, give it a try = http://code.google.com/p/missing-link/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With