HttpClient client = new HttpClient();
String url = "http://www.discursive.com/jccook/dav/test.html";
Credentials credentials =
new UsernamePasswordCredentials("davuser", "davpass");
// List resources in top directory
WebdavResource resource = new WebdavResource(url, credentials);
// Lock the Resource for 100 seconds
boolean locked = resource.lockMethod( "tobrien", 100 );
if( locked ) {
try {
// Read content as a String
String resourceData = resource.getMethodDataAsString();
printResource(resource, resourceData);
// Modify a resource
System.out.println( "*** Modifying Resource");
resourceData = resourceData.replaceAll( "test", "modified test" );
resource.putMethod( resourceData );
} finally {
// Unlock the resource
resource.unlockMethod( "tobrien" );
}
}
// Close the resource
resource.close();