Home

What is Content Management?

What is WebDAV?

WebDAV Clients:

Java Documentation:

A Simple PROPFIND/PROPPATCH Client

Not many of the available WebDAV clients offer very sophisticated support for the two properties methods -- PROPFIND and PROPPATCH, and I wanted to write some site management utilities using these methods. So I finally sat down and started writing my own PROPFIND/PROPPATCH client.

I started with Ronald Tschalär's HTTPClient. HTTPClient doesn't support any of the WebDAV methods, but it includes a method called HTTPConnection.ExtensionMethod(), which can be used to extend the functionality of the client.

My code provides two classes: a WebDAVConnection class (which includes a doPropatch() method and a variety of doPropfind() methods) and a WebDAVTest class that provides a simple command line test for the connection class.

To use this client, compile the two classes and put the class files into a directory included in your CLASSPATH. Type:


org.bcholmes.webdav.client.test.WebDAVTest PROPFIND http://localhost/dav/mypage.html test.xml

This command will send the test.xml XML content to the DAV Server. A valid XML file might look like this:

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
  <D:allprop/>
</D:propfind>

Testing

I wrote this using version 1.3 of the Java Software Development Kit, although I don't think there's anything specific to that version in the code. It was tested on Windows 98, against a mod_dav implementation of WebDAV.

I was forced to change the org.apache.slide.util.dom.DOMWriter class because the DOMWriter refused to use any encoding other than 8859-1, and that encoding caused an XML Syntax error on my web server. Once I changed it to utf-8, all was well with the world.

Source Code

My JAR file


Copyright © 2000 by B.C. Holmes. Last updated: June 24th, 2000
Slide Guide logo © by B.C. Holmes and Siobhan NiLoughlin.
Slide is a project by the Apache Software Foundation.