Archive

Posts Tagged ‘java apache ant http task library xml web services rest restful’

apache ant http task

March 15, 2011 17 comments

A lightweight, full featured and flexible apache ant http task is ready for use, visit http://code.google.com/p/missing-link/ to download the library with documentation, source and examples.  The ant task is licensed under the Apache 2.0 license and is freely available for use in any situation.

I created this library because there simply isn’t any good ones out there.  Most don’t contain or expose access to core HTTP features such as authentication and headers.  And those that do exist usually have bugs that prevent normal usage, poorly documented or have some other limiting factor.

It’s great for use in build processes which need to invoke HTTP services (think XML RESTful web services, for example), as well as testing URLs.

Using the ant task is very simple, here is a complete working ant build file example:

<?xml version="1.0" encoding="UTF-8"?>
<project name="ml-ant-http" basedir="." default="http-get">

<property name="ml-ant-http.jar" value="ml-ant-http-1.0.jar"/>

<fileset id="runtime.libs" dir=".">
<include name="${ml-ant-http.jar}"/>
</fileset>

<path id="runtime.classpath">
<fileset refid="runtime.libs"/>
</path>

<taskdef name="http" classname="org.missinglink.ant.task.http.HttpClientTask">
<classpath refid="runtime.classpath"/>
</taskdef>

<target name="http-get">
<http url="http://www.google.com"/>
</target>
</project>