(go directly to the Sourceforge project page)
webdavclient4j is a generic WebDAV client for Java.
It is a compilation of all the java open source libraries needed to support webdav in java, as a client.
The project involved are:
Webdav is a powerful remote file management protocol, based on http. Unfortunately, for historical reasons, support of that protocol has always been tricky to setup in java. Webdavclient4j packs all the code necessary to add webdav client features to your java application.
The webdavclient4j is available both as binaries and sources.
You may include all the jars in your project, to enable webdav client features in your java application.
Note: the source version may contain some code from the commons-vfs project that rely upon jar files from the commons-vfs distribution (such as commons-net). This code is only needed if you plan to use protocolos other than webdav.
OutputStream fileWriter = null;
try {
// get a VirtualFileSystem Manager
FileSystemManager fsManager = VFS.getManager();
// retrieve the webdav resource
WebdavFileObject resource = (WebdavFileObject)fsManager.resolveFile( "webdav://foo.bar/webdav/resource.txt" );
// retrieve an output stream from that resource
fileWriter = resource.getOutputStream();
// use that output stream
// ...
} catch (Exception ex) {
throw ex;
} finally {
//close the stream at the end
if(fileWriter!=null)
fileWriter.close();
}