Archive

Archive for March, 2011

apache ant http task 1.1 released

March 29, 2011 5 comments

Due to a glaring feature omission from version 1.0, the ability to write the response entity to file, I’ve added a new attribute to the ant task to support this and moved the project to version 1.1.

The new version with updated documentation, samples and downloads can be found on the google code site http://code.google.com/p/missing-link/.

Sample usage to write an entity to file:

<?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.1.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/images/logos/ps_logo2.png" method="GET" outfile="google.png"/>
</target>
</project>
Categories: Uncategorized

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>