r2358 - in branches: . slide-webdavclient slide-webdavclient/upstream slide-webdavclient/upstream/2.1 slide-webdavclient/upstream/2.1/ant slide-webdavclient/upstream/2.1/ant/src slide-webdavclient/upstream/2.1/ant/src/java slide-webdavclient/upstream/2.1/ant/src/java/org slide-webdavclient/upstream/2.1/ant/src/java/org/apache slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/doc-files slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs slide-webdavclient/upstream/2.1/clientlib slide-webdavclient/upstream/2.1/clientlib/src slide-webdavclient/upstream/2.1/clientlib/src/java slide-webdavclient/upstream/2.1/clientlib/src/java/org slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/ui slide-webdavclient/upstream/2.1/commandline slide-webdavclient/upstream/2.1/commandline/src slide-webdavclient/upstream/2.1/commandline/src/bin slide-webdavclient/upstream/2.1/commandline/src/java slide-webdavclient/upstream/2.1/commandline/src/java/org slide-webdavclient/upstream/2.1/commandline/src/java/org/apache slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd slide-webdavclient/upstream/2.1/connector slide-webdavclient/upstream/2.1/connector/example slide-webdavclient/upstream/2.1/connector/example/src slide-webdavclient/upstream/2.1/connector/example/src/conf slide-webdavclient/upstream/2.1/connector/example/src/java slide-webdavclient/upstream/2.1/connector/example/src/java/connector slide-webdavclient/upstream/2.1/connector/src slide-webdavclient/upstream/2.1/connector/src/java slide-webdavclient/upstream/2.1/connector/src/java/org slide-webdavclient/upstream/2.1/connector/src/java/org/apache slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector slide-webdavclient/upstream/2.1/etc slide-webdavclient/upstream/2.1/etc/conf slide-webdavclient/upstream/2.1/etc/conf/connector slide-webdavclient/upstream/2.1/etc/conf/connector/jboss

Marcus Better marcusb-guest at costa.debian.org
Tue Sep 5 16:06:15 UTC 2006


Author: marcusb-guest
Date: 2006-09-05 16:06:12 +0000 (Tue, 05 Sep 2006)
New Revision: 2358

Added:
   branches/slide-webdavclient/
   branches/slide-webdavclient/upstream/
   branches/slide-webdavclient/upstream/2.1/
   branches/slide-webdavclient/upstream/2.1/LICENSE
   branches/slide-webdavclient/upstream/2.1/NOTICE
   branches/slide-webdavclient/upstream/2.1/README
   branches/slide-webdavclient/upstream/2.1/ant/
   branches/slide-webdavclient/upstream/2.1/ant/src/
   branches/slide-webdavclient/upstream/2.1/ant/src/java/
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/CollectionScanner.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Mimetypes.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/ResourceProperties.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/ScanException.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Scanner.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Utils.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/WebdavFileSet.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/antlib.xml
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/doc-files/
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/doc-files/tasks.htm
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/mimetypes.properties
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/package.html
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs.properties
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Delete.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Get.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Lock.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Mkcol.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Move.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Proppatch.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Put.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Unlock.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavMatchingTask.java
   branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavTask.java
   branches/slide-webdavclient/upstream/2.1/build.xml
   branches/slide-webdavclient/upstream/2.1/clientlib/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Ace.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/BaseProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Constants.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Lock.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/NotificationListener.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Privilege.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Property.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/PropertyName.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/ResponseEntity.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Subscriber.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Subscription.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavException.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavFile.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavResources.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavSession.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavState.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/AclMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/AclReportMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/BindMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CheckinMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CheckoutMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CopyMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/DeleteMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/DepthSupport.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/HttpRequestBodyMethodBase.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/LabelMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/LockMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MkWorkspaceMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MkcolMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MoveMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/OptionsMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PollMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropFindMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropPatchMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropertyBodyHelper.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/RebindMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/ReportMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/SearchMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/SubscribeMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnbindMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UncheckoutMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnlockMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnsubscribeMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UpdateMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/VersionControlMethod.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/XMLResponseMethodBase.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/AclProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CheckedinProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CheckedoutProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CreationDateProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CurrentUserPrivilegeSetProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/DateProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/GetContentLengthProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/GetLastModifiedProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/HrefValuedProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/LockDiscoveryProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/LockEntryProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/ModificationDateProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/OwnerProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/PrincipalCollectionSetProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/PropertyFactory.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/ResourceTypeProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/SupportedLockProperty.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/DOMUtils.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/DOMWriter.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/MIME2Java.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/PropertyWriter.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/QName.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/WebdavStatus.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/XMLDebugOutputer.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/XMLPrinter.java
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/ui/
   branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/ui/WebdavSystemView.java
   branches/slide-webdavclient/upstream/2.1/commandline/
   branches/slide-webdavclient/upstream/2.1/commandline/src/
   branches/slide-webdavclient/upstream/2.1/commandline/src/bin/
   branches/slide-webdavclient/upstream/2.1/commandline/src/bin/lcp.bat
   branches/slide-webdavclient/upstream/2.1/commandline/src/bin/run.bat
   branches/slide-webdavclient/upstream/2.1/commandline/src/bin/run.sh
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Client.g
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Client.java
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/ClientLexer.java
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/ClientParser.java
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Slide.java
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/SlideTokenTypes.java
   branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Spool.java
   branches/slide-webdavclient/upstream/2.1/connector/
   branches/slide-webdavclient/upstream/2.1/connector/example/
   branches/slide-webdavclient/upstream/2.1/connector/example/src/
   branches/slide-webdavclient/upstream/2.1/connector/example/src/conf/
   branches/slide-webdavclient/upstream/2.1/connector/example/src/conf/jboss-web.xml
   branches/slide-webdavclient/upstream/2.1/connector/example/src/conf/web.xml
   branches/slide-webdavclient/upstream/2.1/connector/example/src/java/
   branches/slide-webdavclient/upstream/2.1/connector/example/src/java/connector/
   branches/slide-webdavclient/upstream/2.1/connector/example/src/java/connector/TestServlet.java
   branches/slide-webdavclient/upstream/2.1/connector/src/
   branches/slide-webdavclient/upstream/2.1/connector/src/java/
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnection.java
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnectionFactory.java
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnectionSpec.java
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVLocalTransaction.java
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnection.java
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnectionFactory.java
   branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVXAResource.java
   branches/slide-webdavclient/upstream/2.1/etc/
   branches/slide-webdavclient/upstream/2.1/etc/MANIFEST.MF
   branches/slide-webdavclient/upstream/2.1/etc/conf/
   branches/slide-webdavclient/upstream/2.1/etc/conf/connector/
   branches/slide-webdavclient/upstream/2.1/etc/conf/connector/jboss/
   branches/slide-webdavclient/upstream/2.1/etc/conf/connector/jboss/webdav-connector-ds.xml
   branches/slide-webdavclient/upstream/2.1/etc/conf/connector/ra.xml
Log:
Imported upstream sources.


Added: branches/slide-webdavclient/upstream/2.1/LICENSE
===================================================================
--- branches/slide-webdavclient/upstream/2.1/LICENSE	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/LICENSE	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

Added: branches/slide-webdavclient/upstream/2.1/NOTICE
===================================================================
--- branches/slide-webdavclient/upstream/2.1/NOTICE	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/NOTICE	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,3 @@
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file

Added: branches/slide-webdavclient/upstream/2.1/README
===================================================================
--- branches/slide-webdavclient/upstream/2.1/README	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/README	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,27 @@
+Slide 2.0 WebDAV client
+==========================
+
+This module of Slide contains a WebDAV client implementation and a
+command line client that can be used to access a WebDAV server.
+The command line client is also a example for the usage of the
+client library.
+
+Building client library
+---------------------------
+
+This module is distributed with a Ant build script. Following
+targets can be used:
+
+- build-clientlib: Compile
+- dist-clientlib: Build jar lib with WebDav client and copy required jars to build/lib
+- javadoc-clientlib: Create API documentation
+- build-cmd: Build commandline client
+- dist-cmd: Distribute commandline client with required jars
+- all: dist and javadoc are executed
+
+Using client library
+------------------------
+
+The class org.apache.webdav.lib.WebdavResource is the main interface
+to the client. Usage examples can be found in the implementation of 
+the command line client.
\ No newline at end of file

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/CollectionScanner.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/CollectionScanner.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/CollectionScanner.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,217 @@
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/CollectionScanner.java,v 1.3.2.2 2004/08/22 10:36:47 luetzkendorf Exp $
+ * $Revision: 1.3.2.2 $
+ * $Date: 2004/08/22 10:36:47 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.URIException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.methods.DepthSupport;
+import org.apache.webdav.lib.methods.PropFindMethod;
+import org.apache.webdav.lib.properties.ResourceTypeProperty;
+
+/**
+ * Scan a collection of WebDAV resources to find ones that match a 
+ * specified pattern.
+ *
+ */
+public class CollectionScanner extends Scanner {
+
+    private HttpURL baseURL = null;
+    private HttpClient client = null;
+    private ResourceProperties properties = null;
+
+    private Vector propertyNames = new Vector();
+
+    public CollectionScanner() {
+       propertyNames.add(Utils.RESOURCETYPE);
+       propertyNames.add(Utils.GETLASTMODIFIED);
+    }
+
+    /**
+     * Scans the base URL for resources that match at least one include
+     * pattern, and don't match any exclude patterns.
+     * 
+     * For each resource the properties are stored and may be used after
+     * scanning - may be for further selecting. (see {@link #getProperties()}
+     * and {@link #addProperty(PropertyName)}).
+     *
+     * @exception IllegalStateException when baseurl was set incorrecly
+     * @exception ScanException when a WebDAV or other error occurs
+     */
+    public void scan() {
+
+        if (baseURL == null) {
+           throw new IllegalStateException(
+                 "BaseURL must be set before calling the scan() method");
+        }
+
+        // initialize member variables
+        filesIncluded = new ArrayList();
+        filesExcluded = new ArrayList();
+        filesNotIncluded = new ArrayList();
+        dirsIncluded = new ArrayList();
+        dirsExcluded = new ArrayList();
+        dirsNotIncluded = new ArrayList();
+        this.properties = new ResourceProperties();
+        
+        try {
+           readCollection(baseURL);
+        } 
+//        catch (IOException e) {
+//            throw new ScanException(e.getMessage(), e);
+//        }
+        catch (Exception e) {
+           e.printStackTrace();
+        }
+    }
+
+   protected void readCollection(HttpURL collURL) 
+         throws URIException
+   {
+      if (!collURL.getPath().endsWith(SEPARATOR)) {
+         collURL = Utils.createHttpURL(collURL, "");
+         collURL.setPath(collURL.getPath() + SEPARATOR);
+      }
+      
+      // get a list of all resources from the given URL
+      PropFindMethod propFind = new PropFindMethod(collURL.getURI(),
+                                                   DepthSupport.DEPTH_1,
+                                                   PropFindMethod.BY_NAME);
+      propFind.setPropertyNames(propertyNames.elements());
+      propFind.setFollowRedirects(true);
+      try {
+         this.client.executeMethod(propFind);
+      } 
+      catch (IOException e) {
+         Utils.makeBuildException("Can't read collection content!", e);
+      }
+      
+      List subCollections = new ArrayList();
+      this.properties.storeProperties(propFind);
+      
+      // this collection
+      addResource(collURL.getPath(), true);
+      
+      // for each content element, check resource type and classify
+      for (Enumeration e = propFind.getAllResponseURLs(); e.hasMoreElements(); ) 
+      {
+         String href = (String) e.nextElement();
+         
+         ResourceTypeProperty property = 
+                                this.properties.getResourceType(collURL, href);
+         
+         if (property != null) {
+            if (property.isCollection()) {
+               if (!href.endsWith(SEPARATOR)) href = href + SEPARATOR;
+               // the collection URL itself may be in the list of 
+               // response URL; filter them out to avoid recursion 
+               HttpURL sub = Utils.createHttpURL(collURL, href);
+               if (!sub.equals(collURL)) {
+                  subCollections.add(Utils.createHttpURL(collURL, href));
+               }
+            } else {
+               addResource(href, false);
+            }
+         } else {
+            throw new BuildException("Can't determine resourcetype.");
+         }
+      }
+      
+      // read all sub collections
+      for(Iterator i = subCollections.iterator(); i.hasNext();) {
+         readCollection((HttpURL)i.next());
+      }
+   }
+
+   protected void addResource(String href, boolean isCollection)
+            throws ScanException 
+   {
+      try {
+         String path = (Utils.createHttpURL(getBaseURL(), href)).getPath();
+         String relPath = path.substring(getBaseURL().getPath().length());
+         if (relPath.startsWith(SEPARATOR)) {
+            relPath = relPath.substring(1);
+         }
+         if (isCollection) {
+            if (isIncluded(relPath)) {
+               if (isExcluded(relPath)) {
+                  dirsExcluded.add(relPath);
+               } else {
+                  dirsIncluded.add(relPath);
+               }
+            } else {
+               dirsNotIncluded.add(relPath);
+            }
+         } else {
+            if (isIncluded(relPath)) {
+               if (isExcluded(relPath)) {
+                  filesExcluded.add(relPath);
+               } else {
+                  filesIncluded.add(relPath);
+               }
+           } else {
+               filesNotIncluded.add(relPath);
+           }
+         }
+       } 
+       catch (URIException e) {
+          throw new ScanException(
+             "The XML response returned an invalid URL: " + e.getMessage(), e);
+       }
+    }
+
+    public HttpURL getBaseURL() {
+        return this.baseURL;
+    }
+
+    public void setBaseURL(HttpURL baseURL) {
+        this.baseURL = baseURL;
+    }
+
+    public void setHttpClient(HttpClient client) {
+        this.client = client;
+    }
+    
+    public ResourceProperties getProperties()
+    {
+       return this.properties;
+    }
+
+    /**
+     * Adds a property which the scanner retrieves while scanning.
+     * 
+     * @param property Name of the property to be retrieved.
+     */
+    public void addProperty(PropertyName property) {
+       if (property == null) throw new NullPointerException();
+       this.propertyNames.add(property);
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Mimetypes.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Mimetypes.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Mimetypes.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,81 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/Mimetypes.java,v 1.3 2004/07/28 09:31:49 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:49 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant;
+
+import java.io.File;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+
+/**
+ * Helper for mapping file extensions to mime-types.
+ *  
+ */
+public class Mimetypes
+{
+   private static Map mimetypes = new HashMap(); 
+   
+   static {
+      ResourceBundle rb = 
+         ResourceBundle.getBundle("org.apache.webdav.ant.mimetypes");
+      
+      for(Enumeration e = rb.getKeys(); e.hasMoreElements(); ) {
+         String ext = (String)e.nextElement();
+         mimetypes.put(ext, rb.getString(ext));
+      }
+   }
+   
+   public static String getMimeTypeForExtension(String extension, String defaultType) {
+      String mime = (String)mimetypes.get(extension);
+      if (mime == null) mime = defaultType;
+      return mime;
+   }
+   
+   public static String getMimeType(File file, String defaultType) {
+      String ext = file.getName();
+      int dotPos = ext.lastIndexOf('.');
+      if (dotPos != -1) {
+         return getMimeTypeForExtension(ext.substring(dotPos + 1), defaultType);
+      } else {
+         return defaultType;
+      }
+   }
+   public static String getMimeType(String file, String defaultType) {
+      int dotPos = file.lastIndexOf('.');
+      if (dotPos != -1) {
+         return getMimeTypeForExtension(file.substring(dotPos + 1), defaultType);
+      } else {
+         return defaultType;
+      }
+   }
+   
+   public static String getExtension(String fileName) {
+      int dotPos = fileName.lastIndexOf('.');
+      if (dotPos != -1) {
+         return fileName.substring(dotPos + 1);
+      } else {
+         return null;
+      }
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/ResourceProperties.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/ResourceProperties.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/ResourceProperties.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,121 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/ResourceProperties.java,v 1.3.2.1 2004/08/15 13:01:15 luetzkendorf Exp $
+ * $Revision: 1.3.2.1 $
+ * $Date: 2004/08/15 13:01:15 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+
+import org.apache.webdav.lib.Property;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.methods.PropFindMethod;
+import org.apache.webdav.lib.properties.GetLastModifiedProperty;
+import org.apache.webdav.lib.properties.ResourceTypeProperty;
+
+/**
+ * Helper for holding properies of WebDAV resources retrieved by PROPFIND
+ * requests.
+ * 
+ */
+public class ResourceProperties {
+   /** Maps resource URLs to lists of properties. */
+   private Map resourceMap = new HashMap();
+   
+   
+   public void storeProperties(PropFindMethod propFind)
+      throws URIException
+   {
+      // for each content element, check resource type and classify
+      for (Enumeration e = propFind.getAllResponseURLs(); e.hasMoreElements(); ) 
+      {
+         String href = (String) e.nextElement();
+         URI uri = new URI(propFind.getURI(), href);
+         
+         String key = uri.toString();
+         List properties = (List)this.resourceMap.get(key);
+         if (properties == null) {
+            properties = new ArrayList();
+            this.resourceMap.put(key, properties);
+         }
+         for(Enumeration f = propFind.getResponseProperties(href); 
+             f.hasMoreElements();) 
+         {
+            properties.add((Property)f.nextElement());
+         }
+      }
+   }
+   
+   public Property getProperty(HttpURL baseUrl, 
+                               String relative, 
+                               PropertyName propertyName)
+      throws URIException
+   {
+      HttpURL url = Utils.createHttpURL(baseUrl, relative);
+      return getProperty(url.getURI(), propertyName);
+   }
+   
+   public Property getProperty(String uri, PropertyName propertyName) 
+   {
+      List properties = (List)this.resourceMap.get(uri);
+      if (properties != null) {
+         for(Iterator i = properties.iterator(); i.hasNext();) {
+            Property p = (Property)i.next();
+            if (p.getLocalName().equals(propertyName.getLocalName()) &&
+                p.getNamespaceURI().equals(propertyName.getNamespaceURI()))
+            {
+               return p;
+            }
+         }
+      }
+      return null;
+   }
+
+   public long getLastModified(String uri) {
+      GetLastModifiedProperty p = 
+            (GetLastModifiedProperty)getProperty(uri, Utils.GETLASTMODIFIED);
+      if (p != null) {
+         return p.getDate().getTime();
+      } else {
+         return 0;
+      }
+   }
+   
+   public ResourceTypeProperty getResourceType(HttpURL baseUrl, String relative)
+      throws URIException
+   {
+      HttpURL url = Utils.createHttpURL(baseUrl, relative);
+      return getResourceType(url.toString());
+   }
+   
+   public ResourceTypeProperty getResourceType(String uri) {
+      ResourceTypeProperty p = 
+            (ResourceTypeProperty)getProperty(uri, Utils.RESOURCETYPE);
+      return p; 
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/ScanException.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/ScanException.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/ScanException.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,56 @@
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/ScanException.java,v 1.3 2004/07/28 09:31:49 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:49 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * Signals an error condition during the scan of a directory or web 
+ * collection.
+ *
+ */
+
+public class ScanException extends BuildException  {
+
+    public ScanException() {
+	super();
+    }
+
+    /**
+     * Constructs an exception with the given descriptive message.
+     * @param msg Description of or information about the exception.
+     */
+
+    public ScanException(String msg) {
+	super(msg);
+    }
+
+    /**
+     * Constructs an exception with the given message and exception as
+     * a root cause.
+     * @param msg Description of or information about the exception.
+     * @param cause Throwable that might have cause this one.
+     */
+
+    public ScanException(String msg, Throwable cause) {
+	super(msg, cause);
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Scanner.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Scanner.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Scanner.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,610 @@
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/Scanner.java,v 1.3 2004/07/28 09:31:49 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:49 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tools.ant.types.selectors.SelectorUtils;
+
+/**
+ * Class for scanning a directory for files/directories that match a certain
+ * criteria.
+ * <p>
+ * These criteria consist of a set of include and exclude patterns. With these
+ * patterns, you can select which files you want to have included, and which
+ * files you want to have excluded.
+ * <p>
+ * The idea is simple. A given directory is recursively scanned for all files
+ * and directories. Each file/directory is matched against a set of include
+ * and exclude patterns. Only files/directories that match at least one
+ * pattern of the include pattern list, and don't match a pattern of the
+ * exclude pattern list will be placed in the list of files/directories found.
+ * <p>
+ * When no list of include patterns is supplied, "**" will be used, which
+ * means that everything will be matched. When no list of exclude patterns is
+ * supplied, an empty list is used, such that nothing will be excluded.
+ * <p>
+ * The pattern matching is done as follows:
+ * The name to be matched is split up in path segments. A path segment is the
+ * name of a directory or file, which is bounded by
+ * <code>File.separator</code> ('/' under UNIX, '\' under Windows).
+ * E.g. "abc/def/ghi/xyz.java" is split up in the segments "abc", "def", "ghi"
+ * and "xyz.java".
+ * The same is done for the pattern against which should be matched.
+ * <p>
+ * Then the segments of the name and the pattern will be matched against each
+ * other. When '**' is used for a path segment in the pattern, then it matches
+ * zero or more path segments of the name.
+ * <p>
+ * There are special case regarding the use of <code>File.separator</code>s at
+ * the beginningof the pattern and the string to match:<br>
+ * When a pattern starts with a <code>File.separator</code>, the string
+ * to match must also start with a <code>File.separator</code>.
+ * When a pattern does not start with a <code>File.separator</code>, the
+ * string to match may not start with a <code>File.separator</code>.
+ * When one of these rules is not obeyed, the string will not
+ * match.
+ * <p>
+ * When a name path segment is matched against a pattern path segment, the
+ * following special characters can be used:
+ * '*' matches zero or more characters,
+ * '?' matches one character.
+ * <p>
+ * Examples:
+ * <p>
+ * "**\*.class" matches all .class files/dirs in a directory tree.
+ * <p>
+ * "test\a??.java" matches all files/dirs which start with an 'a', then two
+ * more characters and then ".java", in a directory called test.
+ * <p>
+ * "**" matches everything in a directory tree.
+ * <p>
+ * "**\test\**\XYZ*" matches all files/dirs that start with "XYZ" and where
+ * there is a parent directory called test (e.g. "abc\test\def\ghi\XYZ123").
+ * <p>
+ * Example of usage:
+ * <pre>
+ *   String[] includes = {"**\\*.class"};
+ *   String[] excludes = {"modules\\*\\**"};
+ *   ds.setIncludes(includes);
+ *   ds.setExcludes(excludes);
+ *   ds.setBasedir(new File("test"));
+ *   ds.scan();
+ *
+ *   System.out.println("FILES:");
+ *   String[] files = ds.getIncludedFiles();
+ *   for (int i = 0; i < files.length;i++) {
+ *     System.out.println(files[i]);
+ *   }
+ * </pre>
+ * This will scan a directory called test for .class files, but excludes all
+ * .class files in all directories under a directory called "modules"
+ *
+ */
+public abstract class Scanner {
+   
+   protected static final String SEPARATOR = "/";
+   protected static final char SEPARATOR_CHAR = '/';
+
+//    /**
+//     * Patterns that should be excluded by default.
+//     *
+//     * @see #addDefaultExcludes()
+//     */
+//    private final static String[] DEFAULTEXCLUDES = {
+//        "**/*~",
+//        "**/#*#",
+//        "**/%*%",
+//        "**/CVS",
+//        "**/CVS/*",
+//        "**/.cvsignore"
+//    };
+
+    /**
+     * The patterns for the files that should be included.
+     */
+    private List includes = new ArrayList();
+
+    /**
+     * The patterns for the files that should be excluded.
+     */
+    private List excludes = new ArrayList();
+
+    /**
+     * The files that where found and matched at least one includes, and matched
+     * no excludes.
+     */
+    protected List filesIncluded;
+
+    /**
+     * The files that where found and did not match any includes.
+     */
+    protected List filesNotIncluded;
+
+    /**
+     * The files that where found and matched at least one includes, and also
+     * matched at least one excludes.
+     */
+    protected List filesExcluded;
+
+    /**
+     * The directories that where found and matched at least one includes, and
+     * matched no excludes.
+     */
+    protected List dirsIncluded;
+
+    /**
+     * The directories that where found and did not match any includes.
+     */
+    protected List dirsNotIncluded;
+
+    /**
+     * The files that where found and matched at least one includes, and also
+     * matched at least one excludes.
+     */
+    protected List dirsExcluded;
+    
+    protected boolean isCaseSensitive = true; 
+
+
+
+    /**
+     * Constructor.
+     */
+    public Scanner() {
+    }
+
+
+
+    /**
+     * Sets the set of include patterns to use. All '/' and '\' characters are
+     * replaced by <code>File.separatorChar</code>. So the separator used need
+     * not match <code>File.separatorChar</code>.
+     * <p>
+     * When a pattern ends with a '/' or '\', "**" is appended.
+     *
+     * @param includes list of include patterns
+     */
+    public void setIncludes(String[] includes) {
+       this.includes = new ArrayList();
+       addIncludes(includes);
+    }
+    public void addIncludes(String[] includes) {
+       if (includes != null) {
+          for(int i = 0; i < includes.length ; i++) {
+             this.includes.add(noramlizePattern(includes[i]));
+          }
+       }
+    }
+
+    /**
+     * Sets the set of exclude patterns to use. All '/' and '\' characters are
+     * replaced by <code>File.separatorChar</code>. So the separator used need
+     * not match <code>File.separatorChar</code>.
+     * <p>
+     * When a pattern ends with a '/' or '\', "**" is appended.
+     *
+     * @param excludes list of exclude patterns (a list of Strings)
+     */
+    public void setExcludes(String[] excludes) {
+       this.excludes = new ArrayList();
+       addExcludes(excludes);
+    }
+    public void addExcludes(String[] excludes) {
+       if (excludes != null) {
+          for (int i = 0; i < excludes.length; i++) {
+             this.excludes.add(noramlizePattern(excludes[i]));
+          }
+       }
+    }
+    
+    private String noramlizePattern(String pattern) {
+//      pattern = pattern.replace('/',getSeparatorChar()).
+//                        replace('\\',getSeparatorChar());
+      if (pattern.endsWith(SEPARATOR)) {
+         pattern += "**";
+      }
+      return pattern;
+    }
+
+
+    public void setCaseSensitive(boolean val) {
+       this.isCaseSensitive = val;
+    }
+
+
+    /**
+     * Scans the base directory for files that match at least one include
+     * pattern, and don't match any exclude patterns.
+     *
+     * @exception IllegalStateException when basedir was set incorrecly
+     */
+    public abstract void scan();
+
+
+
+    /**
+     * Tests whether a name matches against at least one include pattern.
+     *
+     * @param name the name to match
+     * @return <code>true</code> when the name matches against at least one
+     *         include pattern, <code>false</code> otherwise.
+     */
+    protected boolean isIncluded(String name) {
+        for (Iterator i = this.includes.iterator(); i.hasNext();) {
+            if (matchPath((String)i.next(), name, this.isCaseSensitive)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+
+    /**
+     * Tests whether a name matches against at least one exclude pattern.
+     *
+     * @param name the name to match
+     * @return <code>true</code> when the name matches against at least one
+     *         exclude pattern, <code>false</code> otherwise.
+     */
+    protected boolean isExcluded(String name) {
+        for (Iterator i = this.excludes.iterator(); i.hasNext();) {
+           if (matchPath((String)i.next(), name, this.isCaseSensitive)) {
+              return true;
+           }
+        }
+        return false;
+    }
+
+
+
+    /**
+     * Get the names of the files that matched at least one of the include
+     * patterns, an matched none of the exclude patterns.
+     * The names are relative to the basedir.
+     *
+     * @return the names of the files
+     */
+    public String[] getIncludedFiles() {
+        int count = filesIncluded.size();
+        String[] files = new String[count];
+        for (int i = 0; i < count; i++) {
+            files[i] = (String)filesIncluded.get(i);
+        }
+        return files;
+    }
+
+
+
+    /**
+     * Get the names of the files that matched at none of the include patterns.
+     * The names are relative to the basedir.
+     *
+     * @return the names of the files
+     */
+    public String[] getNotIncludedFiles() {
+        int count = filesNotIncluded.size();
+        String[] files = new String[count];
+        for (int i = 0; i < count; i++) {
+            files[i] = (String)filesNotIncluded.get(i);
+        }
+        return files;
+    }
+
+
+
+    /**
+     * Get the names of the files that matched at least one of the include
+     * patterns, an matched also at least one of the exclude patterns.
+     * The names are relative to the basedir.
+     *
+     * @return the names of the files
+     */
+    public String[] getExcludedFiles() {
+        int count = filesExcluded.size();
+        String[] files = new String[count];
+        for (int i = 0; i < count; i++) {
+            files[i] = (String)filesExcluded.get(i);
+        }
+        return files;
+    }
+
+
+
+    /**
+     * Get the names of the directories that matched at least one of the include
+     * patterns, an matched none of the exclude patterns.
+     * The names are relative to the basedir.
+     *
+     * @return the names of the directories
+     */
+    public String[] getIncludedDirectories() {
+        int count = dirsIncluded.size();
+        String[] directories = new String[count];
+        for (int i = 0; i < count; i++) {
+            directories[i] = (String)dirsIncluded.get(i);
+        }
+        return directories;
+    }
+
+
+
+    /**
+     * Get the names of the directories that matched at none of the include
+     * patterns.
+     * The names are relative to the basedir.
+     *
+     * @return the names of the directories
+     */
+    public String[] getNotIncludedDirectories() {
+        int count = dirsNotIncluded.size();
+        String[] directories = new String[count];
+        for (int i = 0; i < count; i++) {
+            directories[i] = (String)dirsNotIncluded.get(i);
+        }
+        return directories;
+    }
+
+
+
+    /**
+     * Get the names of the directories that matched at least one of the include
+     * patterns, an matched also at least one of the exclude patterns.
+     * The names are relative to the basedir.
+     *
+     * @return the names of the directories
+     */
+    public String[] getExcludedDirectories() {
+        int count = dirsExcluded.size();
+        String[] directories = new String[count];
+        for (int i = 0; i < count; i++) {
+            directories[i] = (String)dirsExcluded.get(i);
+        }
+        return directories;
+    }
+
+
+
+//    /**
+//     * Adds the array with default exclusions to the current exclusions set.
+//     *
+//     */
+//    public void addDefaultExcludes() {
+//       if (this.excludes == null) {
+//          this.excludes = new ArrayList();
+//       }
+//        excludes.addAll(Arrays.asList(DEFAULTEXCLUDES));
+//    }
+
+//    protected abstract String getSeparator();
+//
+//    protected char getSeparatorChar() {
+//        return ((getSeparator().length() > 0) ? getSeparator().charAt(0) : '/');
+//    }
+
+
+    /**
+     * Tests whether or not a string matches against a pattern.
+     * The pattern may contain two special characters:<br>
+     * '*' means zero or more characters<br>
+     * '?' means one and only one character
+     *
+     * @param pattern The pattern to match against.
+     *                Must not be <code>null</code>.
+     * @param str     The string which must be matched against the pattern.
+     *                Must not be <code>null</code>.
+     * @param isCaseSensitive Whether or not matching should be performed
+     *                        case sensitively.
+     * @see SelectorUtils#match(java.lang.String, java.lang.String, boolean)
+     *
+     * @return <code>true</code> if the string matches against the pattern,
+     *         or <code>false</code> otherwise.
+     */
+    public static boolean match(String pattern, String str,
+                                boolean isCaseSensitive) 
+    {
+       return SelectorUtils.match(pattern, str, isCaseSensitive);
+    }
+
+   /**
+     * Tests whether or not a given path matches a given pattern.
+     *
+     * @param pattern The pattern to match against. Must not be
+     *                <code>null</code>.
+     * @param str     The path to match, as a String. Must not be
+     *                <code>null</code>.
+     * @param isCaseSensitive Whether or not matching should be performed
+     *                        case sensitively.
+     *
+     * @return <code>true</code> if the pattern matches against the string,
+     *         or <code>false</code> otherwise.
+     * @see SelectorUtils#matchPath(java.lang.String, java.lang.String, boolean)
+     *      (but this uses always File.Selector)
+     */
+    public static boolean matchPath(String pattern, String str,
+                                    boolean isCaseSensitive)
+    {
+        // When str starts with a File.separator, pattern has to start with a
+        // File.separator.
+        // When pattern starts with a File.separator, str has to start with a
+        // File.separator.
+        if (str.startsWith(SEPARATOR) != pattern.startsWith(SEPARATOR)) {
+            return false;
+        }
+   
+        String[] patDirs = tokenizePathAsArray(pattern);
+        String[] strDirs = tokenizePathAsArray(str);
+   
+        int patIdxStart = 0;
+        int patIdxEnd = patDirs.length - 1;
+        int strIdxStart = 0;
+        int strIdxEnd = strDirs.length - 1;
+   
+        // up to first '**'
+        while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
+            String patDir = patDirs[patIdxStart];
+            if (patDir.equals("**")) {
+                break;
+            }
+            if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {
+                patDirs = null;
+                strDirs = null;
+                return false;
+            }
+            patIdxStart++;
+            strIdxStart++;
+        }
+        if (strIdxStart > strIdxEnd) {
+            // String is exhausted
+            for (int i = patIdxStart; i <= patIdxEnd; i++) {
+                if (!patDirs[i].equals("**")) {
+                    patDirs = null;
+                    strDirs = null;
+                    return false;
+                }
+            }
+            return true;
+        } else {
+            if (patIdxStart > patIdxEnd) {
+                // String not exhausted, but pattern is. Failure.
+                patDirs = null;
+                strDirs = null;
+                return false;
+            }
+        }
+   
+        // up to last '**'
+        while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
+            String patDir = patDirs[patIdxEnd];
+            if (patDir.equals("**")) {
+                break;
+            }
+            if (!match(patDir, strDirs[strIdxEnd], isCaseSensitive)) {
+                patDirs = null;
+                strDirs = null;
+                return false;
+            }
+            patIdxEnd--;
+            strIdxEnd--;
+        }
+        if (strIdxStart > strIdxEnd) {
+            // String is exhausted
+            for (int i = patIdxStart; i <= patIdxEnd; i++) {
+                if (!patDirs[i].equals("**")) {
+                    patDirs = null;
+                    strDirs = null;
+                    return false;
+                }
+            }
+            return true;
+        }
+   
+        while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) {
+            int patIdxTmp = -1;
+            for (int i = patIdxStart + 1; i <= patIdxEnd; i++) {
+                if (patDirs[i].equals("**")) {
+                    patIdxTmp = i;
+                    break;
+                }
+            }
+            if (patIdxTmp == patIdxStart + 1) {
+                // '**/**' situation, so skip one
+                patIdxStart++;
+                continue;
+            }
+            // Find the pattern between padIdxStart & padIdxTmp in str between
+            // strIdxStart & strIdxEnd
+            int patLength = (patIdxTmp - patIdxStart - 1);
+            int strLength = (strIdxEnd - strIdxStart + 1);
+            int foundIdx = -1;
+            strLoop:
+                        for (int i = 0; i <= strLength - patLength; i++) {
+                            for (int j = 0; j < patLength; j++) {
+                                String subPat = patDirs[patIdxStart + j + 1];
+                                String subStr = strDirs[strIdxStart + i + j];
+                                if (!match(subPat, subStr, isCaseSensitive)) {
+                                    continue strLoop;
+                                }
+                            }
+   
+                            foundIdx = strIdxStart + i;
+                            break;
+                        }
+   
+            if (foundIdx == -1) {
+                patDirs = null;
+                strDirs = null;
+                return false;
+            }
+   
+            patIdxStart = patIdxTmp;
+            strIdxStart = foundIdx + patLength;
+        }
+   
+        for (int i = patIdxStart; i <= patIdxEnd; i++) {
+            if (!patDirs[i].equals("**")) {
+                patDirs = null;
+                strDirs = null;
+                return false;
+            }
+        }
+   
+        return true;
+    }
+    
+    private static String[] tokenizePathAsArray(String path) {
+       char sep = SEPARATOR_CHAR;
+       int start = 0;
+       int len = path.length();
+       int count = 0;
+       for (int pos = 0; pos < len; pos++) {
+           if (path.charAt(pos) == sep) {
+               if (pos != start) {
+                   count++;
+               }
+               start = pos + 1;
+           }
+       }
+       if (len != start) {
+           count++;
+       }
+       String[] l = new String[count];
+       count = 0;
+       start = 0;
+       for (int pos = 0; pos < len; pos++) {
+           if (path.charAt(pos) == sep) {
+               if (pos != start) {
+                   String tok = path.substring(start, pos);
+                   l[count++] = tok;
+               }
+               start = pos + 1;
+           }
+       }
+       if (len != start) {
+           String tok = path.substring(start);
+           l[count/*++*/] = tok;
+       }
+       return l;
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Utils.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Utils.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/Utils.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,475 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/Utils.java,v 1.7.2.2 2004/08/22 10:36:47 luetzkendorf Exp $
+ * $Revision: 1.7.2.2 $
+ * $Date: 2004/08/22 10:36:47 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Stack;
+import java.util.Vector;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.HttpsURL;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.HeadMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.webdav.lib.Property;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.WebdavException;
+import org.apache.webdav.lib.methods.CopyMethod;
+import org.apache.webdav.lib.methods.LockMethod;
+import org.apache.webdav.lib.methods.MkcolMethod;
+import org.apache.webdav.lib.methods.MoveMethod;
+import org.apache.webdav.lib.methods.PropFindMethod;
+import org.apache.webdav.lib.methods.UnlockMethod;
+import org.apache.webdav.lib.properties.ResourceTypeProperty;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+/**
+ */
+public class Utils {
+   public static final String DAV_NAMESPACE= "DAV:";
+   
+   public static final PropertyName DISPLAYNAME = new PropertyName(
+         DAV_NAMESPACE, "displayname"); 
+
+   public static final PropertyName GETLASTMODIFIED = new PropertyName(
+         DAV_NAMESPACE, "getlastmodified"); 
+   
+   public static final DateFormat GETLASTMODIFIED_FORMAT = 
+            new SimpleDateFormat("EEE, d MMM yyyy kk:mm:ss z", Locale.US);
+
+   public static final PropertyName RESOURCETYPE = new PropertyName(
+         DAV_NAMESPACE, "resourcetype"); 
+
+   /**
+    * Lookup for given property in a propfind response.
+    * @param propFind the method, must always be rxecuted
+    * @param name
+    * @param path path of the item for which the property is searched for
+    * @return the property of <code>null</code> if not found
+    */
+   public static Property findProperty(PropFindMethod propFind, 
+                                        PropertyName name,
+                                        String path) 
+   {
+      Enumeration e = propFind.getResponseProperties(path);
+      Property p = findProperty(e, name);
+      // a collection requested as /a/col/path/ may be as 
+      // /a/col/path in the response
+      if (p == null && path.endsWith("/")) {
+         e = propFind.getResponseProperties(path.substring(0, path.length()-1));
+         p = findProperty(e, name);
+      }
+      return p;
+   }
+   
+   /**
+    * Searches in the enumeration of Propery objects for a property with the 
+    * given name. 
+    * @param e enumeration of Property objects.
+    * @param name
+    * @return the property searched for of <code>null</code> if not found.
+    */
+   public static Property findProperty(Enumeration e, PropertyName name) {
+      while (e.hasMoreElements()) {
+         Property p = (Property)e.nextElement();
+         
+         if (p.getNamespaceURI().equals(name.getNamespaceURI()) &&
+             p.getLocalName().equals(name.getLocalName())) 
+         {
+            return p;
+         }
+      }
+      return null;
+   }
+   
+   /**
+    * Returns <code>true</code> if the resource given as URL does exist.
+    * @param client
+    * @param httpURL
+    * @return <code>true</code>if the resource exists
+    * @throws IOException
+    * @throws HttpException
+    */
+   public static boolean resourceExists(HttpClient client, HttpURL httpURL)
+      throws IOException, HttpException
+   {
+      HeadMethod head = new HeadMethod(httpURL.getURI());
+      head.setFollowRedirects(true);
+      int status = client.executeMethod(head);
+      
+      switch (status) {
+         case WebdavStatus.SC_OK:
+            return true;
+         case WebdavStatus.SC_NOT_FOUND:
+            return false;
+         default:
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            ex.setReason(head.getStatusText());
+            throw ex;
+      }
+   }
+   
+   public static boolean collectionExists(HttpClient client, HttpURL httpURL)
+      throws IOException, HttpException
+   {
+      Vector props = new Vector(1);
+      props.add(RESOURCETYPE);
+      PropFindMethod propFind = new PropFindMethod(httpURL.getURI(), 
+                                                    0, PropFindMethod.BY_NAME);
+      propFind.setFollowRedirects(true);
+      propFind.setPropertyNames(props.elements());
+      int status = client.executeMethod(propFind);
+      switch (status) {
+         case WebdavStatus.SC_MULTI_STATUS:
+            Property p = findProperty(propFind, RESOURCETYPE, httpURL.getPath());
+            if (p instanceof ResourceTypeProperty) {
+               return ((ResourceTypeProperty)p).isCollection();
+            } else {
+               throw new WebdavException("PROPFFIND does not return resourcetype");
+            }
+         case WebdavStatus.SC_NOT_FOUND:
+            return false;
+         default:
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            ex.setReason(propFind.getStatusText());
+            throw ex;
+      }
+   }
+      
+   public static long getLastModified(HttpClient client, HttpURL url)
+      throws IOException, HttpException
+   {
+      Vector props = new Vector(1);
+      props.add(GETLASTMODIFIED);
+      PropFindMethod propFind = new PropFindMethod(url.getURI(), 0);
+      propFind.setPropertyNames(props.elements());
+      propFind.setFollowRedirects(true);
+      
+      int status = client.executeMethod(propFind);
+      switch (status) {
+         case WebdavStatus.SC_MULTI_STATUS:
+            Property p = findProperty(propFind, GETLASTMODIFIED, url.getPath());
+            if (p != null) {
+               try {
+                  Date d = GETLASTMODIFIED_FORMAT.parse(p.getPropertyAsString());
+                  return d.getTime();
+               } 
+               catch (ParseException e) {
+                  throw new HttpException("Invalid lastmodified property: " +
+                        p.getPropertyAsString());
+               }
+            } 
+            throw new HttpException("PROPFIND does not return lastmodified.");
+         default:
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            ex.setReason(propFind.getStatusText());
+            throw ex;
+      }
+   }
+   
+   /**
+    * 
+    * @param client
+    * @param httpURL
+    * @param lockToken the locktoken to be used or <code>null</code> if 
+    *         none is to be used
+    * @throws IOException
+    * @throws HttpException
+    */
+   public static boolean assureExistingCollection(HttpClient client, 
+                                                  HttpURL httpURL,
+                                                  String lockToken)
+      throws IOException, HttpException
+   {
+      String path = httpURL.getPath();
+      if (!path.endsWith("/")) {
+         path = path + "/";
+      }
+      Stack toBeCreated = new Stack();
+      
+      while (!path.equals("/")) {
+         HttpURL parent = Utils.createHttpURL(httpURL, path);
+         if (!collectionExists(client, parent)) {
+            toBeCreated.push(path);
+            path = path.substring(0, path.lastIndexOf("/", path.length()-2)+1);
+         } else {
+            break;
+         }
+      }
+
+      boolean created = !toBeCreated.empty(); 
+      while(!toBeCreated.empty()) {
+         HttpURL newColl = Utils.createHttpURL(httpURL, (String)toBeCreated.pop());
+         MkcolMethod mkcol = new MkcolMethod(newColl.getURI());
+         mkcol.setFollowRedirects(true);
+         generateIfHeader(mkcol, lockToken);
+         int status = client.executeMethod(mkcol);
+         if (status != WebdavStatus.SC_CREATED) {
+            HttpException ex = new HttpException("Can't create collection " + 
+                                                 newColl);
+            ex.setReasonCode(status);
+            ex.setReason(mkcol.getStatusText());
+            throw ex;
+         }
+      }
+      return created;
+   }
+   
+   public static void putFile(HttpClient client, 
+                              HttpURL url, 
+                              InputStream is,
+                              String contentType,
+                              String lockToken)
+      throws IOException, HttpException
+   {
+      PutMethod put = new PutMethod(url.getURI());
+      generateIfHeader(put, lockToken);
+      put.setRequestHeader("Content-Type", contentType);
+      put.setRequestBody(is);
+      put.setFollowRedirects(true);
+      int status = client.executeMethod(put);
+      switch (status) {
+         case WebdavStatus.SC_OK:
+         case WebdavStatus.SC_CREATED:
+         case WebdavStatus.SC_NO_CONTENT:
+            return;
+         default:
+            HttpException ex = new HttpException();
+            ex.setReason(put.getStatusText());
+            ex.setReasonCode(status);
+            throw ex;
+      }
+   }
+   
+   public static InputStream getFile(HttpClient client, HttpURL url)
+      throws IOException, HttpException
+   {
+      GetMethod get = new GetMethod(url.toString());
+      get.setFollowRedirects(true);
+      int status = client.executeMethod(get);
+      
+      switch (status) {
+         case WebdavStatus.SC_OK:
+            return get.getResponseBodyAsStream();
+         default:
+            HttpException ex = new HttpException();
+            ex.setReason(get.getStatusText());
+            ex.setReasonCode(status);
+            throw ex;
+      }
+      
+   }
+   
+   public static void generateIfHeader(HttpMethod method, String lockToken) {
+      if (lockToken != null) {
+         Header ifHeader = new Header();
+         ifHeader.setName("If");
+         ifHeader.setValue("(<" + lockToken + ">)");
+         method.addRequestHeader(ifHeader);
+      }
+   }
+
+   public static String lockResource(HttpClient client, HttpURL url, 
+                                     String ownerInfo, int depth, int timeout)
+      throws IOException, HttpException
+   {
+      LockMethod lock = new LockMethod(url.getURI());
+      lock.setDepth(depth);
+      lock.setTimeout(timeout);
+      lock.setOwner(ownerInfo);
+      //lock.setDebug(1);
+      lock.setFollowRedirects(true);
+      int status = client.executeMethod(lock);
+      if (status == WebdavStatus.SC_OK) {
+         Header header = lock.getResponseHeader("Lock-Token");
+         if (header != null) {
+            String l = header.getValue();
+            return l.substring(1, l.length()-1);
+         } else {
+            String l = lock.getLockToken();
+            if (l != null) {
+               return l;
+            }
+            throw new WebdavException("LOCK does not provide a lock token.");
+         }
+      } else if (status == WebdavStatus.SC_MULTI_STATUS) {
+         throw Utils.makeBuildException("Can't lock", lock.getResponses());
+      } else {
+         throw Utils.makeBuildException("Can't lock", status, lock.getStatusText());
+      }
+   }
+   
+   public static void unlockResource(HttpClient client, HttpURL url, 
+                                     String lockToken)
+      throws IOException, HttpException
+   {
+      UnlockMethod unlock = new UnlockMethod(url.getURI(), lockToken);
+      unlock.setFollowRedirects(true);
+      int status = client.executeMethod(unlock);
+      
+      switch (status) {
+         case WebdavStatus.SC_OK:
+         case WebdavStatus.SC_NO_CONTENT:
+            return;
+         
+         default:
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            ex.setReason(unlock.getStatusText());
+            throw ex;
+      }
+   }
+
+   public static void copyResource(HttpClient client, HttpURL url, 
+                                   String destination, int depth, boolean overwrite)
+      throws IOException, HttpException 
+   {
+      CopyMethod copy = new CopyMethod(
+              url.getURI(), 
+              destination, 
+              overwrite, 
+              depth);
+      copy.setFollowRedirects(true);
+      int status = client.executeMethod(copy);
+      switch (status) {
+         case WebdavStatus.SC_OK:
+         case WebdavStatus.SC_CREATED:
+         case WebdavStatus.SC_NO_CONTENT:
+             return;
+         
+         default:
+             HttpException ex = new HttpException();
+             ex.setReasonCode(status);
+             ex.setReason(copy.getStatusText());
+             throw ex;
+      }
+   }
+
+   public static void moveResource(HttpClient client, HttpURL url, 
+                                   String destination, boolean overwrite)
+      throws IOException, HttpException 
+   {
+      MoveMethod move = new MoveMethod(url.getURI(), destination, overwrite);
+      move.setFollowRedirects(true);
+      int status = client.executeMethod(move);
+      switch (status) {
+         case WebdavStatus.SC_OK:
+         case WebdavStatus.SC_CREATED:
+         case WebdavStatus.SC_NO_CONTENT:
+             return;
+
+         default:
+             HttpException ex = new HttpException();
+             ex.setReasonCode(status);
+             ex.setReason(move.getStatusText());
+             throw ex;
+   }
+}
+
+   public static BuildException makeBuildException(String msg, Exception e) {
+      if (e instanceof HttpException) {
+         HttpException he = (HttpException)e; 
+         return new BuildException(
+               msg + " " + e.getMessage() + " (" + 
+               (he.getReason() != null 
+                     ? he.getReason() 
+                     : HttpStatus.getStatusText(he.getReasonCode())) + 
+               ")");
+         
+      } else {
+         return new BuildException(msg + " (" + e.toString() + ")", e);
+      }
+   }
+
+   public static BuildException makeBuildException(String msg, int status) {
+      return new BuildException(msg + " (" + 
+                                HttpStatus.getStatusText(status) +
+                                ")");
+   }
+   public static BuildException makeBuildException(String msg, 
+         int status, String statusText) 
+   {
+      return new BuildException(msg + " (" + 
+                                status + ", " + statusText + ")");
+   }
+   
+   public static BuildException makeBuildException(
+         String msg,
+         Enumeration enumOfResponseEntities)
+   {
+      StringBuffer b = new StringBuffer();
+      
+      b.append(msg).append("\n");
+      
+      for(;enumOfResponseEntities.hasMoreElements();) {
+         ResponseEntity e = (ResponseEntity)enumOfResponseEntities.nextElement();
+         
+         b.append(e.getHref())
+          .append(" ")
+          .append(HttpStatus.getStatusText(e.getStatusCode()))
+          .append("\n");
+      }
+      
+      return new BuildException(b.toString());
+   }
+   
+   
+   public static HttpURL createHttpURL(HttpURL base, String relative) 
+       throws URIException
+   {
+     if (base instanceof HttpsURL) {
+        return new HttpsURL((HttpsURL)base, relative);
+     } else {
+        return new HttpURL(base, relative);
+     }
+   }
+    
+   public static HttpURL createHttpURL(String url) throws URIException
+   {
+      if (url.startsWith("https://")) {
+         return new HttpsURL(url);
+      } else {
+         return new HttpURL(url);
+      }
+   }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/WebdavFileSet.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/WebdavFileSet.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/WebdavFileSet.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,149 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/WebdavFileSet.java,v 1.3.2.1 2004/08/15 13:01:15 luetzkendorf Exp $
+ * $Revision: 1.3.2.1 $
+ * $Date: 2004/08/15 13:01:15 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.URIException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.PatternSet;
+
+/**
+ */
+public class WebdavFileSet {
+   private PatternSet patterns = new PatternSet();
+   private List patternSets = new ArrayList();
+   
+   private String directory = null;
+   private boolean isCaseSensitive = true;
+   
+   private static final String[] DEFAULT_INCLUDES = {
+         "**/*"
+   };
+   
+   public WebdavFileSet() {
+   }
+   
+   public CollectionScanner getCollectionScanner(
+         Project project,
+         HttpClient httpClient,
+         HttpURL baseUrl)
+   {
+      validate();
+      
+      CollectionScanner scanner = new CollectionScanner();
+      
+      try {
+         scanner.setBaseURL(Utils.createHttpURL(baseUrl, directory));
+      } catch (URIException e) {
+         throw new BuildException("Invalid URL. " + e.toString(), e);
+      }
+      scanner.setHttpClient(httpClient);
+      
+      scanner.setCaseSensitive(this.isCaseSensitive);
+      
+      if (this.patterns.getExcludePatterns(project) == null &&
+          this.patterns.getIncludePatterns(project) == null &&
+          this.patternSets.size() == 0) {
+         scanner.setIncludes(DEFAULT_INCLUDES);
+      } else {
+         scanner.setExcludes(this.patterns.getExcludePatterns(project));
+         scanner.setIncludes(this.patterns.getIncludePatterns(project));         
+         for (Iterator i = this.patternSets.iterator(); i.hasNext();) {
+            PatternSet patternSet = (PatternSet)i.next();
+            scanner.addExcludes(patternSet.getExcludePatterns(project));
+            scanner.addIncludes(patternSet.getIncludePatterns(project));
+         }
+      }
+      scanner.scan();
+      return scanner;
+   }
+   
+   protected void validate() {
+      if (this.directory == null) this.directory = "";
+   }
+   
+   /**
+    * Sets the <code>dir</code> attribute.
+    * @param dir
+    */
+   public void setDir(String dir) {
+      this.directory = dir;
+      if (!this.directory.endsWith("/")) {
+         this.directory += "/";
+      }
+      if (this.directory.startsWith("/")) {
+         this.directory = this.directory.substring(1);
+      }
+   }
+
+   /**
+    * Sets the <code>casesensitive</code> attribute.
+    * @param b
+    */
+   public void setCasesensitive(boolean b) {
+      this.isCaseSensitive = b;
+   }
+   
+   /**
+    * Creates nested include and adds it to the patterns.
+    */
+   public PatternSet.NameEntry createInclude() {
+       return this.patterns.createInclude();
+   }
+
+   /**
+    * Creates nested includesfile and adds it to the patterns.
+    */
+   public PatternSet.NameEntry createIncludesFile() {
+       return this.patterns.createIncludesFile();
+   }
+
+   /**
+    * Creates nested exclude and adds it to the patterns.
+    */
+   public PatternSet.NameEntry createExclude() {
+       return this.patterns.createExclude();
+   }
+
+   /**
+    * Creates nested excludesfile and adds it to the patterns.
+    */
+   public PatternSet.NameEntry createExcludesFile() {
+       return this.patterns.createExcludesFile();
+   }
+   
+   /**
+    * Creates a nested patternset.
+    */
+   public PatternSet createPatternSet() {
+       PatternSet patterns = new PatternSet();
+       this.patternSets.add(patterns);
+       return patterns;
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/antlib.xml
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/antlib.xml	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/antlib.xml	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<antlib>
+  <taskdef name="put" classname="org.apache.webdav.ant.taskdefs.Put"/>
+  <taskdef name="get" classname="org.apache.webdav.ant.taskdefs.Get"/>
+  <taskdef name="lock" classname="org.apache.webdav.ant.taskdefs.Lock"/>
+  <taskdef name="unlock" classname="org.apache.webdav.ant.taskdefs.Unlock"/>
+  <taskdef name="mkcol" classname="org.apache.webdav.ant.taskdefs.Mkcol"/>
+  <taskdef name="delete" classname="org.apache.webdav.ant.taskdefs.Delete"/>
+  <taskdef name="proppatch" classname="org.apache.webdav.ant.taskdefs.Proppatch"/>
+  <taskdef name="copy" classname="org.apache.webdav.ant.taskdefs.Copy"/>
+  <taskdef name="move" classname="org.apache.webdav.ant.taskdefs.Move"/>
+</antlib>
+

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/doc-files/tasks.htm
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/doc-files/tasks.htm	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/doc-files/tasks.htm	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,505 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML><HEAD> 
+	 <TITLE>WebDAV ant tasks</TITLE> <STYLE TYPE="text/css">
+	 	BODY {
+			font-family: Arial, sans-serif;
+		}
+	 </STYLE> 
+  </HEAD> 
+  <BODY> 
+	 <H1>WebDAV ant tasks</H1> 
+	 <P>Tasks for Jakarta Ant for dealing with WebDAV repositories. </P> 
+	 <P>Tested with ant 1.6.1.</P> 
+	 <P>Library dependencies:</P> 
+	 <UL> 
+		<LI>Jakarta Commons HTTP Client</LI> 
+		<LI>Jakarta Slide WebDAV Client library</LI> 
+		<LI>Jakarta Commons Logging library</LI> 
+	 </UL> 
+	 <H3>Task definitions</H3> 
+	 <P>Copy the four java libraries to your <TT>${ANT_HOME}/lib</TT> directory.
+		And choose on of the following options to declare the WebDAV tasks.</P> 
+	 <P>Way 1: Declare the tasks in like the following. Daclare any name and use
+		the name for the tasks described below.</P> 
+	 <PRE> &lt;target name="declare-tasks"&gt;
+   &lt;taskdef name="davput" classname="org.apache.webdav.ant.taskdefs.Put"/&gt; 
+   &lt;taskdef name="davget" classname="org.apache.webdav.ant.taskdefs.Get"/&gt;
+   &lt;taskdef name="lock"   classname="org.apache.webdav.ant.taskdefs.Lock"/&gt;
+   &lt;taskdef name="unlock" classname="org.apache.webdav.ant.taskdefs.Unlock"/&gt;
+   &lt;taskdef name="mkcol"  classname="org.apache.webdav.ant.taskdefs.Mkcol"/&gt;
+   &lt;taskdef name="davdelete" classname="org.apache.webdav.ant.taskdefs.Delete"/&gt;
+   &lt;taskdef name="proppatch" classname="org.apache.webdav.ant.taskdefs.Proppatch"/&gt;
+   &lt;taskdef name="davcopy" classname="org.apache.webdav.ant.taskdefs.Copy"/&gt;
+   &lt;taskdef name="davmove" classname="org.apache.webdav.ant.taskdefs.Move"/&gt;
+ &lt;/target&gt;</PRE> 
+	 <P>Way 1a.</P> 
+	 <PRE>  &lt;target name="declare-tasks"&gt;
+    &lt;taskdef resource="org/apache/webdav/ant/taskdefs.properties"/&gt;
+  &lt;/target&gt;</PRE> 
+	 <P>Way 2: Declare the namespace <TT>antlib:org.apache.webdav.ant</TT>, e.g.
+		at the <TT>project</TT> element of your <TT>build.xml</TT>. </P> 
+	 <PRE>  &lt;project name="site-update" 
+           default="upload" 
+           xmlns:dav="antlib:org.apache.webdav.ant"&gt;
+    &lt;target name="uplaod"
+      &lt;dav:put url="http://${DAV.server}/${DAV.root}"
+               userid="${DAV.user}" password="${DAV.password}"
+               lock="true" overwrite="false"&gt;
+        &lt;dav:fileset dir="site"&gt;
+          &lt;dav:include name="**/*.html"/&gt;
+        &lt;/dav:fileset&gt;
+      &lt;/dav:put&gt;
+    &lt;/target&gt;
+  &lt;/project&gt;</PRE> 
+	 <P>As you can see you use the prefix declared for the namespace
+		<TT>antlib:org.apache.webdav.ant</TT> for all WebDAV ant tasks and for all its
+		children. (The later I didn't understand, but without it doesn't work.)</P> 
+	 <H2>common attributes</H2> 
+	 <P>All of the ant tasks described below have the following attributes.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR> 
+		  <TD VALIGN="top">url</TD> 
+		  <TD VALIGN="top">The WebDAV URL to work on.</TD> 
+		  <TD VALIGN="middle" ALIGN="center">Yes.</TD> 
+		</TR> 
+		<TR> 
+		  <TD VALIGN="top">userid</TD> 
+		  <TD VALIGN="top">The username for authentication.</TD> 
+		  <TD VALIGN="top" ALIGN="center">No.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">password</TD><TD VALIGN="top">Thes users password
+			 for authentication.</TD><TD VALIGN="top" ALIGN="center">No.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">verbose</TD><TD VALIGN="top">Makes the task as
+			 verbose as with ants -v option. Defaults to <TT>false</TT>.</TD><TD
+		  VALIGN="top" ALIGN="center">No.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H2><A NAME="davget">davget, dav:get</A></H2> 
+	 <H4>Description</H4> 
+	 <P>Retrieves a file a WebDAV-fileset from a WebDAV server and stored it in
+		a local directory.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR> 
+		  <TD VALIGN="top">toDir</TD> 
+		  <TD VALIGN="top">The local directory where to store the resources
+			 retrieved.</TD> 
+		  <TD VALIGN="middle" ALIGN="center" ROWSPAN="2">Yes. Either todir of
+			 tofile must be specified.</TD> 
+		</TR> 
+		<TR> 
+		  <TD VALIGN="top">toFile</TD> 
+		  <TD VALIGN="top">A filename where to store the resource given directly
+			 by <TT>url</TT> attribute.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">overwrite</TD><TD VALIGN="top">If set to
+			 <TT>true</TT> WebDAV resources are overwritten without any test. Otherwise they
+			 are overwritten only if its <TT>getlastmodified</TT> property is less then the
+			 local <I>last modified date</I>. Defaults to <TT>false</TT>.</TD><TD
+		  VALIGN="top" ALIGN="center">No.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">encoding</TD><TD VALIGN="top">Specifies the encoding
+			 of the files to be retrieved. This should be set when using filter, otherwise
+			 it is unused.</TD><TD VALIGN="top" ALIGN="center">No.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Nested Elements</H4> 
+	 <P>The files to be retrieved are specified by nested <TT><A
+		HREF="#davfileset">davfileset</A></TT>s.</P> 
+	 <P>This task supports filtering using nested <TT>FilterSet</TT>s. If
+		filters are used the encoding attribute should be set.</P> 
+	 <H4>Examples</H4> 
+	 <PRE>  &lt;davget url="http://any.host.com/DAV"
+          userid="${DAV.user}" password="${DAV.password}"
+          todir="tmp"&gt;
+    &lt;davfileset dir="any/collection"&gt;
+      &lt;include name="**/*.xml"/&gt;
+    &lt;/davfileset&gt;
+  &lt;/davget&gt;</PRE> 
+	 <P>Retrieves all XML files from the DAV collection published under
+		<TT>http://any.host.com/DAV/any/collection</TT>and its sub collections.</P> 
+	 <PRE>  &lt;davget url="http://${DAV.server}/${DAV.root}/path/to/any/file.txt"
+          userid="${DAV.user}" password="${DAV.password}"
+          tofile="tmp/filterTest.txt" encoding="UTF-8"
+          overwrite="true"&gt;
+    &lt;filterset&gt;
+      &lt;filter token="XXX" value="YYY"/&gt;
+    &lt;/filterset&gt;
+  &lt;/davget&gt;</PRE> 
+	 <P>Retrieves a single file and applies a filter to it.</P> 
+	 <H2><A NAME="davput">davput, dav:put</A></H2> 
+	 <H4>Description</H4> 
+	 <P>Uploads local files to a WebDAV server.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR> 
+		  <TD VALIGN="top">file</TD> 
+		  <TD VALIGN="top">A single file to be uploaded</TD> 
+		  <TD VALIGN="middle" ALIGN="center">No.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">lock</TD><TD VALIGN="top">Specifies whether the root
+			 URL (given by the url attribute) is to be locked before uploading. Defaults to
+			 <TT>true</TT>.</TD><TD VALIGN="middle" ALIGN="center">No.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">locktoken</TD><TD VALIGN="top">Gives a locktoken to
+			 be used while writing. May be obtained with the <A
+			 HREF="#lock"><TT>lock</TT></A> task.</TD><TD VALIGN="middle"
+		  ALIGN="center">No.&nbsp;</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">overwrite</TD><TD VALIGN="top">If set to
+			 <TT>true</TT> local files are overwritten without any test. Otherwise they are
+			 overwritten only if they are older then the WebDAV resource. Defaults to
+			 <TT>false</TT>.</TD><TD VALIGN="top" ALIGN="center">No.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">encoding</TD><TD VALIGN="top">Specifies the encoding
+			 of the files to be retrieved. This should be set when using filter, otherwise
+			 it is unused.</TD><TD VALIGN="top" ALIGN="center">No.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Nested Elements</H4> 
+	 <P>Files to be uploaded are specified by nested <TT>FileSet</TT>s. If the
+		<TT>file</TT> attribute is given no <TT>FileSet</TT>s are allowed.</P> 
+	 <P>This task supports filtering using nested <TT>FilterSet</TT>s. If
+		filters are used the encoding attribute should be set.</P> 
+	 <P><TT>davput</TT> also supports nested <TT>zipfileset</TT>s.</P> 
+	 <H4>Examples</H4> 
+	 <PRE>  &lt;davput url="http://${DAV.server}/${DAV.root}/xx/yy/zz"
+          userid="${DAV.user}" password="${DAV.password}"&gt;
+    &lt;fileset dir="${basedir}"&gt;
+      &lt;include name="**/*.xml"/&gt;
+    &lt;/fileset&gt;
+  &lt;/davput&gt;</PRE> 
+	 <P>Uploads all XML files in the base directory that are newer then its
+		version in the DAV collection. The <TT>zz</TT> collection is locked before
+		reading and writing and unlocked if the task is finished.</P> 
+	 <PRE>  &lt;davput url="http://${DAV.server}/${DAV.root}/x/y/z"
+          userid="${DAV.user}" password="${DAV.password}"
+          overwrite="true" encoding="UTF-8"
+          file="filterTest.txt"&gt;
+    &lt;filterset&gt;
+      &lt;filter token="FILTER" value="VALUE"/&gt;
+    &lt;/filterset&gt;
+  &lt;/davput&gt;</PRE> 
+	 <P>Puts a single file to the given URL. If the resource at <TT>/x/y/z</TT>
+		exists and is a collection the given file is puted as new member of this
+		collection. If the resource is not a collection the file will replace the
+		existing resource.</P> 
+	 <P>While uploading a filter is applied.</P> 
+	 <PRE>  &lt;davput url="http://${DAV.server}/${DAV.root}/docs/"
+     userid="${DAV.user}" password="${DAV.password}"&gt;
+     &lt;zipfileset src="docs.zip"&gt;
+       &lt;include name="**/*.xml"/&gt;
+     &lt;/zipfileset&gt;
+  &lt;/davput&gt;</PRE> 
+	 <P>Uploads all XML files found in the zipfile <TT>docs.zip</TT>.</P> 
+	 <H2><A NAME="mkcol">mkcol</A>, dav:mkcol</H2> 
+	 <H4>Description</H4> 
+	 <P>Creates a WebDAV collection and all required parent collections.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR><TD VALIGN="top">locktoken</TD><TD VALIGN="top">Gives a locktoken to
+			 be used while writing. May be obtained with the <A
+			 HREF="#lock"><TT>lock</TT></A> task.</TD><TD VALIGN="middle"
+		  ALIGN="center">No.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Examples</H4> 
+	 <PRE>  &lt;mkcol url="http://${DAV.server}/xx/yy/zz"
+         userid="${DAV.user}" password="${DAV.password}"/&gt;</PRE> 
+	 <P>Creates a collection named <TT>/xx/yy/zz</TT>. If the collections
+		<TT>/xx</TT> and <TT>/xx/yy</TT> do not exist they are created too.</P> 
+	 <H2><A NAME="davcopy">davcopy, dav:copy</A></H2> 
+	 <H4>Description</H4> 
+	 <P>Copies/renames a resource on a single WebDAV-Server.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR><TD VALIGN="top">destination</TD><TD VALIGN="top">URL to which the
+			 source (given by the common <TT>url</TT> attribute) is to be copied.<BR>This
+			 URL may be relative to <TT>url</TT> or an absolute one.</TD><TD VALIGN="middle"
+		  ALIGN="center">Yes.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">overwrite</TD><TD VALIGN="top">Determines whether
+			 the destination is overwritten if it always exists.</TD><TD VALIGN="middle"
+		  ALIGN="center">No. Defaults to <TT>false</TT>.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">depth</TD><TD VALIGN="top">Determines whether the
+			 copy of collections is shallow (<TT>0</TT>)or deep (<TT>infinity</TT>).</TD><TD
+		  VALIGN="middle" ALIGN="center">No. Defaults to <TT>infinity</TT>.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Examples</H4> 
+	 <PRE>   &lt;davcopy url="http://${DAV.server}/DAV/resource1" verbose="true"
+            userid="${DAV.user}" password="${DAV.password}"
+            destination="http://${DAV.server}/DAV/copy_of_resource1"/&gt;</PRE> 
+	 <P>Copies <TT>resource</TT> to <TT>copy_of_resource</TT>. If
+		<TT>resource</TT> is a collection the whole content is copied too.</P> 
+	 <PRE>   &lt;davcopy url="http://${DAV.server}/DAV/resource1" verbose="true"
+            userid="${DAV.user}" password="${DAV.password}"
+            destination="copy_of_resource1"/&gt;</PRE> 
+	 <P>Does the same as the first example, but the destination is given
+		relative.</P> 
+	 <H2><A NAME="davmove">davmove, dav:move</A></H2> 
+	 <H4>Description</H4> 
+	 <P>Moves/renames a WebDAV-resource.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR><TD VALIGN="top">destination</TD><TD VALIGN="top">URL to which the
+			 source (given by the common <TT>url</TT> attribute) is to be moved.<BR>This URL
+			 may be relative to <TT>url</TT> or an absolute one.</TD><TD VALIGN="middle"
+		  ALIGN="center">Yes.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">overwrite</TD><TD VALIGN="top">Determines whether
+			 the destination is overwritten if it always exists.</TD><TD VALIGN="middle"
+		  ALIGN="center">No. Defaults to <TT>false</TT>.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Examples</H4> 
+	 <PRE>   &lt;davmove url="http://${DAV.server}/DAV/resource1" verbose="true"
+            userid="${DAV.user}" password="${DAV.password}"
+            destination="http://${DAV.server}/DAV/resource2"/&gt;</PRE> 
+	 <P>Renames the resource <TT>resource1</TT> to <TT>resource2</TT>.</P> 
+	 <PRE>   &lt;davmove url="http://${DAV.server}/DAV/coll1/resource" verbose="true"
+            userid="${DAV.user}" password="${DAV.password}"
+            destination="/DAV/coll2/resource"/&gt;</PRE> 
+	 <P>Moves the resource <TT>resource</TT> from collection <TT>coll1</TT> to
+		<TT>coll2</TT> using a relative destination URL.</P> 
+	 <H2><A NAME="davdelete">davdelete, dav:delete</A></H2> 
+	 <H4>Description</H4> 
+	 <P>Deletes a WebDAV resource or a set of resources.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR><TD VALIGN="top">locktoken</TD><TD VALIGN="top">Gives a locktoken to
+			 be used while writing. May be obtained with the <A
+			 HREF="#lock"><TT>lock</TT></A> task.</TD><TD VALIGN="middle"
+		  ALIGN="center">No.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Nested Elements</H4> 
+	 <P>Resources to be deleted are given by nested <TT><A
+		HREF="#davfileset">davfileset</A></TT>s</P> 
+	 <H4>Examples</H4> 
+	 <PRE>  &lt;davdelete url="http://${DAV.server}/DAV/"
+             userid="${DAV.user}" password="${DAV.password}"&gt;
+    &lt;davfileset dir="docs"&gt;
+      &lt;include name="**/*.xml"/&gt;
+    &lt;/davfileset&gt;
+  &lt;/davdelete&gt;</PRE> 
+	 <P>Deletes all XML files in the <TT>/DAV/docs</TT> collection and its
+		subcollections.</P> 
+	 <PRE>  &lt;davdelete url="http://${DAV.server}/DAV/xx"
+             userid="${DAV.user}" password="${DAV.password}"&gt;
+  &lt;/davdelete&gt;</PRE> 
+	 <P>Deletes the resource <TT>/DAV/xx</TT>.</P> 
+	 <H2>proppatch, dav:proppatch</H2> 
+	 <H4>Description</H4> 
+	 <P>Sets or removes properties on WebDAV resources. (experimental)</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR><TD VALIGN="top">locktoken</TD><TD VALIGN="top">Gives a locktoken to
+			 be used while writing. May be obtained with the <A
+			 HREF="#lock"><TT>lock</TT></A> task.</TD><TD VALIGN="middle"
+		  ALIGN="center">No.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Nested Elements</H4> 
+	 <P>Resources to be proppatch'ed are given by nested <TT><A
+		HREF="#davfileset">davfileset</A></TT>s. Without a <TT>davfileset</TT> the
+		resource given by the <TT>url</TT> attribute is used.</P> 
+	 <H5>set, remove</H5> 
+	 <P>The <TT>set</TT> elements specifies a property to be set.</P> 
+	 <P>The <TT>remove</TT> elements specifies a property to be set.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR><TD VALIGN="top">name</TD><TD VALIGN="top">The name of the property
+			 .</TD><TD VALIGN="middle" ALIGN="center">Yes</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">namespace</TD><TD VALIGN="top">The namespace of the
+			 property. Defaults to the DAV namespace (<TT>DAV:</TT>).</TD><TD
+		  VALIGN="middle" ALIGN="center">No</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">namespaceprefix</TD><TD VALIGN="top">The prefix to
+			 be used in the DAV request for the namespace. This should only be needed in the
+			 rare case where the server expects a certain prefix.</TD><TD VALIGN="middle"
+		  ALIGN="center">No. Discouraged.</TD> 
+		</TR> 
+		<TR><TD
+		  VALIGN="top">value (for <TT>&lt;set&gt;</TT> only)</TD><TD VALIGN="top">The
+			 value of the property. Must not be given if the element contains text.</TD><TD
+		  VALIGN="middle" ALIGN="center">No.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Examples</H4> 
+	 <PRE>  &lt;proppatch url="http://${DAV.server}/DAV/test.txt"
+             userid="${DAV.user}" password="${DAV.password}"&gt;
+     &lt;set name="displayname" value="TEST.TXT"/&gt;
+  &lt;/proppatch&gt;</PRE> 
+	 <P>Sets the <TT>DAV:displayname</TT> of the resource
+		<TT>DAV/test.txt</TT>.</P> 
+	 <PRE>  &lt;proppatch url="http://${DAV.server}/DAV/users/sl"
+             userid="${DAV.user}" password="${DAV.password}"&gt;
+    &lt;set name="email" namespace="imb"&gt;sl at itaw&lt;/set&gt;
+    &lt;set name="displayname"&gt;stefan"&lt;/set&gt;
+    &lt;remove name="address" namespace="imb"/&gt;
+  &lt;/proppatch&gt;</PRE> 
+	 <P>Sets and removes some properties for a user resource.</P> 
+	 <PRE>  &lt;proppatch url="http://${DAV.server}/DAV/pub"
+             userid="${DAV.user}" password="${DAV.password}"&gt;
+     &lt;set name="status" namespace="http://www.abb.com/" value="published"/&gt;
+     &lt;davfileset/&gt;
+  &lt;/proppatch&gt;</PRE> 
+	 <P>Sets the <TT>{http://www.abb.com/}status</TT> property on all resources
+		in the <TT>/DAV/pub</TT> collection.</P> <HR> 
+	 <H2><A NAME="lock">lock, dav:lock</A></H2> 
+	 <H4>Description</H4> 
+	 <P>Locks a WebDAV resource and stores the locktoken recieved in a property.
+		Together with the <A HREF="#unlock"><TT>unlock</TT></A> task this in intended
+		to execute multiple WebDAV operations within the same lock.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR><TD VALIGN="top">property</TD><TD VALIGN="top">The name of the
+			 property where the locktoken is stored.</TD><TD VALIGN="middle"
+		  ALIGN="center">Yes.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">timeout</TD><TD VALIGN="top">The timeout of the lock
+			 in seconds. Defaults to 3600.</TD><TD VALIGN="middle" ALIGN="center">No.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">ownerinfo</TD><TD VALIGN="top">The owner info of the
+			 lock. Defaults to the <TT>userid</TT> or to <TT>ant</TT> if no userid is
+			 given.</TD><TD VALIGN="middle" ALIGN="center">No.</TD> 
+		</TR> 
+		<TR><TD VALIGN="top">depth</TD><TD VALIGN="top">The depth of the lock.
+			 Valid values are 0<TT></TT> of <TT>infinity</TT>. Defaults to
+			 <TT>infinity</TT>.</TD><TD VALIGN="middle" ALIGN="center">No.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Examples</H4> 
+	 <PRE>  &lt;lock url="http://${DAV.server}/DAV/col"
+        userid="${DAV.user}" password="${DAV.password}"
+        property="locktoken"/&gt;
+  &lt;mkcol url="http://${DAV.server}/DAV/col"
+        userid="${DAV.user}" password="${DAV.password}"
+        locktoken="${locktoken}"/&gt;
+  &lt;davput url="http://${DAV.server}/DAV/col"
+        userid="${DAV.user}" password="${DAV.password}"
+        locktoken="${locktoken}" overwrite="false"&gt;
+    &lt;fileset dir="${basedir}"&gt;
+      &lt;include name="**/*.xml"/&gt;
+    &lt;/fileset&gt;
+  &lt;/davput&gt;
+  &lt;unlock url="http://${DAV.server}/DAV/col"
+        userid="${DAV.user}" password="${DAV.password}"
+        locktoken="${locktoken}"/&gt;</PRE> 
+	 <P>Locks the resource <TT>/DAV</TT> and stores the locktoken in the
+		property <TT>locktoken</TT>. Executes two writing tasks with the same locktoken
+		and unlocks the <TT>/DAV</TT> resource.</P> 
+	 <PRE>  &lt;lock url="http://${DAV.server}/DAV"
+        userid="${DAV.user}" password="${DAV.password}"
+        property="locktoken" 
+        timeout="100" ownerinfo="${user}" depth="0"/&gt;</PRE> 
+	 <P>Locks the resource <TT>/DAV</TT> for 100 seconds.</P> 
+	 <H2><A NAME="unlock">unlock, dav:unlock</A></H2> 
+	 <H4><A NAME="unlock">Description</A></H4> 
+	 <P>Removes a lock. See <A HREF="#lock"><TT>lock</TT></A>.</P> 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR><TD VALIGN="top">locktoken</TD><TD VALIGN="top">Gives a locktoken of
+			 the lock to be removed.</TD><TD VALIGN="middle" ALIGN="center">Yes.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <P></P> <HR> 
+	 <H2><A NAME="davfileset">davfileset</A></H2> 
+	 <H4>Description</H4> 
+	 <P>Defines a group of WebDAV resources like a fileset for local files.
+		Resources will be found in a collection tree determined by the root
+		collection.</P> 
+	 <P>Resources in the set are specified by nested <TT>&lt;patternset&gt;</TT>
+		<TT>&lt;include&gt;</TT>, <TT>&lt;includesfile&gt;</TT>,
+		<TT>&lt;exclude&gt;</TT> or <TT>&lt;excludesfile&gt;</TT> elements. Without any
+		child element a davfileset selects all resources below the root collection.</P>
+	 
+	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
+		<TR> 
+		  <TD VALIGN="top"><B>Attribute</B></TD> 
+		  <TD VALIGN="top"><B>Description</B></TD> 
+		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
+		</TR> 
+		<TR> 
+		  <TD VALIGN="top">dir</TD> 
+		  <TD VALIGN="top">The root of the collection tree of this DavFileSet.
+			 This is a URL path relative to the URL of the surrounding task.</TD> 
+		  <TD VALIGN="middle" ALIGN="center">No.</TD> 
+		</TR> 
+		<TR> 
+		  <TD VALIGN="top">casesensitive</TD> 
+		  <TD VALIGN="top">Must the include and exclude patterns be treated in a
+			 case sensitive way? Defaults to <TT>true</TT>.</TD> 
+		  <TD VALIGN="top" ALIGN="center">No.</TD> 
+		</TR> 
+	 </TABLE> 
+	 <H4>Examples</H4> 
+	 <PRE>  &lt;davfileset dir="xx/yy"&gt;
+    &lt;include name="**/*.xml"/&gt;
+  &lt;/davfileset&gt;</PRE> 
+	 <P>Selects all XML-files in the collection <TT>xx/yy</TT> below the URL
+		given in the surrounding task.</P> 
+	 <PRE>  &lt;patternset id="HtmlFiles"&gt;
+    &lt;include name="**/*.htm"/&gt;
+    &lt;include name="**/*.html"/&gt;
+  &lt;/patternset&gt;
+  ...
+  &lt;davfileset&gt;
+    &lt;patternset refid="HtmlFiles"/&gt;
+  &lt;/davfileset&gt;</PRE> 
+	 <P>Selects all HTML sources below the URL given in the surrounding
+		task.</P> 
+	 <PRE>  &lt;davfileset dir="tmp"/&gt;</PRE> 
+	 <P>Selects all resources in the <TT>tmp</TT> collections and its
+		subcollections.</P> 
+	 <P></P> </BODY>
+</HTML>

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/mimetypes.properties
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/mimetypes.properties	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/mimetypes.properties	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,99 @@
+ai=application/postscript
+aif=audio/x-aiff
+aifc=audio/x-aiff
+aiff=audio/x-aiff
+au=audio/basic
+avi=video/x-msvideo
+avx=video/x-rad-screenplay
+bcpio=application/x-bcpio
+bin=application/octet-stream
+bmp=image/bmp
+body=text/html
+cdf=application/x-netcdf
+cer=application/x-x509-ca-cert
+class=application/java
+cpio=application/x-cpio
+csh=application/x-csh
+css=text/css
+doc=application/msword
+dvi=application/x-dvi
+eps=application/postscript
+etx=text/x-setext
+exe=application/octet-stream
+gif=image/gif
+gtar=application/x-gtar
+gz=application/x-gzip
+hdf=application/x-hdf
+hqx=application/mac-binhex40
+htm=text/html
+html=text/html
+ief=image/ief
+java=text/plain
+jpe=image/jpeg
+jpeg=image/jpeg
+jpg=image/jpeg
+jpg=image/pjpeg
+js=application/x-javascript
+latex=application/x-latex
+man=application/x-troff-man
+me=application/x-troff-me
+mif=application/x-mif
+mov=video/quicktime
+movie=video/x-sgi-movie
+mp2=audio/mpeg
+mp3=audio/mpeg
+mpe=video/mpeg
+mpeg=video/mpeg
+mpg=video/mpeg
+mpga=audio/mpeg
+mpv2=video/mpeg2
+ms=application/x-wais-source
+nc=application/x-netcdf
+oda=application/oda
+pbm=image/x-portable-bitmap
+pdf=application/pdf
+pgm=image/x-portable-graymap
+png=image/png
+pnm=image/x-portable-anymap
+ppm=image/x-portable-pixmap
+ppt=application/vnd.ms-powerpoint
+ps=application/postscript
+ps=application/x-postscript
+qt=video/quicktime
+ras=image/x-cmu-raster
+rgb=image/x-rgb
+roff=application/x-troff
+rtf=application/rtf
+rtx=text/richtext
+sgm=text/sgml
+sgml=text/sgml
+sh=application/x-sh
+shar=application/x-shar
+snd=audio/basic
+src=application/x-wais-source
+sv4cpio=application/x-sv4cpio
+sv4crc=application/x-sv4crc
+t=application/x-troff
+tar=application/x-tar
+tcl=application/x-tcl
+tex=application/x-tex
+texi=application/x-texinfo
+texinfo=application/x-texinfo
+tif=image/tiff
+tiff=image/tiff
+tr=application/x-troff
+tsv=text/tab-separated-values
+txt=text/plain
+ustar=application/x-ustar
+wav=audio/x-wav
+wrl=x-world/x-vrml
+xbm=image/x-xbitmap
+xls=application/vnd.ms-excel
+xml=text/xml
+xpm=image/x-xpixmap
+xsl=text/xml
+xslt=text/xml
+xwd=image/x-xwindowdump
+z=application/x-compress
+Z=application/x-compress
+zip=application/zip

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/package.html
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/package.html	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/package.html	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML><HEAD> 
+	 <TITLE></TITLE></HEAD> 
+  <BODY> 
+	 <P> Implements ant tasks for dealing with a WebDAV repository. </P> 
+	 <P> For details for single tasks see <A HREF="doc-files/tasks.htm">the
+		documentation</A>.</P> </BODY>
+</HTML>

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,101 @@
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java,v 1.2.2.1 2004/08/15 12:57:17 luetzkendorf Exp $
+ * $Revision: 1.2.2.1 $
+ * $Date: 2004/08/15 12:57:17 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.URIException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.webdav.ant.Utils;
+import org.apache.webdav.lib.methods.DepthSupport;
+
+/**
+ * WebDAV task for copying resources and collections.
+ * 
+ * @see <a href="../doc-files/tasks.htm#davcopy">Task documentation</a>
+ */
+public class Copy extends WebdavMatchingTask {
+
+    private String destination;
+    private int depth = DepthSupport.DEPTH_INFINITY;
+    private boolean overwrite = false;
+    private HttpURL destinationURL;
+
+    /* 
+     * @see org.apache.tools.ant.Task#execute()
+     */
+    public void execute() throws BuildException {
+        validate();
+        try {
+            // TODO assure that the colletion to which we copy does exist
+            log("Copying " + getUrl(), ifVerbose());
+            Utils.copyResource(
+                getHttpClient(), 
+                getUrl(),
+                this.destinationURL.getURI(),
+                this.depth,
+                this.overwrite
+            );
+        }
+        catch (IOException e) {
+            throw Utils.makeBuildException("Can't copy!", e);
+        }
+    }
+
+    public void setDestination(String destination) {
+        this.destination = destination;
+    }
+
+    public void setDepth(String value) {
+        if ("0".trim().equals(value)) {
+           this.depth = DepthSupport.DEPTH_0;
+        }
+        else if ("infinity".trim().toLowerCase().equals(value)) {
+           this.depth = DepthSupport.DEPTH_INFINITY;
+        }
+        else {
+            throw new BuildException("Invalid value of depth attribute." 
+                 + " (One of '0' or 'infinity' expected)");
+        }
+    }
+
+    public void setOverwrite(boolean value) {
+        this.overwrite = value;
+    }
+
+    protected void validate() {
+        super.validate();
+        if (destination == null) {
+            throw new BuildException("Missing required attribute destination");
+        }
+        
+        try {
+            this.destinationURL = Utils.createHttpURL(getUrl(), this.destination);
+            this.destinationURL.setPath(removeDoubleSlashes(
+                    this.destinationURL.getPath()));
+        } catch (URIException e) {
+            throw new BuildException("Invalid destination uri!", e);
+        }
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Delete.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Delete.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Delete.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,129 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Delete.java,v 1.5.2.2 2004/08/22 10:36:47 luetzkendorf Exp $
+ * $Revision: 1.5.2.2 $
+ * $Date: 2004/08/22 10:36:47 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpURL;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.webdav.ant.CollectionScanner;
+import org.apache.webdav.ant.Utils;
+import org.apache.webdav.ant.WebdavFileSet;
+import org.apache.webdav.lib.methods.DeleteMethod;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+/**
+ * WebDAV task for deleting resources and collections.
+ * 
+ * @see <a href="../doc-files/tasks.htm#davdelete">Task documentation</a>
+ */
+public class Delete extends WebdavMatchingTask
+{
+   private String locktoken = null;
+   private int count = 0;
+   
+   public void execute() throws BuildException {
+      try {
+         if (!getFileSets().hasNext()) {
+            // delete the resource given by url
+            log("Deleting: " + getUrl(), Project.MSG_INFO);
+            delete(getUrl(), getUrl().getURI());
+         } else {
+            // delete all resources in file sets
+            log("Deleting at: " + getUrl(), ifVerbose());
+            // URL must be a collection
+            if (!getUrl().getPath().endsWith("/")) {
+               getUrl().setPath(getUrl().getPath() + "/");
+            }
+            for(Iterator i = getFileSets(); i.hasNext(); ) {
+               deleteFileset((WebdavFileSet)i.next());
+            }
+            log("Deleted " + this.count 
+                  + (this.count == 1 ? " resource" : " resources")
+                  + " from " + getUrl(),
+                  this.count > 0 
+                     ? Project.MSG_INFO
+                     : ifVerbose());
+         }
+      } 
+      catch (IOException e) {
+         throw Utils.makeBuildException("Can't delete!", e);
+      }
+   }
+   
+   
+   private void delete(HttpURL url, String logName)
+      throws IOException, HttpException
+   {
+      validate();
+      log("Deleting " + logName, ifVerbose());
+      DeleteMethod delete = new DeleteMethod(url.getURI());
+      delete.setFollowRedirects(true);
+      if (this.locktoken != null) {
+         Utils.generateIfHeader(delete, this.locktoken);
+      }
+      int status = getHttpClient().executeMethod(delete);
+      
+      switch (status) {
+         case WebdavStatus.SC_OK:
+         case WebdavStatus.SC_NO_CONTENT:
+         case WebdavStatus.SC_NOT_FOUND:
+            // ok
+            this.count++;
+            break;
+         default:
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            throw ex;
+      }
+   }
+   
+   private void deleteFileset(WebdavFileSet fileSet)
+      throws IOException, HttpException
+   {
+      CollectionScanner scanner = 
+         fileSet.getCollectionScanner(getProject(), getHttpClient(), getUrl());
+      HttpURL baseUrl = scanner.getBaseURL();
+     
+      String[] files = scanner.getIncludedFiles();
+      for (int i = 0; i < files.length; i++) {
+         HttpURL url = Utils.createHttpURL(baseUrl, files[i]);
+         delete(url, files[i]);
+      }
+      String[] colls = scanner.getIncludedDirectories();
+      for (int i = 0; i < colls.length; i++) {
+         HttpURL url = Utils.createHttpURL(baseUrl, colls[i]);
+         delete(url, colls[i]);
+      }
+   }
+   
+   public void setLocktoken(String token) {
+      this.locktoken = token;
+      if (!this.locktoken.startsWith("opaquelocktoken:")) {
+         throw new BuildException("Invalid locktoken: " + token);
+      }
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Get.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Get.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Get.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,258 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Get.java,v 1.3.2.1 2004/08/15 13:01:15 luetzkendorf Exp $
+ * $Revision: 1.3.2.1 $
+ * $Date: 2004/08/15 13:01:15 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.Iterator;
+
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpURL;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
+import org.apache.tools.ant.util.LineTokenizer;
+import org.apache.webdav.ant.CollectionScanner;
+import org.apache.webdav.ant.Utils;
+import org.apache.webdav.ant.WebdavFileSet;
+
+/**
+ * WebDAV task for retrieving resources.
+ * 
+ * @see <a href="../doc-files/tasks.htm#davget">Task documentation</a>
+ */
+public class Get extends WebdavMatchingTask {
+   private File toDir = null;
+   private File toFile = null;
+   private boolean overwrite = false; 
+   private String encoding = null;
+   private FilterSetCollection filterSets = new FilterSetCollection();
+   
+   private int countWrittenFiles = 0;
+   private int countOmittedFiles = 0;
+   
+   /* 
+    * @see org.apache.tools.ant.Task#execute()
+    */
+   public void execute() throws BuildException {
+      validate();
+      
+      try {
+         if (this.toFile != null) {
+            downloadSingleFile();
+         } else {
+            log("Downloading from: " + getUrl(), ifVerbose());
+            // URL must be a collection
+            if (!getUrl().getPath().endsWith("/")) {
+               getUrl().setPath(getUrl().getPath() + "/");
+            }
+            for(Iterator i = getFileSets(); i.hasNext(); ) {
+               downloadFileset((WebdavFileSet)i.next());
+            }
+         }
+         
+         if (this.countWrittenFiles > 0) {
+            log("Downloaded " + this.countWrittenFiles 
+                  + (this.countWrittenFiles == 1 ? " resource" : " resources")
+                  + " from " + getUrl(),
+                  this.countWrittenFiles > 0 
+                     ? Project.MSG_INFO
+                     : ifVerbose());
+         }
+      } catch (IOException e) {
+         throw Utils.makeBuildException("Error while downloading!", e);
+      }
+   }
+   
+   protected void validate() {
+      super.validate();
+      
+      if (this.toDir == null && this.toFile == null) {
+         throw new BuildException("Missing one of the required attributes toDir" +
+               " or toFile.");
+      }
+      if (this.toDir != null && this.toFile != null) {
+         throw new BuildException("Only one of the attributes toDir and toFile" +
+               " is alowed.");
+      }
+      if (this.toFile != null && getFileSets().hasNext()) {
+         throw new BuildException("Not filesets allowed if toFile is set.");
+      }
+      if (this.encoding == null && this.filterSets.hasFilters()) {
+         log("If filterSets are used a file encoding should be specified!", 
+               Project.MSG_WARN);
+         this.encoding = "ISO-8859-1"; // TODO what should be the default
+      }
+   }
+   
+   protected void downloadFileset(WebdavFileSet fileSet) throws IOException 
+   {
+      CollectionScanner scanner = 
+          fileSet.getCollectionScanner(getProject(), getHttpClient(), getUrl());
+      HttpURL baseUrl = scanner.getBaseURL();
+      
+      String[] files = scanner.getIncludedFiles();
+      for (int i = 0; i < files.length; i++) {
+         HttpURL url = Utils.createHttpURL(baseUrl, files[i]);
+         downloadFile(url, files[i], scanner);
+      }
+   }
+   
+   protected void downloadSingleFile()
+      throws IOException 
+   {
+      long lastMod = Utils.getLastModified(getHttpClient(), getUrl());
+      
+      if (shallWeGetIt(this.toFile, lastMod)) {
+         getAndStoreResource(getUrl(), this.toFile, lastMod, getUrl().getURI());
+      } else {
+         log("Omitted: " + getUrl() + " (uptodate)", ifVerbose());
+         this.countOmittedFiles++;
+      }
+   }
+   
+   protected void downloadFile(HttpURL url, 
+                               String relativePath, 
+                               CollectionScanner scanner) 
+      throws IOException
+   {
+      File target = new File(this.toDir, relativePath);
+      
+      long lastMod = scanner.getProperties().getLastModified(url.toString());
+      
+      if (shallWeGetIt(target, lastMod)) {
+         getAndStoreResource(url, target, lastMod, relativePath);
+      } else {
+         log("Omitted: " + relativePath + " (uptodate)", ifVerbose());
+         this.countOmittedFiles++;
+      }
+   }
+   
+   private boolean shallWeGetIt(File target, long lastMod) {
+      boolean getit = this.overwrite || !target.exists();
+      if (!this.overwrite && target.exists()) {
+         if (lastMod > target.lastModified()) {
+            getit = true;
+         }
+      }
+      return getit;
+   }
+
+   /**
+    * Retrieves the data of a resource and stores it in a file.
+    * 
+    * Creates required directories and sets the last modified time of the file.
+    * 
+    * @param url url of the resource to be retrieved
+    * @param target file where the resource data ist stored
+    * @param lastMod last modified date of the resource, used to set 
+    *        the last modified date of the target file
+    * @param relative path og the resource for logging purposes.
+    * @throws IOException
+    * @throws HttpException
+    * @throws FileNotFoundException
+    */
+   private void getAndStoreResource(HttpURL url, File target, long lastMod, String relative) 
+      throws IOException, HttpException, FileNotFoundException 
+   {
+      log("downloading: " + relative, ifVerbose());
+      File directory = target.getParentFile();
+      if (!directory.exists()) {
+         directory.mkdirs();
+      }
+      
+      InputStream in = Utils.getFile(getHttpClient(), url);
+      
+      if (!target.exists()) {
+         target.createNewFile();
+      }
+      FileOutputStream out = new FileOutputStream(target);
+      
+      copyStream(in, out, this.filterSets, this.encoding);
+      
+      out.close();
+      target.setLastModified(lastMod);
+      this.countWrittenFiles++;
+   }
+
+   protected static void copyStream(InputStream in, OutputStream out,
+         FilterSetCollection filterSets, String encoding) 
+      throws IOException 
+   {
+      byte[] b = new byte[1024];
+      if (filterSets.hasFilters()) {
+         InputStreamReader reader = new InputStreamReader(in, encoding);
+         OutputStreamWriter writer = new OutputStreamWriter(out, encoding);
+         
+         LineTokenizer tok = new LineTokenizer();
+         tok.setIncludeDelims(true);
+
+         for (String l = tok.getToken(reader); l != null; l = tok.getToken(reader)) {
+            writer.write(filterSets.replaceTokens(l));
+         }
+         writer.close();
+         reader.close();
+      } else {
+         while (in.available() > 0) {
+            int cnt = in.read(b, 0, b.length);
+            if (cnt > -1) {
+               out.write(b, 0, cnt);
+            }
+         }
+      }
+   }
+
+
+   public void setTodir(File directory) {
+      this.toDir = directory;
+      if (this.toDir.isFile()) {
+         throw new BuildException("toDir must not point to a file!");
+      }
+   }
+   
+   public void setTofile(File file) {
+      this.toFile = file;
+      if (this.toFile.isDirectory()) {
+         throw new BuildException("toFile must not point to a directory!");
+      }
+   }
+   
+   public FilterSet createFilterSet() {
+      FilterSet filterSet = new FilterSet();
+      this.filterSets.addFilterSet(filterSet);
+      return filterSet;
+   }
+   public void setEncoding(String enc) {
+      this.encoding = enc;
+   }
+   public void setOverwrite(boolean b) {
+      this.overwrite = b;
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Lock.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Lock.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Lock.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,102 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Lock.java,v 1.3 2004/07/28 09:31:47 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:47 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import java.io.IOException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.webdav.ant.Utils;
+import org.apache.webdav.lib.methods.DepthSupport;
+
+/**
+ * WebDAV task for locking resources.
+ * 
+ * @see <a href="../doc-files/tasks.htm#lock">Task documentation</a>
+ */
+public class Lock extends WebdavTask {
+   private String lockTokenProperty = null;
+   private int timeout = 3600;
+   private String ownerInfo = null;
+   private int depth = DepthSupport.DEPTH_INFINITY;
+   
+   /* 
+    * @see org.apache.tools.ant.Task#execute()
+    */
+   public void execute() throws BuildException {
+      validate();
+      try {
+         log("Locking " + getUrl(), Project.MSG_INFO);
+         String locktoken = Utils.lockResource(
+               getHttpClient(), 
+               getUrl(),
+               this.ownerInfo,
+               this.depth,
+               this.timeout
+         );
+         getProject().setProperty(this.lockTokenProperty, locktoken);
+      } 
+      catch (IOException e) {
+         throw Utils.makeBuildException("Can't lock!", e);
+      }
+   }
+   
+   protected void validate() throws BuildException
+   {
+      super.validate();
+      
+      if (this.lockTokenProperty == null) {
+         throw new BuildException("Attribute property required!");
+      }
+      if (this.ownerInfo == null) {
+         this.ownerInfo =  "ant-webdav " + getUserid();
+      }
+   }
+   
+   
+   public void setProperty (String name) {
+      this.lockTokenProperty = name;
+   }
+   public void setTimeout(int value) {
+      if (value > 0) {
+         this.timeout = value;
+      } else {
+         throw new BuildException("Invalid timeout value (Must be " +
+               "positive integer)");
+      }
+   }
+   public void setOwnerinfo(String value) {
+      this.ownerInfo = value;
+   }
+   public void setDepth(String value) {
+      if ("0".trim().equals(value)) {
+         this.depth = DepthSupport.DEPTH_0;
+      } 
+      else if ("infinity".trim().toLowerCase().equals(value)) {
+         this.depth = DepthSupport.DEPTH_INFINITY;
+      }
+      else {
+         throw new BuildException("Invalid value of depth attribute." 
+               + " (One of '0' or 'infinity' exprected)");
+      }
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Mkcol.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Mkcol.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Mkcol.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,64 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Mkcol.java,v 1.4 2004/07/28 09:31:47 ib Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/07/28 09:31:47 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import java.io.IOException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.webdav.ant.Utils;
+
+/**
+ * WebDAV task for creating collections.
+ * 
+ * @see <a href="../doc-files/tasks.htm#mkcol">Task documentation</a> 
+ */
+public class Mkcol extends WebdavTask {
+   private String locktoken = null;
+   
+   /* 
+    * @see org.apache.tools.ant.Task#execute()
+    */
+   public void execute() throws BuildException {
+      validate();
+      try {
+         boolean created = Utils.assureExistingCollection(
+                                    getHttpClient(), 
+                                    getUrl(), 
+                                    this.locktoken);
+         if (created) {
+            log("Created collection " + getUrl(), Project.MSG_INFO);
+         }
+      } 
+      catch (IOException e) {
+         throw Utils.makeBuildException("Can't make collection!", e);
+      }
+   }
+   
+
+   public void setLocktoken(String token) {
+      this.locktoken = token;
+      if (!this.locktoken.startsWith("opaquelocktoken:")) {
+         throw new BuildException("Invalid locktoken: " + token);
+      }
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Move.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Move.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Move.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,84 @@
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Move.java,v 1.3.2.1 2004/08/15 12:57:17 luetzkendorf Exp $
+ * $Revision: 1.3.2.1 $
+ * $Date: 2004/08/15 12:57:17 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.URIException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.webdav.ant.Utils;
+
+/**
+ * WebDAV task for moving resources and collections.
+ * 
+ * @see <a href="../doc-files/tasks.htm#davmove">Task documentation</a>
+ */
+public class Move extends WebdavMatchingTask {
+
+    private String destination;
+    private boolean overwrite;
+    private HttpURL destinationURL;
+
+    /* 
+     * @see org.apache.tools.ant.Task#execute()
+     */
+    public void execute() throws BuildException {
+        validate();
+        try {
+            log("Moving " + getUrl(), ifVerbose());
+            Utils.moveResource(
+                getHttpClient(), 
+                getUrl(),
+                this.destinationURL.getURI(),
+                this.overwrite
+            );
+        }
+        catch (IOException e) {
+            throw Utils.makeBuildException("Can't move!", e);
+        }
+    }
+
+    public void setDestination(String destination) {
+        this.destination = destination;
+    }
+
+    public void setOverwrite(boolean value) {
+        this.overwrite = value;
+    }
+
+    protected void validate() {
+        super.validate();
+        if (destination == null) {
+            throw new BuildException("Missing required attribute destination");
+        }
+        
+        try {
+            this.destinationURL = Utils.createHttpURL(getUrl(), this.destination);
+            this.destinationURL.setPath(removeDoubleSlashes(
+                    this.destinationURL.getPath()));
+        } catch (URIException e) {
+            throw new BuildException("Invalid destination uri!", e);
+        }
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Proppatch.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Proppatch.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Proppatch.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,243 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Proppatch.java,v 1.4.2.1 2004/08/15 13:01:15 luetzkendorf Exp $
+ * $Revision: 1.4.2.1 $
+ * $Date: 2004/08/15 13:01:15 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpURL;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.webdav.ant.CollectionScanner;
+import org.apache.webdav.ant.Utils;
+import org.apache.webdav.ant.WebdavFileSet;
+import org.apache.webdav.lib.Constants;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.methods.PropPatchMethod;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+/**
+ * WebDAV task for editing resource properties.
+ * 
+ * <p>TODO: Howto set Properties with XML values?
+ */
+public class Proppatch extends WebdavMatchingTask
+{
+   private String locktoken = null;
+   private List toSet = new ArrayList();
+   private List toRemove = new ArrayList();
+   private int count = 0;
+   
+   public void execute() throws BuildException {
+      validate();
+      try {
+         if (!getFileSets().hasNext()) {
+            // delete the resource given by url
+            log(getUrl().getURI(), Project.MSG_INFO);
+            proppatch(getUrl(), getUrl().getURI());
+         } else {
+            log("at: " + getUrl(), ifVerbose());
+            // URL must be a collection
+            if (!getUrl().getPath().endsWith("/")) {
+               getUrl().setPath(getUrl().getPath() + "/");
+            }
+            for(Iterator i = getFileSets(); i.hasNext(); ) {
+               proppatch((WebdavFileSet)i.next());
+            }
+            log("Properties set on " + this.count 
+                  + (this.count == 1 ? " resource" : " resources")
+                  + " at " + getUrl(),
+                  this.count > 0  ? Project.MSG_INFO : ifVerbose());
+         }
+      }
+      catch (IOException e) {
+         throw Utils.makeBuildException("Can't proppatch!", e);
+      }
+   }
+   
+   protected void validate() {
+      super.validate();
+      for(Iterator i = this.toSet.iterator(); i.hasNext();) {
+         Set a = (Set)i.next();
+         if (a.name == null) {
+            throw new BuildException("Add must have name attribute.");
+         }
+      }
+      for(Iterator i = this.toRemove.iterator(); i.hasNext();) {
+         Remove r = (Remove)i.next();
+         if (r.name == null) {
+            throw new BuildException("Remove must have name attribute.");
+         }
+      }
+   }
+   
+   protected void proppatch(HttpURL url, String logName)
+      throws IOException, HttpException
+   {
+      log(logName, ifVerbose());
+      PropPatchMethod propPatch = new PropPatchMethod(url.getURI());
+      if (this.locktoken != null) {
+         Utils.generateIfHeader(propPatch, this.locktoken);
+      }
+      
+      int c = 1;
+      for(Iterator i = toRemove.iterator(); i.hasNext(); ) {
+         Remove r = (Remove)i.next();
+         propPatch.addPropertyToRemove(r.name, 
+               r.abbrev != null ? r.abbrev : "NS"+(c++), 
+               r.namespace);
+      }
+      for(Iterator i = toSet.iterator(); i.hasNext(); ) {
+         Set a = (Set)i.next();
+         propPatch.addPropertyToSet(a.name, 
+               a.getValue(), 
+               a.abbrev != null ? a.abbrev : "NS"+(c++), 
+               a.namespace);
+      }
+      
+      int status = getHttpClient().executeMethod(propPatch);
+      count++;
+      
+      switch (status) {
+         case WebdavStatus.SC_OK:
+            // ok
+            break;
+         case WebdavStatus.SC_MULTI_STATUS:
+            for(Enumeration e = propPatch.getResponses(); e.hasMoreElements();) {
+               ResponseEntity response = (ResponseEntity)e.nextElement();
+               
+               if (response.getStatusCode() > 400) {
+                  throw Utils.makeBuildException("Error while PROPPATCH",
+                        propPatch.getResponses());
+               }
+            }
+            break;
+            
+         default:
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            throw ex;
+      }
+   }
+   
+   protected void proppatch(WebdavFileSet fileSet)
+      throws IOException, HttpException
+   {
+      CollectionScanner scanner = 
+         fileSet.getCollectionScanner(getProject(), getHttpClient(), getUrl());
+      HttpURL baseUrl = scanner.getBaseURL();
+     
+      String[] files = scanner.getIncludedFiles();
+      for (int i = 0; i < files.length; i++) {
+         HttpURL url = Utils.createHttpURL(baseUrl, files[i]);
+         proppatch(url, files[i]);
+      }
+      String[] colls = scanner.getIncludedDirectories();
+      for (int i = 0; i < colls.length; i++) {
+         HttpURL url = Utils.createHttpURL(baseUrl, colls[i]);
+         proppatch(url, colls[i]);
+      }
+   }
+
+   public void setLocktoken(String token) {
+      this.locktoken = token;
+      if (!this.locktoken.startsWith("opaquelocktoken:")) {
+         throw new BuildException("Invalid locktoken: " + token);
+      }
+   }
+   public Set createSet() {
+      Set add = new Set();
+      this.toSet.add(add);
+      return add;
+   }
+   public Remove createRemove() {
+      Remove remove = new Remove();
+      this.toRemove.add(remove);
+      return remove;
+   }
+   
+   public class Set {
+      String name;
+      String namespace;
+      String abbrev;
+      String value;
+      StringBuffer text = null;
+      Set() {
+         this.name = null;
+         this.namespace = Constants.DAV;
+         this.abbrev = null;
+         this.value = null;
+      }
+      public void setName(String name) {
+         this.name = name;
+      }
+      public void setNamespace(String namespace) {
+         this.namespace = namespace;
+      }
+      public void setNamespaceprefix(String pfx) {
+         this.abbrev = pfx;
+      }
+      public void setValue(String value) {
+         this.value = value;
+      }
+      public void addText(String text) {
+         if (this.value != null) {
+            throw new BuildException("Only one of nested text or value attribute is allowed.");
+         }
+         if (this.text == null) this.text = new StringBuffer();
+         this.text.append(getProject().replaceProperties(text));
+      }
+      String getValue() {
+         if (this.value != null) {
+            return this.value;
+         }
+         if (this.text != null) {
+            return this.text.toString();
+         }
+         throw new BuildException("Either one of nested text or value attribute must be set.");
+      }
+   }
+   public static class Remove {
+      String name;
+      String namespace;
+      String abbrev;
+      Remove() {
+         this.name = null;
+         this.name = Constants.DAV;
+         this.abbrev = null;
+      }
+      public void setName(String name) {
+         this.name = name;
+      }
+      public void setNamespace(String namespace) {
+         this.namespace = namespace;
+      }
+      public void setNamespaceprefix(String pfx) {
+         this.abbrev = pfx;
+      }
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Put.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Put.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Put.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,466 @@
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Put.java,v 1.3.2.1 2004/08/15 13:01:15 luetzkendorf Exp $
+ * $Revision: 1.3.2.1 $
+ * $Date: 2004/08/15 13:01:15 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.URIException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.AbstractFileSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
+import org.apache.tools.ant.types.ZipScanner;
+import org.apache.tools.ant.util.LineTokenizer;
+import org.apache.webdav.ant.Mimetypes;
+import org.apache.webdav.ant.Utils;
+import org.apache.webdav.lib.methods.DepthSupport;
+
+/**
+ * WebDAV task for writing files to an WebDAV server.
+ * 
+ * @see <a href="../doc-files/tasks.htm#davput">Tasks documentation</a> 
+ * @version $Revision: 1.3.2.1 $
+ */
+public class Put extends WebdavTask {
+   private static final String DEFAULT_CONTENT_TYPE = "application/octet-stream"; 
+   /** Should we try to lock the remote resource as we upload it? */
+   private boolean lock = true;
+   /** The locktoken provided or or self created when lock is true. */
+   private String locktoken = null;
+   /** The timeout to be used with locking. */
+   private int lockTimeout = 3600;
+   private String lockOwnerInfo = null;
+   /** The sets of files that will be sent to the web server. */
+   private List filesets = new ArrayList();
+   private List zipfilesets = new ArrayList();
+   /** Single file to be putted. */
+   private File file = null;
+   private boolean overwrite = false; 
+   
+   private FilterSetCollection filterSets = new FilterSetCollection();
+   private String encoding = null;
+   
+   private int countWrittenFiles = 0;
+   private int countOmittedFiles = 0;
+   
+   // configuration methods
+   /**
+    * Adds a set of files (nested fileset attribute).
+    */
+   public void addFileset(FileSet set) {
+      filesets.add(set);
+   }
+   public void setLock(boolean lock) {
+      this.lock = lock;
+   }
+
+   public void setOverwrite(boolean value) {
+      this.overwrite = value;
+   }
+   public void setLocktoken(String token) {
+      this.locktoken = token;
+      if (!this.locktoken.startsWith("opaquelocktoken:")) {
+         throw new BuildException("Invalid locktoken: " + token);
+      }
+   }
+   public FilterSet createFilterSet() {
+      FilterSet filterSet = new FilterSet();
+      this.filterSets.addFilterSet(filterSet);
+      return filterSet;
+   }
+   public void setEncoding(String enc) {
+      this.encoding = enc;
+   }
+   public void setFile(File file) {
+      this.file = file;
+   }
+   public void setTimeout(int value) {
+      if (value > 0) {
+         this.lockTimeout = value;
+      } else {
+         throw new BuildException("Invalid timeout value (Must be " +
+               "positive integer)");
+      }
+   }
+   public void setOwnerinfo(String value) {
+      this.lockOwnerInfo = value;
+   }
+   /**
+    * Does the work.
+    * 
+    * @exception BuildException Thrown in unrecoverable error.
+    */
+   public void execute() throws BuildException {
+      boolean selfCreatedLock = false;
+      
+      validate();
+
+      try {
+         log("Uploading to: " + getUrl(), ifVerbose());
+         
+         if (this.file == null) {
+            Utils.assureExistingCollection(getHttpClient(), getUrl(), this.locktoken);
+         }
+
+         // lock URL if requested and no locktoken explicitly provided
+         if (this.lock && this.locktoken == null) {
+            log("Locking " + getUrl(), ifVerbose());
+            this.locktoken = Utils.lockResource(
+                   getHttpClient(),
+                   getUrl(),
+                   this.lockOwnerInfo,
+                   DepthSupport.DEPTH_INFINITY,
+                   this.lockTimeout);
+            log("locktoken: " + this.locktoken, Project.MSG_DEBUG);
+            selfCreatedLock = true;
+         }
+         
+         if (this.file != null) {
+            // put a single file
+            if (Utils.collectionExists(getHttpClient(), getUrl())) {
+               // if the given URL is a collection put a file named as the given one
+               setUrl(assureCollectionUrl(getUrl()));
+               uploadFile(this.file.getName(), this.file);
+            } else {
+               if (getUrl().getURI().endsWith("/")) {
+                  Utils.assureExistingCollection(getHttpClient(), getUrl(), this.locktoken);
+                  uploadFile(this.file.getName(), this.file);
+               } else {
+                  HttpURL targetColl = Utils.createHttpURL(getUrl(), ".");
+                  Utils.assureExistingCollection(getHttpClient(), targetColl, this.locktoken);
+                  uploadFile(getUrl(), this.file, this.file.getName());
+               }
+            }
+         } else { 
+            for (int i = 0; i < filesets.size(); i++) {
+               FileSet fileset = (FileSet) filesets.get(i);
+               uploadFileSet(fileset);
+            }
+            for (int i = 0; i < zipfilesets.size(); i++) {
+               ZipFileSet fileset = (ZipFileSet) zipfilesets.get(i);
+               uploadZipFileSet(fileset);
+            }
+         }
+         
+         log("Puted " + this.countWrittenFiles 
+               + (this.countWrittenFiles == 1 ? " file" : " files")
+               + " to " + getUrl(),
+               this.countWrittenFiles > 0 ? Project.MSG_INFO : ifVerbose());
+
+      } 
+      catch (IOException e) {
+         throw Utils.makeBuildException("Put error!", e);
+      }
+      finally {
+         try {
+            if (this.locktoken != null && selfCreatedLock) {
+               log("Unlocking " + getUrl(), ifVerbose());
+               Utils.unlockResource(getHttpClient(),
+                                    getUrl(),
+                                    this.locktoken);
+            }
+         }
+         catch (IOException e) {
+            throw Utils.makeBuildException("Can't unlock!", e);
+         }
+      }
+   }
+   
+   protected void validate() {
+      super.validate();
+      
+      if (this.encoding == null && this.filterSets.hasFilters()) {
+         log("If filterSets are used a file encoding should be specified!", 
+               Project.MSG_WARN);
+         this.encoding = "ISO-8859-1"; // TODO what sould be the default
+      }
+      if (this.file != null && 
+            (this.filesets.size() > 0 || this.zipfilesets.size() > 0)) {
+         throw new BuildException("No filesets allowed if file is set.");
+      }
+      
+      if (this.file != null && !(this.file.isFile() && this.file.exists())) {
+         throw new BuildException("File attribute must point to en existing file");
+      } 
+      
+      if (this.file == null) {
+         try {
+            setUrl(assureCollectionUrl(getUrl()));
+         } catch (URIException e) {
+            throw new BuildException("Problem with URI: " + getUrl(), e);
+         }
+      }
+      if (this.lockOwnerInfo == null) {
+         this.lockOwnerInfo =  "ant-webdav " + getUserid();
+      }
+   }
+   
+   private void uploadFileSet(FileSet fileSet) 
+      throws IOException
+   {
+      DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
+      String basedir = scanner.getBasedir().getAbsolutePath();
+
+      // assert that all required collections does exist
+      for(Iterator i = determineRequiredDirectories(scanner); i.hasNext();) {
+         String dir = (String)i.next();
+         if (dir.equals("")) {
+            Utils.assureExistingCollection(getHttpClient(), 
+                                           getUrl(),
+                                           this.locktoken);
+         } else {
+            HttpURL collURL = Utils.createHttpURL(getUrl(), dir + "/");
+            Utils.assureExistingCollection(getHttpClient(), 
+                                           collURL,
+                                           this.locktoken);
+         }
+      }            
+      
+      // write all files
+      String[] files = scanner.getIncludedFiles();
+      for (int i = 0; i < files.length; ++i) {
+         File file = getProject().resolveFile(basedir + File.separator + files[i]);
+         uploadFile(asDavPath(files[i]), file);
+      }
+   }
+   
+   private Iterator determineRequiredDirectories(DirectoryScanner scanner) {
+      Set result = new HashSet();
+      
+      // determine all directories that contain included files
+      String[] files = scanner.getIncludedFiles();
+      for (int i = 0; i < files.length; i++) {
+         String file = asDavPath(files[i]);
+         int slashPos = file.lastIndexOf('/');
+         if (slashPos != -1) {
+            result.add(file.substring(0, slashPos));
+         }
+      }
+      
+      // determine all included directories
+      String[] dirs = scanner.getIncludedDirectories();
+      for(int i = 0; i < dirs.length; i++) {
+         result.add(asDavPath(dirs[i]));
+      }
+      
+      return result.iterator();
+   }
+   
+   /**
+    * Puts a file to a resource relative to the url attribute.
+    * @param relative path relative
+    * @param file file to be written
+    * @throws IOException
+    */
+   private void uploadFile(String relative, File file)
+      throws IOException
+   {
+      HttpURL url = Utils.createHttpURL(getUrl(), relative);
+      uploadFile(url, file, relative);
+   }
+   /**
+    * Puts a file to a given URL.
+    * @param relative for logging purposes only. 
+    */
+   private void uploadFile(HttpURL url, File file, String relative)
+      throws IOException
+   {
+
+      boolean putit = false;
+      try {
+         if (this.overwrite) {
+            putit = true;
+         } else {
+            // check last modified date (both GMT)
+            long remoteLastMod = Utils.getLastModified(getHttpClient(), url); 
+            long localLastMod = file.lastModified();
+            putit = localLastMod > remoteLastMod;
+         }
+      }
+      catch (HttpException e) {
+         switch (e.getReasonCode()) {
+            case HttpStatus.SC_NOT_FOUND:
+               putit = true;
+               break;
+            default:
+               throw Utils.makeBuildException("Can't get lastmodified!?", e);
+         }
+      }
+
+      if (putit) {
+         log("Uploading: " + relative, ifVerbose());
+         try {
+            String contentType = Mimetypes.getMimeType(file, DEFAULT_CONTENT_TYPE);
+            if (this.filterSets.hasFilters()) {
+               // TODO this part doesn't look nice
+               InputStreamReader reader = new InputStreamReader(
+                                          new FileInputStream(file), this.encoding);
+               ByteArrayOutputStream out = new ByteArrayOutputStream();
+               LineTokenizer tok = new LineTokenizer();
+               tok.setIncludeDelims(true);
+               
+               for (String l = tok.getToken(reader); l != null; l = tok.getToken(reader)) {
+                  out.write(this.filterSets.replaceTokens(l).getBytes(this.encoding));
+               }
+               Utils.putFile(getHttpClient(), url, 
+                     new ByteArrayInputStream(out.toByteArray()), 
+                     contentType, this.locktoken);
+            } else {
+               Utils.putFile(getHttpClient(), url,
+                     new FileInputStream(file), 
+                     contentType, this.locktoken);
+            }
+            this.countWrittenFiles++;
+         } 
+         catch (HttpException e) {
+            throw Utils.makeBuildException("Can't upload " + url, e);
+         }
+      } else {
+         countOmittedFiles++;
+         log("Omitted: " + relative + " (uptodate)", ifVerbose());
+      }
+   }
+   
+   private void uploadZipFileSet(ZipFileSet fileSet) 
+      throws IOException
+   {
+      DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
+      
+      ZipFile zipFile = new ZipFile(fileSet.getSrc());
+   
+      // assert that all required collections does exist
+      for(Iterator i = determineRequiredDirectories(scanner); i.hasNext();) {
+         String dir = (String)i.next();
+         if (dir.equals("")) {
+            Utils.assureExistingCollection(getHttpClient(), 
+                                           getUrl(),
+                                           this.locktoken);
+         } else {
+            HttpURL collURL = Utils.createHttpURL(getUrl(), dir + "/");
+            Utils.assureExistingCollection(getHttpClient(), 
+                                           collURL,
+                                           this.locktoken);
+         }
+      }            
+      
+      // write all files
+      String[] files = scanner.getIncludedFiles();
+      for (int i = 0; i < files.length; ++i) {
+         uploadZipEntry(Utils.createHttpURL(getUrl(), files[i]), files[i], zipFile);
+      }
+   }
+   
+   private void uploadZipEntry(HttpURL url, String name, ZipFile zipFile)
+      throws IOException
+   {
+      boolean putit = false;
+      ZipEntry entry = zipFile.getEntry(name);
+      
+      try {
+         if (this.overwrite) {
+            putit = true;
+         } else {
+            // check last modified date (both GMT)
+            long remoteLastMod = Utils.getLastModified(getHttpClient(), url); 
+            long localLastMod = entry.getTime();
+            putit = localLastMod > remoteLastMod;
+         }
+      }
+      catch (HttpException e) {
+         switch (e.getReasonCode()) {
+            case HttpStatus.SC_NOT_FOUND:
+               putit = true;
+               break;
+            default:
+               throw Utils.makeBuildException("Can't get lastmodified!?", e);
+         }
+      }
+      
+      if (putit) {
+         log("Uploading: " + name, ifVerbose());
+         String contentType = Mimetypes.getMimeType(name, DEFAULT_CONTENT_TYPE);
+         Utils.putFile(getHttpClient(), url,
+               zipFile.getInputStream(entry), 
+               contentType, this.locktoken);
+         this.countWrittenFiles++;
+      } else {
+         countOmittedFiles++;
+         log("Omitted: " + name + " (uptodate)", ifVerbose());
+      }
+   }
+   
+   private String asDavPath(String path) {
+      return path.replace('\\', '/');
+   }
+   
+   public ZipFileSet createZipfileset() {
+      ZipFileSet fileSet =  new ZipFileSet();
+      this.zipfilesets.add(fileSet);
+      return fileSet;
+   }
+   
+   public static class ZipFileSet extends AbstractFileSet {
+      private File src = null;
+      
+      public void setSrc(File src) {
+         this.src = src;
+      }
+      
+      File getSrc() {
+         if (this.src != null) {
+            return this.src;
+         } else {
+            throw new BuildException("ZipFileSet requires a src attribute!");
+         }
+      }
+
+      /* 
+       * @see org.apache.tools.ant.types.AbstractFileSet#getDirectoryScanner(org.apache.tools.ant.Project)
+       */
+      public DirectoryScanner getDirectoryScanner(Project p)
+      {
+         ZipScanner zs = new ZipScanner();
+         zs.setSrc(getSrc());
+         super.setDir(p.getBaseDir());
+         setupDirectoryScanner(zs, p);
+         zs.init();
+         return zs;
+      }
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Unlock.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Unlock.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/Unlock.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,72 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Unlock.java,v 1.3 2004/07/28 09:31:47 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:47 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import java.io.IOException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.webdav.ant.Utils;
+
+/**
+ * WebDAV task for removing locks.
+ * 
+ * @see <a href="../doc-files/tasks.htm#unlock">documentation</a> 
+ */
+public class Unlock extends WebdavTask {
+   private String locktoken = null;
+   
+   /* 
+    * @see org.apache.tools.ant.Task#execute()
+    */
+   public void execute() throws BuildException {
+      validate();
+      try {
+         log("Unlocking " + getUrl(), Project.MSG_INFO);
+         Utils.unlockResource(
+               getHttpClient(), 
+               getUrl(),
+               this.locktoken
+         );
+      }
+      catch (IOException e) {
+         throw Utils.makeBuildException("Can't unlock!", e);
+      }
+   }
+   
+   protected void validate() throws BuildException
+   {
+      super.validate();
+      
+      if (this.locktoken == null) {
+         throw new BuildException("Required locktoken attribute missing!");  
+      }
+   }
+   
+   public void setLocktoken(String token) {
+      this.locktoken = token;
+      if (!this.locktoken.startsWith("opaquelocktoken:")) {
+         throw new BuildException("Invalid locktoken: " + token);
+      }
+   }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavMatchingTask.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavMatchingTask.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavMatchingTask.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,45 @@
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavMatchingTask.java,v 1.3 2004/07/28 09:31:47 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:47 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.webdav.ant.WebdavFileSet;
+
+/**
+ * Baseclass of all WebDAV tasks that work on sets of WebDAV resources.
+ * 
+ * <p>Provides nested {@link org.apache.webdav.ant.WebdavFileSet}s.
+ * 
+ */
+public abstract class WebdavMatchingTask extends WebdavTask { 
+
+   protected List filesets = new ArrayList(); 
+
+   public void addDavfileset(WebdavFileSet set) {
+      filesets.add(set);
+   }
+   protected Iterator getFileSets() {
+      return this.filesets.iterator();
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavTask.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavTask.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavTask.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,151 @@
+// vi: set ts=3 sw=3:
+/* 
+ * $Header: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavTask.java,v 1.4.2.1 2004/08/15 13:01:15 luetzkendorf Exp $
+ * $Revision: 1.4.2.1 $
+ * $Date: 2004/08/15 13:01:15 $
+ * ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.webdav.ant.taskdefs;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.webdav.ant.Utils;
+
+/**
+ * Base class of all WebDAV tasks. Provides common attributes and the creation
+ * of the HttpClient.
+ * 
+ * <p>TODO enable proxies?
+ */
+public abstract class WebdavTask extends Task {
+   private HttpURL url = null;
+   private String userid = "";
+   private String password = "";
+   private HttpClient httpClient = null;
+   private boolean verbose = false;
+   
+   
+   protected HttpClient getHttpClient() {
+      try {
+         if (this.httpClient == null) {
+            this.httpClient = new HttpClient();
+            if (this.userid.length() > 0) {
+               this.httpClient.getState().setCredentials(
+                     null, 
+                     this.url.getHost(),
+                     new UsernamePasswordCredentials(this.userid, this.password));
+            }
+         }
+         return this.httpClient;
+      } catch (URIException e) {
+         throw new BuildException("Can't create HttpClient.", e);
+      }
+   }
+   
+   protected void validate() {
+      if (this.url == null) {
+         throw new BuildException("Required attribute url missing!");
+      }
+   }
+   
+   /**
+    * Sets the username for authentication at the WebDAV server.
+    * @param userid
+    */
+   public void setUserid(String userid) {
+      this.userid = userid;
+   }
+   protected String getUserid() {
+      return this.userid;
+   }
+   /**
+    * Sets the password for authentication at the WebDAV server.
+    * @param password
+    */
+   public void setPassword(String password) {
+      this.password = password;
+   }
+   protected String getPassword() {
+      return this.password;
+   }
+   /**
+    * Set the base URL.
+    * @param url URL for the request.
+    */
+   public void setUrl(String url) {
+       try {
+          this.url = Utils.createHttpURL(url);
+          // remove double slashes in url like /DAV/files//document.txt
+          this.url.setPath(removeDoubleSlashes(this.url.getPath()));
+       } catch (URIException e) {
+          throw new BuildException("Invalid uri!", e);
+       }
+   }
+
+   protected void setUrl(HttpURL url) {
+      this.url = url;
+   }
+   protected HttpURL getUrl() {
+      //return (HttpURL)this.url.clone(); // does not work, clone returns an URL
+      return this.url;
+   }
+   
+   public void setVerbose(boolean v) {
+      this.verbose = v;
+   }
+   /**
+    * Returns the INFO message level if the verbose attribute is set.
+    * @return Project.MSG_VERBOSE or Project.MSG_INFO
+    */
+   protected int ifVerbose() {
+      return this.verbose ? Project.MSG_INFO : Project.MSG_VERBOSE; 
+   }
+   
+   public static HttpURL assureCollectionUrl(HttpURL url)
+      throws URIException
+   {
+      if (url.getPath().endsWith("/")) {
+         return url;
+      } else {
+         HttpURL coll = Utils.createHttpURL(url, "");
+         coll.setPath(url.getPath() + "/");
+         return coll;
+      }
+   }
+   
+   static String removeDoubleSlashes(String path) {
+      if (path.indexOf("//") == -1) return path;
+      
+      StringBuffer r = new StringBuffer(path.length());
+      for(int i = 0, l = path.length(); i < l; i++) {
+         if (path.charAt(i) == '/') {
+            if (!(i > 0 && path.charAt(i-1) == '/')) {
+               r.append('/');
+            }
+         } else {
+            r.append(path.charAt(i));
+         }
+      }
+      return r.toString();
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs.properties
===================================================================
--- branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs.properties	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/ant/src/java/org/apache/webdav/ant/taskdefs.properties	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,9 @@
+davput=org.apache.webdav.ant.taskdefs.Put
+davget=org.apache.webdav.ant.taskdefs.Get
+lock=org.apache.webdav.ant.taskdefs.Lock
+unlock=org.apache.webdav.ant.taskdefs.Unlock
+mkcol=org.apache.webdav.ant.taskdefs.Mkcol
+davdelete=org.apache.webdav.ant.taskdefs.Delete
+proppatch=org.apache.webdav.ant.taskdefs.Proppatch
+davcopy=org.apache.webdav.ant.taskdefs.Copy
+davmove=org.apache.webdav.ant.taskdefs.Move
\ No newline at end of file

Added: branches/slide-webdavclient/upstream/2.1/build.xml
===================================================================
--- branches/slide-webdavclient/upstream/2.1/build.xml	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/build.xml	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,599 @@
+<project name="Slide-WebDAV-Clientlib" default="all" basedir=".">
+    <!-- =================================================================== -->
+    <!-- Load build.properties                                               -->
+    <!-- =================================================================== -->
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    <!-- =================================================================== -->
+    <!-- Compiler Options                                                    -->
+    <!-- =================================================================== -->
+    <!-- Should Java compilations set the 'debug' compiler option? -->
+    <property name="compile.debug" value="true"/>
+    <!-- Should Java compilations set the 'deprecation' compiler option? -->
+    <property name="compile.deprecation" value="true"/>
+    <!-- Should Java compilations set the 'optimize' compiler option? -->
+    <property name="compile.optimize" value="true"/>
+    <property name="build.compiler" value="modern"/>
+    <!-- =================================================================== -->
+    <!-- Project Properties                                                  -->
+    <!-- =================================================================== -->
+    <property name="name" value="Jakarta-Slide"/>
+    <property name="year" value="2004"/>
+    <property name="version" value="2.1"/>
+    <property name="project" value="jakarta-slide"/>
+    <property name="clientlib.final.name" value="${project}-webdavlib-${version}"/>
+    <property name="cmd.final.name" value="${project}-commandline-${version}"/>
+    <property name="ant.final.name" value="${project}-ant-webdav-${version}"/>
+    <property name="jca.final.name" value="${project}-jca-connector-${version}"/>
+    <property name="jca.rar.name" value="webdav-${version}.rar"/>
+    <property name="archive.src.name" value="${project}-webdavclient-src-${version}"/>
+    <property name="archive.bin.name" value="${project}-webdavclient-bin-${version}"/>
+    <property name="archive.ant.name" value="${project}-ant-webdav-bin-${version}"/>
+    <property name="archive.jca.name" value="${project}-jca-webdav-bin-${version}"/>
+    <!-- =================================================================== -->
+    <!-- Build Properties                                                    -->
+    <!-- =================================================================== -->
+    <property name="slide.build" value="./build"/>
+    <property name="clientlib.build" value="${slide.build}/clientlib"/>
+    <property name="cmd.build" value="${slide.build}/commandline"/>
+    <property name="ant.build" value="${slide.build}/ant"/>
+    <property name="jca.build" value="${slide.build}/jca"/>
+    <property name="slide.dist" value="./dist"/>
+    <property name="clientlib.dist" value="${slide.dist}"/>
+    <property name="cmd.dist" value="${slide.dist}"/>
+    <property name="ant.dist" value="${slide.dist}/ant"/>
+    <property name="jca.dist" value="${slide.dist}/jca"/>
+    <property name="clientlib.javadoc.path" value="doc/clientjavadoc"/>
+    <property name="ant.javadoc.path" value="doc/antjavadoc"/>
+    <property name="jca.javadoc.path" value="doc/jcajavadoc"/>
+    <!-- =================================================================== -->
+    <!-- Dependencies Properties                                             -->
+    <!-- =================================================================== -->
+    <property name="commons-httpclient.jar" value="lib/commons-httpclient.jar"/>
+    <property name="commons-httpclient-contrib.jar" value="lib/commons-httpclient-contrib.jar"/>
+    <property name="antlr.jar" value="lib/antlr.jar"/>
+    <property name="commons-logging.jar" value="lib/commons-logging.jar"/>
+    <property name="ant.jar" value="lib/ant.jar"/>
+    <property name="commons-transaction.jar" value="lib/commons-transaction-1.0.jar"/>
+    <property name="j2ee-spec.jar" value="lib/geronimo-spec-j2ee-1.0-M1.jar"/>
+    <property name="jdom.jar" value="lib/jdom-1.0.jar"/>
+    <property name="xml-im-exporter.jar" value="lib/xml-im-exporter1.1.jar"/>
+    <!-- =================================================================== -->
+    <!-- Classpaths                                                          -->
+    <!-- =================================================================== -->
+    <path id="clientlib.classpath">
+        <pathelement location="${commons-httpclient.jar}"/>
+        <pathelement location="${jdom.jar}"/>
+        <pathelement location="${xml-im-exporter.jar}"/>
+    </path>
+    <path id="cmd.classpath">
+        <pathelement location="${antlr.jar}"/>
+        <pathelement location="${commons-httpclient.jar}"/>
+        <pathelement location="${commons-httpclient-contrib.jar}"/>
+        <pathelement location="${clientlib.build}/classes"/>
+    </path>
+    <path id="ant.classpath">
+        <pathelement location="${commons-httpclient.jar}"/>
+        <pathelement location="${clientlib.build}/classes"/>
+        <pathelement location="${ant.jar}"/>
+    </path>
+    <path id="jca.classpath">
+        <pathelement location="${clientlib.build}/classes"/>
+        <pathelement location="${commons-httpclient.jar}"/>
+        <pathelement location="${commons-transaction.jar}"/>
+        <pathelement location="${j2ee-spec.jar}"/>
+    </path>
+    <!-- =================================================================== -->
+    <!-- Prepare build                                                       -->
+    <!-- =================================================================== -->
+    <target name="prepare-build" depends="">
+        <mkdir dir="${slide.build}"/>
+        <mkdir dir="${clientlib.build}"/>
+        <mkdir dir="${clientlib.build}/classes"/>
+        <mkdir dir="${clientlib.build}/${clientlib.javadoc.path}"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Prepare commandline build                                           -->
+    <!-- =================================================================== -->
+    <target name="prepare-build-cmd" depends="prepare-build">
+        <mkdir dir="${cmd.build}"/>
+        <mkdir dir="${cmd.build}/classes"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Prepare ant build                                                   -->
+    <!-- =================================================================== -->
+    <target name="prepare-build-ant" depends="prepare-build">
+        <mkdir dir="${ant.build}"/>
+        <mkdir dir="${ant.build}/classes"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Prepare jca build                                                   -->
+    <!-- =================================================================== -->
+    <target name="prepare-build-jca" depends="prepare-build">
+        <mkdir dir="${jca.build}"/>
+        <mkdir dir="${jca.build}/classes"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Prepare dist                                                        -->
+    <!-- =================================================================== -->
+    <target name="prepare-dist" depends="">
+        <mkdir dir="${slide.dist}"/>
+        <mkdir dir="${clientlib.dist}"/>
+        <mkdir dir="${clientlib.dist}/lib"/>
+        <mkdir dir="${clientlib.dist}/${clientlib.javadoc.path}"/>
+        <mkdir dir="${slide.dist}/etc"/>
+        <filter token="VERSION" value="${version}"/>
+        <copy todir="${slide.dist}/etc" filtering="true">
+            <fileset dir="./etc" includes="*.MF"/>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Prepare commandline dist                                            -->
+    <!-- =================================================================== -->
+    <target name="prepare-dist-cmd" depends="prepare-dist">
+        <mkdir dir="${cmd.dist}"/>
+        <mkdir dir="${cmd.dist}/lib"/>
+        <mkdir dir="${cmd.dist}/bin"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Build All : Main, Doc and JavaDoc                                   -->
+    <!-- =================================================================== -->
+    <target name="all" depends="clean,dist" 
+        description="Delete previous build and make distribution"/>
+    <!-- =================================================================== -->
+    <!-- Make distribution                                                   -->
+    <!-- =================================================================== -->
+    <target name="dist" depends="dist-clientlib,dist-cmd,dist-ant,dist-jca,jca-example-war" 
+        description="Makes distribution"/>
+    <!-- =================================================================== -->
+    <!-- Clean build and distribution directories of the DAV client          -->
+    <!-- =================================================================== -->
+    <target name="clean">
+        <delete dir="${slide.build}"/>
+        <delete dir="${slide.dist}"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Build Slide WebDAV client lib                                       -->
+    <!-- =================================================================== -->
+    <target name="build-clientlib" depends="prepare-build" description="Build the WebDAV client lib">
+        <echo message="Building Slide WebDAV client lib"/>
+        <javac srcdir="clientlib/src/java" destdir="${clientlib.build}/classes" 
+         debug="${compile.debug}" deprecation="${compile.deprecation}" 
+         optimize="${compile.optimize}" excludes="**/CVS/**">
+            <classpath refid="clientlib.classpath"/>
+        </javac>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Build Slide commandline client                                      -->
+    <!-- =================================================================== -->
+    <target name="detect.antlr">
+        <available property="antlr.present" classname="antlr.Tool"/>
+    </target>
+    <target name="warn.if.no.antlr" unless="antlr.present">
+        <echo level="warning" message="Missing antlr in classpath"/>
+    </target>
+    <target name="generate" depends="warn.if.no.antlr" if="antlr.present">
+        <echo message="Generating classes from Client.g"/>
+        <antlr target="commandline/src/java/org/apache/webdav/cmd/Client.g" 
+      		 outputdirectory="commandline/src/java/org/apache/webdav/cmd"/>
+    </target>
+    <target name="build-cmd" depends="prepare-build-cmd,build-clientlib,detect.antlr,generate" 
+	    description="Build the commandline client">
+        <echo message="Building Slide commandline client"/>
+        <mkdir dir="${cmd.build}/src"/>
+        <filter token="VERSION" value="${version}"/>
+        <copy todir="${cmd.build}/src" filtering="true">
+            <fileset dir="commandline/src/java" includes="**/Slide.java"/>
+        </copy>
+        <javac srcdir="commandline/src/java" destdir="${cmd.build}/classes" 
+	       debug="${compile.debug}" deprecation="${compile.deprecation}" 
+	       optimize="${compile.optimize}" excludes="**/Slide.java">
+            <classpath refid="cmd.classpath"/>
+        </javac>
+        <javac srcdir="${cmd.build}/src" destdir="${cmd.build}/classes" 
+	       debug="${compile.debug}" deprecation="${compile.deprecation}" 
+	       optimize="${compile.optimize}" includes="**/Slide.java">
+            <classpath refid="cmd.classpath"/>
+        </javac>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Build WebDAV ant tasks                                              -->
+    <!-- =================================================================== -->
+    <target name="build-ant" depends="prepare-build-ant,build-clientlib"
+        description="Build WebDAV ant tasks">
+        <echo message="Building WebDAV ant tasks"/>
+        <javac srcdir="ant/src/java" destdir="${ant.build}/classes" 
+	       debug="${compile.debug}" deprecation="${compile.deprecation}" 
+	       optimize="${compile.optimize}" excludes="**/*Test.java">
+            <classpath refid="ant.classpath"/>
+        </javac>
+        <copy todir="${ant.build}/classes">
+          <fileset dir="ant/src/java">
+            <include name="**/*.properties"/>
+            <include name="**/antlib.xml"/>
+          </fileset>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Build WebDAV JCA connector                                          -->
+    <!-- =================================================================== -->
+    <target name="build-jca" depends="prepare-build-jca,build-clientlib"
+        description="Build WebDAV JCA connector">
+        <echo message="Building WebDAV JCA connector"/>
+        <javac srcdir="connector/src/java" destdir="${jca.build}/classes" 
+	       debug="${compile.debug}" deprecation="${compile.deprecation}" 
+	       optimize="${compile.optimize}" excludes="**/*Test.java">
+            <classpath refid="jca.classpath"/>
+        </javac>
+        <copy todir="${jca.build}/classes">
+          <fileset dir="connector/src/java"/>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Javadoc of the WebDAV client                                        -->
+    <!-- =================================================================== -->
+    <target name="javadoc-clientlib" depends="prepare-build" description="Create WebDAV client javadocs" unless="skip.javadoc">
+        <property name="copyright" value="2004"/>
+        <javadoc sourcepath="clientlib/src/java" destdir="${clientlib.build}/${clientlib.javadoc.path}" 
+		 doctitle="Slide ${version} WebDAV Client JavaDoc" windowtitle="Slide WebDAV Client Javadoc" 
+		 package="true" noindex="false" author="true" version="true" packagenames="org.apache.webdav.lib.*">
+            <classpath refid="clientlib.classpath"/>
+            <link href="http://jakarta.apache.org/commons/httpclient/apidocs/"/>
+        </javadoc>
+    </target>
+    
+    <target name="javadoc-ant" depends="prepare-build" description="Create ant tasks javadocs" unless="skip.javadoc">
+        <property name="copyright" value="2004"/>
+        <javadoc sourcepath="ant/src/java" destdir="${ant.build}/${ant.javadoc.path}" 
+           doctitle="Slide ${version} WebDAV ant tasks JavaDoc" windowtitle="Slide WebDAV ant tasks Javadoc" 
+           package="true" noindex="false" author="true" version="true" packagenames="org.apache.webdav.ant.*">
+            <classpath refid="ant.classpath"/>
+            <link href="http://jakarta.apache.org/commons/httpclient/apidocs/"/>
+        </javadoc>
+    </target>
+
+    <target name="javadoc-jca" depends="prepare-build" description="Create JCA connector javadocs" unless="skip.javadoc">
+        <property name="copyright" value="2004"/>
+        <javadoc sourcepath="connector/src/java" destdir="${jca.build}/${jca.javadoc.path}" 
+           doctitle="Slide ${version} WebDAV JCA connector JavaDoc" windowtitle="Slide WebDAV JCA connector Javadoc" 
+           package="true" noindex="false" author="true" version="true" packagenames="org.apache.webdav.connector.*">
+            <classpath refid="jca.classpath"/>
+            <link href="http://jakarta.apache.org/commons/httpclient/apidocs/"/>
+        </javadoc>
+    </target>
+
+    <!-- =================================================================== -->
+    <!-- Build a WebDAV client distribution                                     -->
+    <!-- =================================================================== -->
+    <target name="dist-clientlib" depends="build-clientlib,prepare-dist,javadoc-clientlib"
+	    description="Jar WebDAV client lib and copy required jar libs">
+        <copy todir="${clientlib.dist}/lib">
+            <fileset dir="lib">
+                <include name="xml-im-exporter*.*"/>
+                <include name="commons-*.jar"/>
+                <include name="jdom*.*"/>
+            </fileset>
+        </copy>
+        <jar jarfile="${clientlib.dist}/lib/${clientlib.final.name}.jar"
+             basedir="${clientlib.build}/classes"
+             manifest="${slide.dist}/etc/MANIFEST.MF">
+             <metainf file="./LICENSE"/>
+       </jar>
+        <copy todir="${cmd.dist}">
+            <fileset dir=".">
+                <include name="LICENSE"/>
+                <include name="README"/>
+                <include name="NOTICE"/>
+            </fileset>
+        </copy>
+        <copy todir="${clientlib.dist}/${clientlib.javadoc.path}">
+            <fileset dir="${clientlib.build}/${clientlib.javadoc.path}"/>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Build a commandline client distribution                             -->
+    <!-- =================================================================== -->
+    <target name="dist-cmd" depends="build-cmd,dist-clientlib,prepare-dist-cmd"
+	    description="Distribute commandline client">
+        <jar jarfile="${cmd.dist}/lib/${cmd.final.name}.jar"
+             basedir="${cmd.build}/classes"
+             manifest="${slide.dist}/etc/MANIFEST.MF">
+             <metainf file="./LICENSE"/>
+        </jar>
+        <copy todir="${cmd.dist}">
+            <fileset dir=".">
+                <include name="LICENSE"/>
+                <include name="README"/>
+                <include name="NOTICE"/>
+            </fileset>
+        </copy>
+        <copy todir="${cmd.dist}/lib">
+            <fileset dir="lib">
+                <include name="commons-*.jar"/>
+                <include name="antlr*.*"/>
+            </fileset>
+        </copy>
+        <copy todir="${cmd.dist}/bin">
+            <fileset dir="commandline/src/bin">
+                <include name="**/*.bat"/>
+                <include name="**/*.sh"/>
+            </fileset>
+        </copy>
+        <chmod dir="${cmd.dist}/bin" perm="+x" includes="**/*.sh"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Build the WebDAV ant task distribution                              -->
+    <!-- =================================================================== -->
+    <target name="dist-ant" depends="build-ant,dist-clientlib"
+	    description="Distribute Ant WebDAV task library">
+        <mkdir dir="${ant.dist}"/>
+        <jar jarfile="${ant.dist}/${ant.final.name}.jar"
+             basedir="${ant.build}/classes"
+             manifest="${slide.dist}/etc/MANIFEST.MF">
+             <metainf file="./LICENSE"/>
+        </jar>
+        <copy todir="${ant.dist}">
+            <fileset dir=".">
+                <include name="LICENSE"/>
+                <include name="README"/>
+                <include name="NOTICE"/>
+            </fileset>
+            <fileset file="${commons-httpclient.jar}"/>
+            <fileset file="${commons-logging.jar}"/>
+            <fileset file="${jdom.jar}"/>
+            <fileset file="lib/jdom.license"/>
+            <fileset file="${clientlib.dist}/lib/${clientlib.final.name}.jar"/>
+        </copy>
+        <copy file="ant/src/java/org/apache/webdav/ant/taskdefs.properties" 
+          tofile="${ant.dist}/webdav.taskdefs"/>
+        <copy file="ant/src/java/org/apache/webdav/ant/doc-files/tasks.htm" 
+          tofile="${ant.dist}/ant-webdav.html"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Build the WebDAV JCA connector distribution                         -->
+    <!-- =================================================================== -->
+    <target name="dist-jca" depends="build-jca,dist-clientlib"
+	    description="Distribute WebDAV JCA connector">
+        <mkdir dir="${jca.dist}"/>
+        <jar jarfile="${jca.dist}/${jca.final.name}.jar"
+             basedir="${jca.build}/classes"
+             manifest="${slide.dist}/etc/MANIFEST.MF">
+             <metainf file="./LICENSE"/>
+        </jar>
+        <copy todir="${jca.dist}">
+            <fileset dir=".">
+                <include name="LICENSE"/>
+                <include name="README"/>
+                <include name="NOTICE"/>
+            </fileset>
+            <fileset file="${commons-httpclient.jar}"/>
+            <fileset file="${commons-logging.jar}"/>
+            <fileset file="${clientlib.dist}/lib/${clientlib.final.name}.jar"/>
+            <fileset file="${commons-transaction.jar}"/>
+        </copy>
+        <mkdir dir="${jca.dist}/rar"/>
+        <zip zipfile="${jca.dist}/rar/${jca.rar.name}">
+            <zipfileset dir="${basedir}">
+                <include name="LICENSE"/>
+                <include name="NOTICE"/>
+            </zipfileset>
+            <zipfileset file="${commons-httpclient.jar}"/>
+            <zipfileset file="${commons-logging.jar}"/>
+            <zipfileset file="${clientlib.dist}/lib/${clientlib.final.name}.jar"/>
+            <zipfileset file="${commons-transaction.jar}"/>
+            <zipfileset file="${jca.dist}/${jca.final.name}.jar"/>
+            <zipfileset dir="${basedir}/etc/conf/connector" prefix="META-INF" includes="ra.xml"/>
+        </zip>
+        <copy todir="${jca.dist}/rar">
+            <fileset dir="${basedir}/etc/conf/connector/jboss"/>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Build the WebDAV JCA connector example web archive                  -->
+    <!-- =================================================================== -->
+    <target name="jca-example-war" depends="dist-jca"
+	    description="Create connector example war">
+        <javac destdir="${jca.build}/classes"
+          debug="${compile.debug}"
+          deprecation="${compile.deprecation}"
+          optimize="${compile.optimize}" >
+          <src path="${basedir}/connector/example/src/java"/>
+          <classpath refid="jca.classpath" />
+        </javac>
+        <zip zipfile="${jca.dist}/connector-example.war">
+            <zipfileset dir="${jca.build}/classes/connector" prefix="WEB-INF/classes/connector" includes="TestServlet.class"/>
+            <zipfileset dir="${basedir}/connector/example/src/conf" prefix="WEB-INF"/>
+        </zip>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Deploy WebDAV JCA connector and example war to JBoss                -->
+    <!-- =================================================================== -->
+    <target name="deploy-jca-exmaple-jboss" depends="jca-example-war" description="Deploys connector rar and example war to JBoss">
+        <copy todir="${jboss.deploy.dir}">
+            <fileset dir="${jca.dist}/rar"/>
+            <fileset file="${jca.dist}/connector-example.war"/>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Copy all files for the src archive                                  -->
+    <!-- =================================================================== -->
+    <target name="package-src-prepare" depends="dist-cmd">
+        <mkdir dir="${slide.dist}/${archive.src.name}"/>
+        <copy todir="${slide.dist}/${archive.src.name}">
+            <fileset dir=".">
+                <include name="clientlib/**"/>
+                <include name="commandline/**"/>
+                <include name="ant/**"/>
+                <include name="connector/**"/>
+                <include name="etc/**"/>
+                <include name="lib/**"/>
+                <include name="LICENSE"/>
+                <include name="NOTICE"/>
+                <include name="README"/>
+                <include name="build.xml"/>
+            </fileset>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages the source code with ZIP                                   -->
+    <!-- =================================================================== -->
+    <target name="package-src-zip" depends="package-src-prepare">
+        <zip zipfile="${slide.dist}/${archive.src.name}.zip">
+	<zipfileset dir="${slide.dist}/${archive.src.name}" 
+		    prefix="${archive.src.name}" includes="**"/>
+        </zip>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages the source code with TAR-GZIP                              -->
+    <!-- =================================================================== -->
+    <target name="package-src-tgz" depends="package-src-prepare">
+    	<tar tarfile="${slide.dist}/${archive.src.name}.tar" longfile="gnu">
+            <tarfileset dir="${slide.dist}">
+                <include name="${archive.src.name}/**"/>
+            </tarfileset>
+        </tar>
+	<gzip zipfile="${slide.dist}/${archive.src.name}.tar.gz" 
+	      src="${slide.dist}/${archive.src.name}.tar"/>
+        <delete file="${slide.dist}/${archive.src.name}.tar"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages the source code with ZIP and TAR-GZIP                      -->
+    <!-- =================================================================== -->
+    <target name="package-src-all" depends="package-src-zip, package-src-tgz"
+	    description="Package src distribution as ZIP and TAR-GZIP">
+        <delete dir="${slide.dist}/${archive.src.name}"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Copy all files for the bin archive                                  -->
+    <!-- =================================================================== -->
+    <target name="package-bin-prepare" depends="dist-cmd">
+        <mkdir dir="${slide.dist}/${archive.bin.name}"/>
+        <copy todir="${slide.dist}/${archive.bin.name}">
+            <fileset dir="${slide.dist}">
+                <include name="bin/**"/>
+                <include name="doc/**"/>
+                <include name="etc/**"/>
+                <include name="lib/**"/>
+            </fileset>
+        </copy>
+        <copy todir="${slide.dist}/${archive.bin.name}">
+            <fileset dir=".">
+                <include name="LICENSE"/>
+                <include name="README"/>
+                <include name="NOTICE"/>
+            </fileset>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages ZIP                                                        -->
+    <!-- =================================================================== -->
+    <target name="package-bin-zip" depends="package-bin-prepare">
+        <zip zipfile="${slide.dist}/${archive.bin.name}.zip">
+	<zipfileset dir="${slide.dist}/${archive.bin.name}" 
+		    prefix="${archive.bin.name}" includes="**"/>
+        </zip>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages TAR-GZIP                                                   -->
+    <!-- =================================================================== -->
+    <target name="package-bin-tgz" depends="package-bin-prepare">
+    	<tar tarfile="${slide.dist}/${archive.bin.name}.tar" longfile="gnu">
+            <tarfileset dir="${slide.dist}">
+                <include name="${archive.bin.name}/**"/>
+            </tarfileset>
+        </tar>
+	<gzip zipfile="${slide.dist}/${archive.bin.name}.tar.gz" 
+	      src="${slide.dist}/${archive.bin.name}.tar"/>
+        <delete file="${slide.dist}/${archive.bin.name}.tar"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages with ZIP and TAR-GZIP                                      -->
+    <!-- =================================================================== -->
+    <target name="package-bin-all" depends="package-bin-zip, package-bin-tgz"
+	    description="Package binary distribution as ZIP and TAR-GZIP">
+        <delete dir="${slide.dist}/${archive.bin.name}"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Copy all files for the jca bin archive                              -->
+    <!-- =================================================================== -->
+    <target name="package-jca-prepare" depends="dist-jca">
+        <mkdir dir="${slide.dist}/${archive.jca.name}"/>
+        <copy todir="${slide.dist}/${archive.jca.name}">
+            <fileset dir="${jca.dist}"/>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages jca bin dist as ZIP                                        -->
+    <!-- =================================================================== -->
+    <target name="package-jca-zip" depends="package-jca-prepare">
+        <zip zipfile="${slide.dist}/${archive.jca.name}.zip">
+        <zipfileset dir="${slide.dist}/${archive.jca.name}" 
+            prefix="${archive.jca.name}" includes="**"/>
+        </zip>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages jca bin dist as TAR-GZIP                                   -->
+    <!-- =================================================================== -->
+    <target name="package-jca-tgz" depends="package-jca-prepare">
+    	<tar tarfile="${slide.dist}/${archive.jca.name}.tar" longfile="gnu">
+            <tarfileset dir="${slide.dist}">
+                <include name="${archive.jca.name}/**"/>
+            </tarfileset>
+        </tar>
+        <gzip zipfile="${slide.dist}/${archive.jca.name}.tar.gz" 
+            src="${slide.dist}/${archive.jca.name}.tar"/>
+        <delete file="${slide.dist}/${archive.jca.name}.tar"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages jca bin with ZIP and TAR-GZIP                              -->
+    <!-- =================================================================== -->
+    <target name="package-jca-all" depends="package-jca-zip, package-jca-tgz"
+	    description="Package binary jca distribution as ZIP and TAR-GZIP">
+        <delete dir="${slide.dist}/${archive.jca.name}"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Copy all files for the ant bin archive                              -->
+    <!-- =================================================================== -->
+    <target name="package-ant-prepare" depends="dist-ant">
+        <mkdir dir="${slide.dist}/${archive.ant.name}"/>
+        <copy todir="${slide.dist}/${archive.ant.name}">
+            <fileset dir="${ant.dist}"/>
+        </copy>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages ant bin dist as ZIP                                        -->
+    <!-- =================================================================== -->
+    <target name="package-ant-zip" depends="package-ant-prepare">
+        <zip zipfile="${slide.dist}/${archive.ant.name}.zip">
+        <zipfileset dir="${slide.dist}/${archive.ant.name}" 
+            prefix="${archive.ant.name}" includes="**"/>
+        </zip>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages ant bin dist as TAR-GZIP                                   -->
+    <!-- =================================================================== -->
+    <target name="package-ant-tgz" depends="package-ant-prepare">
+    	<tar tarfile="${slide.dist}/${archive.ant.name}.tar" longfile="gnu">
+            <tarfileset dir="${slide.dist}">
+                <include name="${archive.ant.name}/**"/>
+            </tarfileset>
+        </tar>
+        <gzip zipfile="${slide.dist}/${archive.ant.name}.tar.gz" 
+            src="${slide.dist}/${archive.ant.name}.tar"/>
+        <delete file="${slide.dist}/${archive.ant.name}.tar"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages ant bin with ZIP and TAR-GZIP                              -->
+    <!-- =================================================================== -->
+    <target name="package-ant-all" depends="package-ant-zip, package-ant-tgz"
+	    description="Package binary ant distribution as ZIP and TAR-GZIP">
+        <delete dir="${slide.dist}/${archive.ant.name}"/>
+    </target>
+    <!-- =================================================================== -->
+    <!-- Packages jca, ant and client distributions with ZIP and TAR-GZIP    -->
+    <!-- =================================================================== -->
+    <target name="release"
+        depends="package-ant-all, package-jca-all, package-src-all, package-bin-all"
+    	description="Packages ant, jca and client distributions with ZIP and TAR-GZIP"/>
+</project>
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Ace.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Ace.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Ace.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,290 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/Ace.java,v 1.4.2.1 2004/11/23 12:57:16 unico Exp $
+ * $Revision: 1.4.2.1 $
+ * $Date: 2004/11/23 12:57:16 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+/**
+ * This interface models a DAV Access control entry.
+ *
+ * @version $Revision: 1.4.2.1 $
+ */
+public class Ace {
+    private static final PropertyName DEFAULT_PROPERTY
+        = new PropertyName("DAV:", "owner");
+
+    // ----------------------------------------------------------- Constructors
+
+
+    public Ace(String principal) {
+        this.principal = principal;
+    }
+
+
+    public Ace(String principal, boolean negative, boolean protectedAce,
+               boolean inherited, String inheritedFrom) {
+        this(principal);
+        this.negative = negative;
+        this.protectedAce = protectedAce;
+        this.inherited = inherited;
+        this.inheritedFrom = inheritedFrom;
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Principal.
+     */
+    protected String principal;
+
+
+    /**
+     * Negative (deny) flag.
+     */
+    protected boolean negative = false;
+
+
+    /**
+     * Privileges this ACE grants or denies.
+     */
+    protected Vector privileges = new Vector();
+
+
+    /**
+     * Protected.
+     */
+    protected boolean protectedAce = false;
+
+
+    /**
+     * Inherited.
+     */
+    protected boolean inherited = false;
+
+
+    /**
+     * Inherited from.
+     */
+    protected String inheritedFrom = null;
+
+
+    /**
+     * Property. Only used if principal.equals("property").
+     */
+    protected PropertyName property = null;
+
+
+    // ------------------------------------------------------------- Properties
+
+
+    /**
+     * Principal accessor.
+     */
+    public String getPrincipal() {
+        return principal;
+    }
+
+
+    /**
+     * Principal mutator.
+     */
+    public void setPrincipal(String principal) {
+        this.principal = principal;
+    }
+
+
+    /**
+     * Negative accessor.
+     */
+    public boolean isNegative() {
+        return (negative);
+    }
+
+
+    /**
+     * Negative mutator.
+     */
+    public void setNegative(boolean negative) {
+        this.negative = negative;
+    }
+
+
+    /**
+     * Protected accessor.
+     */
+    public boolean isProtected() {
+        return (protectedAce);
+    }
+
+
+    /**
+     * Protected mutator.
+     */
+    public void setProtected(boolean protectedAce) {
+        this.protectedAce = protectedAce;
+    }
+
+
+    /**
+     * Inherited accessor.
+     */
+    public boolean isInherited() {
+        return (inherited);
+    }
+
+
+    /**
+     * Inherited mutator.
+     */
+    public void setInherited(boolean inherited) {
+        this.inherited = inherited;
+    }
+
+
+    /**
+     * Inherited from accessor.
+     */
+    public String getInheritedFrom() {
+        return inheritedFrom;
+    }
+
+
+    /**
+     * Inherited from mutator.
+     */
+    public void setInheritedFrom(String inheritedFrom) {
+        this.inheritedFrom = inheritedFrom;
+    }
+
+
+    /**
+     * Property accessor.
+     *
+     * @return the property to compare if the pricipal is "property".
+     *         If the property has not been set or has been set to null
+     *         return "DAV:owner".
+     * @see #setProperty(PropertyName)
+     */
+    public PropertyName getProperty() {
+        return property != null ? property : DEFAULT_PROPERTY;
+    }
+
+
+    /**
+     * Property mutator.
+     *
+     * @param property the property to compare if the principal is "property"
+     * @see #getProperty()
+     */
+    public void setProperty(PropertyName property) {
+        this.property = property;
+    }
+
+
+    /**
+     * Enumerate privileges.
+     */
+    public Enumeration enumeratePrivileges() {
+        return privileges.elements();
+    }
+
+
+    /**
+     * Add privilege.
+     */
+    public void addPrivilege(Privilege privilege) {
+        privileges.addElement(privilege);
+    }
+
+
+    /**
+     * Remove privilege.
+     */
+    public boolean removePrivilege(Privilege privilege) {
+        return privileges.removeElement(privilege);
+    }
+
+
+    /**
+     * Clear privileges.
+     */
+    public void clearPrivileges() {
+        privileges.clear();
+    }
+
+    public int hashCode() {
+        return toString().hashCode() 
+            + (getPrincipal().equals("property") 
+                    ? getProperty().hashCode() 
+                    : 0);
+    }
+
+    public boolean equals(Object o) {
+        if (o != null && o instanceof Ace) {
+            Ace otherAce = (Ace) o;
+            boolean equals = true;
+            equals &= isNegative() == otherAce.isNegative();
+            equals &= isProtected() == otherAce.isProtected();
+            equals &= isInherited() == otherAce.isInherited();
+            if (equals && isInherited()) {
+                equals = getInheritedFrom().equals(otherAce.getInheritedFrom());
+            }
+            equals &= getPrincipal().equals(otherAce.getPrincipal());
+            if (equals && getPrincipal().equals("property")) {
+                equals = getProperty().equals(otherAce.getProperty());
+            }
+            if (equals) {
+                Enumeration privileges = enumeratePrivileges();
+                Enumeration otherPrivileges = otherAce.enumeratePrivileges();
+                while (equals && privileges.hasMoreElements()) {
+                    equals = otherPrivileges.hasMoreElements();
+                    // Only access otherPrivileges if there are more elements
+                    if (equals)
+                    {
+                        equals = privileges.nextElement().equals(otherPrivileges.nextElement());
+                    }
+                }
+                if (equals)
+                {
+                    // No more elements in privileges, so there should be no
+                    // more elements in otherPrivileges
+                    equals = !otherPrivileges.hasMoreElements();
+                }
+            }
+            return equals;
+        }
+        return false;
+    }
+
+    public String toString() {
+        return ((!isNegative()?"granted":"denied") +
+        " to " + getPrincipal() +
+        " (" + (isProtected()?"protected":"not protected") + ")" +
+        " (" + (isInherited()? ("inherited from '" + getInheritedFrom() + "'"): "not inherited") +")");
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/BaseProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/BaseProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/BaseProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,192 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/BaseProperty.java,v 1.5 2004/08/02 15:45:49 unico Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/08/02 15:45:49 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import java.io.StringWriter;
+import java.util.List;
+
+import org.apache.webdav.lib.util.DOMUtils;
+import org.apache.webdav.lib.util.PropertyWriter;
+import org.jdom.input.DOMBuilder;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+import org.w3c.dom.Element;
+
+/**
+ * This interface models a DAV property.
+ *
+ * @version $Revision: 1.5 $
+ */
+public class BaseProperty implements Property {
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the property.
+     */
+    public BaseProperty(ResponseEntity response, Element element) {
+        this.element = element;
+        this.response = response;
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Associated response entity.
+     */
+    protected ResponseEntity response;
+
+
+    /**
+     * Associated node element.
+     */
+    protected Element element;
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * This method returns the full name of the property.  Thus, for example,
+     * calling this method on a property such as
+     * <code>&lt;D:getlastmodified&gt;Tue, 05 Dec 2000
+     * 05:25:02&lt;/D:getlastmodified&gt;</code> returns
+     * <code>D:getlastmodified</code>.
+     */
+    public String getName() {
+        return element.getTagName();
+    }
+
+
+    /**
+     * This method returns the local name of the property.  Thus, for example,
+     * calling this method on a property such as
+     * <code>&lt;D:getlastmodified&gt;Tue, 05 Dec 2000
+     * 05:25:02&lt;/D:getlastmodified&gt;</code> returns
+     * <code>getlastmodified</code>.
+     */
+    public String getLocalName() {
+        return DOMUtils.getElementLocalName(element);
+    }
+
+
+    /**
+     * This method returns the namespace of the property.  Thus, for example,
+     * calling this method on a property such as
+     * <code>&lt;D:getlastmodified&gt;Tue, 05 Dec 2000
+     * 05:25:02&lt;/D:getlastmodified&gt;</code> returns
+     * <code>DAV:</code>.
+     */
+    public String getNamespaceURI() {
+        return DOMUtils.getElementNamespaceURI(element);
+    }
+
+
+    /**
+     * This method returns the property as a DOM Element.
+     */
+    public Element getElement() {
+        return element;
+    }
+
+
+    /**
+     * This method returns the value of the property.  Thus, for example,
+     * calling this method on a property such as
+     * <code>&lt;D:getlastmodified&gt;Tue, 05 Dec 2000
+     * 05:25:02&lt;/D:getlastmodified&gt;</code> returns
+     * <code>Tue, 05 Dec 2000 05:25:02</code>.<br/>
+     * Note: Mixed content (text and xml together) will not be returned
+     * accurately.
+     */
+    public String getPropertyAsString() {
+    	StringBuffer text = new StringBuffer();
+        DOMBuilder builder = new DOMBuilder();
+        XMLOutputter outputter = new XMLOutputter( Format.getPrettyFormat() );
+        org.jdom.Element e = builder.build( element );
+        List children = e.getChildren();
+        if ( children.size() > 0 ) {
+        	text.append( outputter.outputString( children ) );
+        }
+        text.append( e.getTextTrim() );
+        return text.toString();
+    }
+
+
+    /**
+     * This method returns the status code associated with the property.
+     */
+    public int getStatusCode() {
+        // A response can have multiple propstat elements each with
+        // their own status, return the (mandatory) status before asking
+        // the resoponse for its status
+
+        //  <multistatus xmlns=\DAV:\>
+        //    <response>
+        //      <href>/slide/files/</href>
+        //      <propstat>
+        //        <prop><displayname>files</displayname></prop>
+        //        <status>HTTP/1.1 200 OK</status>
+        //      </propstat>
+        //      <propstat>
+        //        <prop><displayname>files</displayname></prop>
+        //        <status>HTTP/1.1 200 OK</status>
+        //      </propstat>
+        //    </response>
+        //  </multistatus>
+
+        Element status = DOMUtils.getFirstElement(element.getParentNode().getParentNode(),"DAV:", "status");
+        if (status != null) {
+            return DOMUtils.parseStatus(DOMUtils.getTextValue(status));
+        }
+
+        return response.getStatusCode();
+    }
+
+
+    /**
+     * This method returns URL file path of the resource to which this
+     * property belongs.
+     */
+    public String getOwningURL() {
+        return response.getHref();
+    }
+
+
+    /**
+     * Get a String representation of the property.
+     */
+    public String toString () {
+        StringWriter tmp = new StringWriter();
+        PropertyWriter propertyWriter = new PropertyWriter(tmp, true);
+        propertyWriter.print(element);
+        return tmp.getBuffer().toString();
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Constants.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Constants.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Constants.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,42 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/Constants.java,v 1.3 2004/07/28 09:31:40 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:40 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+
+/**
+ * Constants used by the WebDAV client library.
+ *
+ * @version $Revision: 1.3 $
+ */
+public class Constants {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    public static final String DAV = "DAV:";
+    public static final String SLIDE = "http://jakarta.apache.org/slide/";
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Lock.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Lock.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Lock.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,243 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/Lock.java,v 1.3.2.1 2004/10/11 08:17:19 luetzkendorf Exp $
+ * $Revision: 1.3.2.1 $
+ * $Date: 2004/10/11 08:17:19 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import org.apache.webdav.lib.methods.DepthSupport;
+
+/**
+ * This class represents a lock on a resource.
+ *
+ * @version $Revision: 1.3.2.1 $
+ */
+public class Lock {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "activelock";
+
+
+    /**
+     * The write constant in the locktype.
+     */
+    public static final int TYPE_WRITE = 0;
+    
+    /**
+     * Type indicating lock is a transaction lock.
+     */
+    public static final int TYPE_TRANSACTION = 1;
+
+
+    /**
+     * The exclusive constant in the lockscope.
+     */
+    public static final int SCOPE_EXCLUSIVE = 0;
+
+
+    /**
+     * The shared constant in the lockscope.
+     */
+    public static final int SCOPE_SHARED = 1;
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the lockentry.
+     */
+    public Lock(int lockScope, int lockType) {
+        this.lockScope = lockScope;
+        this.lockType = lockType;
+    }
+
+
+    /**
+     * Default constructor for the activelock.
+     */
+    public Lock(int lockScope, int lockType, int depth, String owner,
+                int timeout, String lockToken) {
+        this.lockScope = lockScope;
+        this.lockType = lockType;
+        this.depth = depth;
+        this.owner = owner;
+        this.timeout = timeout;
+        this.lockToken = lockToken;
+    }
+
+    public Lock(int lockScope, int lockType, int depth, String owner,
+            int timeout, String lockToken, String principalUrl) {
+	    this.lockScope = lockScope;
+	    this.lockType = lockType;
+	    this.depth = depth;
+	    this.owner = owner;
+	    this.timeout = timeout;
+	    this.lockToken = lockToken;
+	    this.principalUrl = principalUrl;
+	}
+
+    /**
+     * Default constructor for the activelock.
+     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
+     */
+    public Lock(int lockScope, int lockType, int depth, String owner,
+                long timeout, String lockToken) {
+        this(lockScope, lockType, depth, owner, (int) timeout, lockToken);
+    }
+
+
+    // ------------------------------------------------------ Instance Variable
+
+
+    protected int lockScope = -1;
+
+
+    protected int lockType = -1;
+
+
+    protected int depth = -1;
+
+
+    protected String owner = null;
+
+
+    protected int timeout = -1;
+
+
+    protected String lockToken = null;
+    
+    protected String principalUrl = null;
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Get whether a lock is an exclusive lock, or a shared lock.
+     *
+     * @return The lock scope.  If it's not set, it could be -1.
+     */
+    public int getLockScope() {
+        return lockScope;
+    }
+
+
+    /**
+     * Get the access type of a lock.
+     *
+     * @return The lock type. If it's not set, it could be -1.
+     */
+    public int getLockType() {
+        return lockType;
+    }
+
+
+    /**
+     * Get the value of the depth.
+     *
+     * @return The depth vlaue. If it's not set, it could be -1.
+     */
+    public int getDepth() {
+        return depth;
+    }
+
+
+    /**
+     * Get information about the principal taking out a lock.
+     *
+     * @return The owner.
+     */
+    public String getOwner() {
+        return owner;
+    }
+    
+    /**
+     * Get the <code>principal-URL</code> property of the lock, if one.
+     * @return an URL as String
+     */
+    public String getPrincipalUrl() {
+        return principalUrl;
+    }
+
+
+    /**
+     * Get the timeout associated with a lock.
+     *
+     * @return The timeout vlaue. If it's not set, it could be -1.
+     */
+    public int getTimeout() {
+        return timeout;
+    }
+
+
+    /**
+     * Get the access type of a lock.
+     *
+     * @return The lock token.
+     */
+    public String getLockToken() {
+        return lockToken;
+    }
+
+    public String toString() {
+        StringBuffer tmp=new StringBuffer();
+
+        if (lockScope==Lock.SCOPE_EXCLUSIVE) {
+            tmp.append("Exclusive");
+        }
+        else if (lockScope==Lock.SCOPE_SHARED) {
+            tmp.append("Shared");
+        }
+
+        if (lockType==Lock.TYPE_WRITE) {
+            tmp.append(" write lock");
+        }
+
+        if (depth==DepthSupport.DEPTH_INFINITY) {
+            tmp.append(" depth:infinity");
+        }
+        else if (depth==-1) {
+            // unknown
+        }
+        else {
+            tmp.append(" depth:" + depth);
+        }
+
+        if (owner!=null)
+            tmp.append(" owner:" + owner);
+
+        if (timeout!=-1)
+            tmp.append(" timeout:" + timeout);
+
+        if (lockToken!=null)
+            tmp.append(" token:" + lockToken);
+
+        return tmp.toString();
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/NotificationListener.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/NotificationListener.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/NotificationListener.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,600 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/NotificationListener.java,v 1.8.2.2 2004/12/22 18:21:30 dflorey Exp $
+ * $Revision: 1.8.2.2 $
+ * $Date: 2004/12/22 18:21:30 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.protocol.Protocol;
+import org.apache.webdav.lib.methods.DepthSupport;
+import org.apache.webdav.lib.methods.XMLResponseMethodBase;
+import org.apache.webdav.lib.util.XMLPrinter;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.AttributesImpl;
+
+import de.zeigermann.xml.simpleImporter.DefaultSimpleImportHandler;
+import de.zeigermann.xml.simpleImporter.SimpleImporter;
+import de.zeigermann.xml.simpleImporter.SimplePath;
+
+/**
+ * The NotificationListener class encapsulates all methods that are
+ * required for dealing with WebDAV notifications.
+ * It implements poll and push based notification handling.
+ * 
+ */
+public class NotificationListener {
+    private static Logger logger = Logger.getLogger(NotificationListener.class.getName());
+
+    protected static final Timer timer = new Timer();
+
+    private final static int CONNECTION_TIMEOUT = 30000;
+    
+    private String notificationHost, repositoryHost, repositoryDomain;
+    private int notificationPort, repositoryPort;
+    private Protocol protocol;
+    private Credentials credentials;
+    private boolean udp = true;
+    
+    private List subscribers = new ArrayList();
+    private String subscribersAsString;
+
+    /**
+     * 
+     * @param host The ip-address or hostname on which the udp or http-server is running (e.g. "myhost.mydomain.mytld")
+     * @param port The port where the udp or http-server is listening on (e.g. 4444)
+     * @param repositoryHost The ip-adress or hostname of the WebDAV-repository
+     * @param repositoryPort The port of the WebDAV-repository (e.g. 8080)
+     * @param protocol The protocol that should be used to connect to the WebDAV-repository (http or https) 
+     * @param credentials The credentials which are used to connect to the WebDAV-repository 
+     * @param repositoryDomain The repository domain (e.g. "/slide")
+     * @param pollInterval The poll interval that will be used if no notifications are revieved via UDP/TCP (in milliseconds)
+     * @param udp If set to true, UDP server will be started, otherwise TCP server (must match the repository notification mode)
+     */
+    public NotificationListener(String host, int port, String repositoryHost, int repositoryPort, Protocol protocol, Credentials credentials, String repositoryDomain, int pollInterval, boolean udp) {
+    	this.credentials = credentials;
+    	this.notificationHost = host;
+        this.notificationPort = port;
+        this.repositoryHost = repositoryHost;
+        this.repositoryPort = repositoryPort;
+        this.protocol = protocol;
+        this.repositoryDomain = repositoryDomain;
+        this.udp = udp;
+        
+        if ( udp ) {
+            Thread listenerThread = new Thread(new Runnable() {
+                public void run() {
+                    DatagramSocket serverSocket = null;
+                    try {
+                        serverSocket = new DatagramSocket(notificationPort);
+                        while (true) {
+                            byte[] buf = new byte[256];
+                            DatagramPacket packet = new DatagramPacket(buf, buf.length);
+                            serverSocket.receive(packet);
+                            BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(buf)));
+                            parseNotification(reader);
+                        }
+                    } catch (IOException e) {
+                        logger.log(Level.SEVERE, "Error while listening to socket", e);
+                    }
+                }
+            });
+            listenerThread.setDaemon(true);
+            listenerThread.start();
+        } else {
+            Thread listenerThread = new Thread(new Runnable() {
+                public void run() {
+                    ServerSocket serverSocket = null;
+                    try {
+                        serverSocket = new ServerSocket(notificationPort);
+                        while (true) {
+                            new ConnectionThread(serverSocket.accept()).start();
+                        }
+                    } catch (IOException e) {
+                        logger.log(Level.SEVERE, "Error while listening to socket", e);
+                    }
+                }
+            });
+            listenerThread.setDaemon(true);
+            listenerThread.start();
+        }
+
+        TimerTask poll = new TimerTask() {
+            public void run() {
+                if ( subscribersAsString != null ) {
+                    poll(subscribersAsString);
+                }
+            }
+        };
+        timer.schedule(poll, pollInterval, pollInterval);
+    }
+
+    /**
+     * Registers a Subscriber with the remote server. 
+     * 
+     * @param method the "notification type", determines for what events do you
+     *               want do subscribe. one of  "Update", "Update/newmember",
+     *               "Delete", "Move".
+     * @param uri the resource for that you subscribe
+     * @param depth the depth of the collection tree that you want to observe
+     * @param lifetime the duration for that you want to observe (in seconds)
+     * @param notificationDelay the time the server waits before it sends a notify
+     *                          message to the host provided in the constructor
+     *                          (in seconds)
+     * @param listener the Subscriber that is called on incomming notifications
+     * @param credentials credentials for authentication on the server observed
+     * @return boolean true if subscription succeeded, false if subscription failed
+     *
+     * @see WebdavResource#subscribeMethod
+     * @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_webdav_subscribe.asp
+     */
+    public boolean subscribe(String method, String uri, int depth, int lifetime, int notificationDelay, Subscriber listener, Credentials credentials) {
+        SubscribeMethod subscribeMethod = new SubscribeMethod(repositoryDomain+uri);
+        subscribeMethod.addRequestHeader(SubscribeMethod.H_NOTIFICATION_TYPE, method);
+        if ( udp ) {
+        	subscribeMethod.addRequestHeader(SubscribeMethod.H_CALL_BACK, "httpu://"+notificationHost+":"+notificationPort);
+        } else {
+        	subscribeMethod.addRequestHeader(SubscribeMethod.H_CALL_BACK, "http://"+notificationHost+":"+notificationPort);
+        }
+        subscribeMethod.addRequestHeader(SubscribeMethod.H_NOTIFICATION_DELAY, String.valueOf(notificationDelay));
+        subscribeMethod.addRequestHeader(SubscribeMethod.H_SUBSCRIPTION_LIFETIME, String.valueOf(lifetime));
+        subscribeMethod.addRequestHeader(SubscribeMethod.H_DEPTH, ((depth == DepthSupport.DEPTH_INFINITY ) ? "infinity" : String.valueOf(depth)));
+        try {
+            subscribeMethod.setDoAuthentication(true);
+            HttpState httpState = new HttpState();
+            httpState.setCredentials(null, repositoryHost, credentials);
+            HttpConnection httpConnection = new HttpConnection(repositoryHost, repositoryPort, protocol);
+            httpConnection.setConnectionTimeout(CONNECTION_TIMEOUT);
+            int state = subscribeMethod.execute(httpState, httpConnection);
+            if ( state == HttpStatus.SC_OK ) {
+                String subscriptionId = subscribeMethod.getResponseHeader(SubscribeMethod.H_SUBSCRIPTION_ID).getValue();
+                logger.log(Level.INFO, "Received subscription id="+subscriptionId+", listener: "+listener);
+                int id = Integer.valueOf(subscriptionId).intValue();
+                synchronized ( subscribers ) {
+                    subscribers.add(new Subscription(id, uri, listener));
+                }
+                if ( subscribersAsString == null ) {
+                    subscribersAsString = String.valueOf(id);
+                } else {
+                    subscribersAsString = subscribersAsString + ", "+String.valueOf(id);
+                }
+                return true;
+            } else {
+                logger.log(Level.SEVERE, "Subscription for uri='"+uri+"' failed. State: "+state);
+            }
+        } catch (IOException e) {
+            logger.log(Level.SEVERE, "Subscription of listener '"+listener+"' failed!", e);
+        }
+        return false;
+    }
+
+    public boolean unsubscribe(String uri, Subscriber listener, Credentials credentials) {
+        UnsubscribeMethod unsubscribeMethod = new UnsubscribeMethod(repositoryDomain+uri);
+        synchronized ( subscribers ) {
+            for ( Iterator i = subscribers.iterator(); i.hasNext(); ) {
+                Subscription subscription = (Subscription)i.next();
+                if ( subscription.getSubscriber().equals(listener) ) {
+                    String id = String.valueOf(subscription.getId());
+                    unsubscribeMethod.addRequestHeader(UnsubscribeMethod.H_SUBSCRIPTION_ID, id);
+                    try {
+                        unsubscribeMethod.setDoAuthentication(true);
+                        HttpState httpState = new HttpState();
+                        httpState.setCredentials(null, repositoryHost, credentials);
+                        HttpConnection httpConnection = new HttpConnection(repositoryHost, repositoryPort, protocol);
+                        httpConnection.setConnectionTimeout(CONNECTION_TIMEOUT);
+                        int state = unsubscribeMethod.execute(httpState, httpConnection);
+                        if ( state == HttpStatus.SC_OK ) {
+                            i.remove();
+                            return true;
+                        } else {
+                            logger.log(Level.SEVERE, "Unsubscription failed. State: "+state);
+                        }
+                    } catch (IOException e) {
+                        logger.log(Level.SEVERE, "Unsubscription of listener '"+listener+"' failed!", e);
+                    }
+                }
+            }
+        }
+        logger.log(Level.SEVERE, "Listener not unsubscribed!");
+		return false;
+    }
+
+    public void fireEvent(Map information, Credentials credentials) throws IOException  {
+        EventMethod eventMethod = new EventMethod(repositoryDomain);
+        eventMethod.addEvent(new Event(information));
+        fireEvent(eventMethod, credentials);
+    }
+
+    public void fireVetoableEvent(Map information, Credentials credentials) throws IOException  {
+        EventMethod eventMethod = new EventMethod(repositoryDomain);
+        eventMethod.addVetoableEvent(new Event(information));
+        fireEvent(eventMethod, credentials);
+    }
+
+    protected void fireEvent(EventMethod eventMethod, Credentials credentials) throws IOException {
+        eventMethod.setDoAuthentication(true);
+        HttpState httpState = new HttpState();
+        httpState.setCredentials(null, repositoryHost, credentials);
+        int state = eventMethod.execute(httpState, new HttpConnection(repositoryHost, repositoryPort, protocol));
+        if ( state == HttpStatus.SC_OK ) {
+        } else {
+            logger.log(Level.SEVERE, "Event failed. State: "+state);
+        }
+    }
+
+    protected void fireEvent(int id, Map information) {
+        for ( Iterator i = subscribers.iterator(); i.hasNext(); ) {
+            Subscription subscriber = (Subscription)i.next();
+            if ( subscriber.getId() == id ) {
+                subscriber.fireEvent(information);
+                break;
+            }
+        }
+    }
+
+    protected void poll(String notifiedSubscribers) {
+        StringBuffer registeredSubscribers = new StringBuffer(256);
+        StringTokenizer tokenizer = new StringTokenizer(notifiedSubscribers, ",");
+        boolean first = true;
+        while ( tokenizer.hasMoreTokens() ) {
+            String subscriber = tokenizer.nextToken().trim();
+            if ( isRegistered(Integer.valueOf(subscriber).intValue()) ) {
+                if ( !first ) registeredSubscribers.append(',');
+                registeredSubscribers.append(subscriber);
+                first = false;
+            }
+        }
+        if ( !first ) {
+            String pollSubscribers = registeredSubscribers.toString();
+            logger.log(Level.INFO, "Poll for subscribers: "+pollSubscribers);
+            PollMethod pollMethod = new PollMethod(repositoryDomain+"/");
+            pollMethod.addRequestHeader(SubscribeMethod.H_SUBSCRIPTION_ID, pollSubscribers);
+            try {
+                pollMethod.setDoAuthentication(true);
+                HttpState httpState = new HttpState();
+                httpState.setCredentials(null, repositoryHost, credentials);
+	            HttpConnection httpConnection = new HttpConnection(repositoryHost, repositoryPort, protocol);
+	            httpConnection.setConnectionTimeout(CONNECTION_TIMEOUT);
+                int state = pollMethod.execute(httpState, httpConnection);
+                if ( state == HttpStatus.SC_MULTI_STATUS ) {
+                    List events = pollMethod.getEvents();
+                    for ( Iterator i = events.iterator(); i.hasNext(); ) {
+                        Event event = (Event)i.next();
+                        fireEvent(event.getId(), event.getInformation());
+                    }
+                } else {
+                    logger.log(Level.SEVERE, "Poll failed. State: "+state);
+                }
+            } catch (IOException e) {
+                logger.log(Level.SEVERE, "Poll for subscribers '"+subscribers+"' failed!");
+            }
+        }
+    }
+    
+    private boolean isRegistered(int id) {
+        for ( Iterator i = subscribers.iterator(); i.hasNext(); ) {
+            Subscription subscription = (Subscription)i.next();
+            if ( subscription.getId() == id ) return true;
+        }
+        return false;
+    }
+
+    private void parseNotification(BufferedReader reader) throws IOException {
+        String inputLine;
+        if ( (inputLine = reader.readLine()) != null ) {
+            if ( inputLine.startsWith("NOTIFY") ) {
+                while ( (inputLine = reader.readLine()) != null ) {
+                    if ( inputLine.startsWith(SubscribeMethod.H_SUBSCRIPTION_ID_RESPONSE) ) {
+                        String subscribers = inputLine.substring(SubscribeMethod.H_SUBSCRIPTION_ID_RESPONSE.length()+2);
+                        logger.log(Level.INFO, "Notification received for subscribers: "+subscribers);
+                        poll(subscribers);
+                    }
+                }
+            }
+        }
+        reader.close();
+    }
+
+    public class Event {
+        int id;
+        Map information = new HashMap();
+
+        public Event() {
+        }
+
+        public Event(int id) {
+            this.id = id;
+        }
+
+        public Event(Map information) {
+            this.information = information;
+        }
+
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        public int getId() {
+            return id;
+        }
+
+        public void addInformation(String key, String value) {
+            information.put(key, value);
+        }
+
+        public Map getInformation() {
+            return information;
+        }
+    }
+
+    private class Subscription {
+        private int id;
+		private String uri;
+        private Subscriber subscriber;
+
+        public Subscription(int id, String uri, Subscriber subscriber) {
+            this.id = id;
+            this.uri = uri;
+            this.subscriber = subscriber;
+        }
+
+        public void fireEvent(Map information) {
+            subscriber.notify(uri, information);
+        }
+	
+		public Subscriber getSubscriber() {
+			return subscriber;
+		}
+			
+        public int getId() {
+            return id;
+        }
+    }
+
+    private class ConnectionThread extends Thread {
+        private Socket socket = null;
+
+        public ConnectionThread(Socket socket) {
+            super("ConnectionThread");
+            this.socket = socket;
+        }
+
+        public void run() {
+            try {
+                BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+                parseNotification(in);
+                socket.close();
+            } catch (IOException e) {
+                logger.log(Level.SEVERE, "Error while listening to connection", e);
+            }
+        }
+    }
+
+    private class PollMethod extends PutMethod {
+        public static final String NAME = "POLL";
+
+        protected final static String E_SUBSCRIPTION_ID = "subscriptionID";
+        protected final static String E_LISTENER = "li";
+        protected final static String E_FIRE_EVENTS = "fire-events";
+        protected final static String E_EVENT = "event";
+        protected final static String E_VETOABLE_EVENT = "vetoable-event";
+        protected final static String E_INFORMATION = "information";
+        protected final static String E_STATUS = "status";
+
+        public final static String A_NAME = "name";
+
+        protected final static String SUBSCRIPTION= ":"+E_SUBSCRIPTION_ID;
+        protected final static String ID = E_LISTENER;
+        protected final static String EVENT = ":"+E_EVENT;
+        protected final static String INFORMATION = ":"+E_INFORMATION;
+        protected final static String STATUS = ":"+E_STATUS;
+        protected final static String STATUS_OK = "HTTP/1.1 200 OK";
+
+        public PollMethod() {
+        }
+
+        public PollMethod(String uri) {
+            super(uri);
+        }
+
+        public String getName() {
+            return NAME;
+        }
+
+        public List getEvents() {
+            List events = new ArrayList();
+            try {
+                SimpleImporter importer = new SimpleImporter();
+                importer.setIncludeLeadingCDataIntoStartElementCallback(true);
+                ResponseHandler handler = new ResponseHandler(events);
+                importer.addSimpleImportHandler(handler);
+                importer.parse(new InputSource(getResponseBodyAsStream()));
+                return handler.getEvents();
+            } catch (Throwable exception) {
+                logger.log(Level.SEVERE, "Exception while polling for new events: ", exception);
+            }
+            return events;
+        }
+
+        private class ResponseHandler extends DefaultSimpleImportHandler {
+            private List events;
+            private int id;
+            private Event event;
+            private boolean parseEvents;
+
+            public ResponseHandler(List listeners) {
+                this.events = listeners;
+            }
+
+            public List getEvents() {
+                return events;
+            }
+
+            public void startElement(SimplePath path, String name, AttributesImpl attributes, String leadingCDdata) {
+                if (path.matches(STATUS)) {
+                    parseEvents = false;
+                    if ( leadingCDdata.equals(STATUS_OK) ) parseEvents = true;
+                }
+                if ( parseEvents ) {
+                    if (path.matches(SUBSCRIPTION+"/"+ID)) {
+                        id = Integer.valueOf(leadingCDdata).intValue();
+                        event = new Event(id);
+                        events.add(event);
+                    } else if (path.matches(INFORMATION)) {
+                        String key = attributes.getValue(PollMethod.A_NAME);
+                        String value = leadingCDdata;
+                        event.addInformation(key, value);
+                    }
+                }
+            }
+        }
+    }
+
+    private class SubscribeMethod extends PutMethod {
+        public static final String NAME = "SUBSCRIBE";
+
+        public final static String H_NOTIFICATION_TYPE = "Notification-type";
+        public final static String H_NOTIFICATION_DELAY = "Notification-delay";
+        public final static String H_SUBSCRIPTION_LIFETIME = "Subscription-lifetime";
+        public final static String H_SUBSCRIPTION_ID = "Subscription-ID";
+        public final static String H_SUBSCRIPTION_ID_RESPONSE = "Subscription-id";
+        public final static String H_CALL_BACK = "Call-back";
+        public final static String H_DEPTH = "Depth";
+        
+        public SubscribeMethod(String uri) {
+            super(uri);
+        }
+
+        public String getName() {
+            return NAME;
+        }
+    }
+
+    private class UnsubscribeMethod extends PutMethod {
+        public static final String NAME = "UNSUBSCRIBE";
+
+        public final static String H_SUBSCRIPTION_ID = "Subscription-id";
+        
+        public UnsubscribeMethod(String uri) {
+            super(uri);
+        }
+
+        public String getName() {
+            return NAME;
+        }
+    }
+
+    private class EventMethod extends XMLResponseMethodBase {
+        protected final static String E_FIRE_EVENTS = "fire-events";
+        protected final static String E_EVENT = "event";
+        protected final static String E_VETOABLE_EVENT = "vetoable-event";
+        protected final static String E_INFORMATION = "information";
+        protected final static String E_STATUS = "status";
+
+        protected final static String A_INFORMATION_KEY = "name";
+
+        public static final String NAME = "EVENT";
+
+        private List vetoableEvents = new ArrayList();
+        private List events = new ArrayList();
+
+        public EventMethod(String uri) {
+            super(uri);
+        }
+
+        public void addEvent(Event event) {
+            events.add(event);
+        }
+
+        public void addVetoableEvent(Event event) {
+            vetoableEvents.add(event);
+        }
+
+        public String getName() {
+            return NAME;
+        }
+
+        /**
+         * DAV requests that contain a body must override this function to
+         * generate that body.
+         *
+         * <p>The default behavior simply returns an empty body.</p>
+         */
+        protected String generateRequestBody() {
+            XMLPrinter printer = new XMLPrinter();
+            printer.writeXMLHeader();
+            printer.writeElement("D", "DAV:", E_FIRE_EVENTS, XMLPrinter.OPENING);
+            for ( Iterator i = events.iterator(); i.hasNext(); ) {
+                Event event = (Event)i.next();
+                printer.writeElement("D", E_EVENT, XMLPrinter.OPENING);
+                Map information = event.getInformation();
+                for ( Iterator j = information.entrySet().iterator(); j.hasNext(); ) {
+                    Map.Entry entry = (Map.Entry)j.next();
+                    String name = (String)entry.getKey();
+                    String value = (String)entry.getValue();
+                    printer.writeElement("D", E_INFORMATION+" "+A_INFORMATION_KEY+"=\""+name+"\"", XMLPrinter.OPENING);
+                    printer.writeText(value);
+                    printer.writeElement("D", E_INFORMATION, XMLPrinter.CLOSING);
+                }
+                printer.writeElement("D", E_EVENT, XMLPrinter.CLOSING);
+            }
+            for ( Iterator i = vetoableEvents.iterator(); i.hasNext(); ) {
+                Event event = (Event)i.next();
+                printer.writeElement("D", E_VETOABLE_EVENT, XMLPrinter.OPENING);
+                Map information = event.getInformation();
+                for ( Iterator j = information.entrySet().iterator(); j.hasNext(); ) {
+                    Map.Entry entry = (Map.Entry)j.next();
+                    String name = (String)entry.getKey();
+                    String value = (String)entry.getValue();
+                    printer.writeElement("D", E_INFORMATION+" "+A_INFORMATION_KEY+"=\""+name+"\"", XMLPrinter.OPENING);
+                    printer.writeText(value);
+                    printer.writeElement("D", E_INFORMATION, XMLPrinter.CLOSING);
+                }
+                printer.writeElement("D", E_VETOABLE_EVENT, XMLPrinter.CLOSING);
+            }
+            printer.writeElement("D", E_FIRE_EVENTS, XMLPrinter.CLOSING);
+            return printer.toString();
+        }
+    }
+}
\ No newline at end of file

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Privilege.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Privilege.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Privilege.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,140 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/Privilege.java,v 1.3 2004/07/28 09:31:40 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:40 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+
+
+/**
+ * This interface models a DAV ACE privilege.
+ *
+ * @version $Revision: 1.3 $
+ */
+public class Privilege {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    // Standard WebDAV ACP privileges
+    public static final Privilege ALL =
+        new Privilege(Constants.DAV, "all", null);
+    public static final Privilege READ =
+        new Privilege(Constants.DAV, "read", null);
+    public static final Privilege WRITE =
+        new Privilege(Constants.DAV, "write", null);
+    public static final Privilege READ_ACL =
+        new Privilege(Constants.DAV, "read-acl", null);
+    public static final Privilege WRITE_ACL =
+        new Privilege(Constants.DAV, "write-acl", null);
+
+    // TODO: Add the Slide specific privileges ?
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    public Privilege(String namespace, String name, String parameter) {
+        this.namespace = namespace;
+        this.name = name;
+        this.parameter = parameter;
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Custom privilege namespace.
+     */
+    protected String namespace;
+
+
+    /**
+     * Custom privilege element name.
+     */
+    protected String name;
+
+
+    /**
+     * Additional parameter (usually, an URI).
+     */
+    protected String parameter;
+
+
+    // ------------------------------------------------------------- Properties
+
+
+    /**
+     * Namespace accessor.
+     */
+    public String getNamespace() {
+        return namespace;
+    }
+
+
+    /**
+     * Name accessor.
+     */
+    public String getName() {
+        return name;
+    }
+
+
+    /**
+     * Parameter accessor.
+     */
+    public String getParameter() {
+        return parameter;
+    }
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Equals.
+     */
+    public boolean equals(Object obj) {
+        if ((obj == null) || !(obj instanceof Privilege)) {
+            return false;
+        } else {
+            if (this == obj)
+                return true;
+            Privilege privilege = (Privilege) obj;
+            if ((namespace.equals(privilege.getNamespace()))
+                && (name.equals(privilege.getName()))) {
+                if (parameter == null) {
+                    if (privilege.getParameter() == null)
+                        return true;
+                } else {
+                    if (privilege.getParameter() != null)
+                        return (parameter.equals(privilege.getParameter()));
+                }
+            }
+        }
+        return false;
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Property.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Property.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Property.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,86 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/Property.java,v 1.3 2004/07/28 09:31:39 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:39 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import org.w3c.dom.Element;
+
+/**
+ * This interface models a DAV property.
+ *
+ * @version $Revision: 1.3 $
+ */
+public interface Property {
+
+    /**
+     * This method returns the full name of the property.  Thus, for example,
+     * calling this method on a property such as
+     * <code>&lt;D:getlastmodified&gt;Tue, 05 Dec 2000
+     * 05:25:02&lt;/D:getlastmodified&gt;</code> returns
+     * <code>D:getlastmodified</code>.
+     */
+    public String getName();
+
+    /**
+     * This method returns the local name of the property.  Thus, for example,
+     * calling this method on a property such as
+     * <code>&lt;D:getlastmodified&gt;Tue, 05 Dec 2000
+     * 05:25:02&lt;/D:getlastmodified&gt;</code> returns
+     * <code>getlastmodified</code>.
+     */
+    public String getLocalName();
+
+    /**
+     * This method returns the namespace of the property.  Thus, for example,
+     * calling this method on a property such as
+     * <code>&lt;D:getlastmodified&gt;Tue, 05 Dec 2000
+     * 05:25:02&lt;/D:getlastmodified&gt;</code> returns
+     * <code>DAV:</code>.
+     */
+    public String getNamespaceURI();
+
+    /**
+     * This method returns the property as a DOM Element.
+     */
+    public Element getElement();
+
+    /**
+     * This method returns the namespace of the property.  Thus, for example,
+     * calling this method on a property such as
+     * <code>&lt;D:getlastmodified&gt;Tue, 05 Dec 2000
+     * 05:25:02&lt;/D:getlastmodified&gt;</code> returns
+     * <code>Tue, 05 Dec 2000 05:25:02</code>.
+     */
+    public String getPropertyAsString();
+
+    /**
+     * This method returns the status code associated with the property.
+     */
+    public int getStatusCode();
+
+    /**
+     * This method returns URL file path of the resource to which this
+     * property belongs.
+     */
+    public String getOwningURL();
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/PropertyName.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/PropertyName.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/PropertyName.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,40 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/PropertyName.java,v 1.4 2004/08/02 15:45:49 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:49 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import org.apache.webdav.lib.util.QName;
+
+/**
+ * This class models a DAV property name.
+ *
+ * @version $Revision: 1.4 $
+ */
+public class PropertyName extends QName
+{
+    public PropertyName(String namespaceURI, String localName)
+    {
+        super(namespaceURI, localName);
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/ResponseEntity.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/ResponseEntity.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/ResponseEntity.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,83 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/ResponseEntity.java,v 1.3 2004/07/28 09:31:39 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:39 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+package org.apache.webdav.lib;
+
+
+import java.util.Enumeration;
+
+/**
+ * The interface for the response entity body formats that provide
+ * operations for the XML response documents.
+ *
+ * @version $Revision: 1.3 $ $Date: 2004/07/28 09:31:39 $
+ */
+
+public interface ResponseEntity {
+
+    /**
+     * Get the href string in the response XML element.
+     *
+     * Each response XML element MUST contain an href XML element that gives
+     * the URI of the resource on which the properties in the prop XML
+     * element are defined.
+     *
+     * @return the href string.
+     */
+    public String getHref();
+
+
+    /**
+     * Get the status code for use with 207 (Multi-Status).
+     *
+     * Unless explicitly prohibited any 2/3/4/5xx series
+     * response code may be used in a Multi-Status response.
+     *
+     * @return the status code.
+     */
+    public int getStatusCode();
+
+
+    /**
+     * Get the properties in the response XML element.
+     *
+     * @return the properties.
+     */
+    public Enumeration getProperties();
+
+    /**
+     * Get the properties in the response XML element.
+     *
+     * @return the properties.
+     */
+    public Enumeration getHistories();
+
+    /**
+     * Get the properties in the response XML element.
+     *
+     * @return the properties.
+     */
+    public Enumeration getWorkspaces();
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Subscriber.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Subscriber.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Subscriber.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,38 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/Subscriber.java,v 1.2 2004/07/28 09:31:39 ib Exp $
+ * $Revision: 1.2 $
+ * $Date: 2004/07/28 09:31:39 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import java.util.Map;
+
+/**
+ * The Subscriber interface
+ * 
+ */
+public interface Subscriber {
+    public final static String URI = "uri";
+    public final static String SOURCE_URI = "source-uri";
+    public final static String TARGET_URI = "target-uri";
+
+    public void notify(String uri, Map information);
+}
\ No newline at end of file

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Subscription.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Subscription.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/Subscription.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,58 @@
+// vi: set ts=3 sw=3:
+package org.apache.webdav.lib;
+
+/**
+ * Object that holds information about a single WebDAV subscription.
+ * 
+ * @see org.apache.webdav.lib.WebdavResource#subscribeMethod(String, String, String, long, int, long)
+ */
+public class Subscription
+{
+   public static final String UPDATE_NOTIFICATION = "update";
+   public static final String NEW_MEMBER_NOTIFICATION = "update/newmember";
+   public static final String DELETE_NOTIFICATION = "delete";
+   public static final String MOVE_NOTIFICATION = "move";
+   
+   private int id;
+   private long lifetime;
+   private String callback;
+   private String contentLocation;
+   private String notificationType;
+   private String path;
+   
+   public Subscription(String path, int id, String callback, long lifetime, 
+         String contentLocation, String notificationType)
+   {
+      this.path = path;
+      this.id = id;
+      this.callback = callback;
+      this.lifetime = lifetime;
+      this.contentLocation = contentLocation;
+      this.notificationType = notificationType;
+   }
+   
+   public String getCallback()
+   {
+      return callback;
+   }
+   public String getContentLocation()
+   {
+      return contentLocation;
+   }
+   public int getId()
+   {
+      return id;
+   }
+   public long getLifetime()
+   {
+      return lifetime;
+   }
+   public String getNotificationType()
+   {
+      return notificationType;
+   }
+   public String getPath() 
+   {
+      return path;
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavException.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavException.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavException.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,46 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavException.java,v 1.3 2004/07/28 09:31:39 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:31:39 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+/**
+ * Wraps other Exceptions into RuntimeException. It indicates
+ * some server access problems or implementation shortcomings
+ *
+ */
+public class WebdavException extends RuntimeException {
+
+  /** Method not implemented for Webdav */
+  public static final String NOT_IMPLEMENTED = "this method is not implemented";
+
+  /** Method not implemented for Webdav */
+  public static final String RELATIVE_FILE = "this method is not supported with relative paths";
+
+  public WebdavException(Exception e) {
+    super(e.getMessage());
+  }
+
+  public WebdavException(String msg) {
+    super(msg);
+  }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavFile.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavFile.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavFile.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,502 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavFile.java,v 1.5 2004/07/28 09:31:39 ib Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/07/28 09:31:39 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.HttpsURL;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.util.URIUtil;
+
+/**
+ * Implements a file for WebDav
+ *
+ */
+public class WebdavFile extends File {
+
+  /** Directory separator */
+  public static final char davSeparatorChar = '/';
+  /** Directory separator */
+  public static final String davSeparator = String.valueOf(davSeparatorChar);
+
+  // WebdavFile may be absolute or relative
+  private HttpURL httpUrl = null;
+  private String relPath = null;
+
+  /**
+   * @param parent directory
+   * @param child element in parent
+   */
+  public WebdavFile(WebdavFile parent, String child) throws URIException {
+    this(
+      parent.getAbsolutePath() + davSeparator + child,
+      parent.getUser(),
+      parent.getPass()
+    );
+  }
+
+  /**
+   * @param pathname complete path to element
+   * @param user user name
+   * @param pass password
+   */
+  public WebdavFile(String pathname, String user, String pass) throws URIException {
+    this(new HttpURL(user, pass, null, -1, pathname));
+  }
+
+  /**
+   * @param url file url
+   * @param user user name
+   * @param pass password
+   */
+  public WebdavFile(URL url, String user, String pass) throws URIException {
+    this(url.getProtocol().equals("https")
+        ? new HttpsURL(user, pass, url.getHost(), url.getPort(), url.getPath())
+        : new HttpURL(user, pass, url.getHost(), url.getPort(), url.getPath()));
+  }
+  /**
+   * @param parent parent name
+   * @param child name of element in parent
+   * @param user user name
+   * @param pass password
+   */
+  public WebdavFile(String parent, String child, String user, String pass) throws URIException {
+    this(parent + davSeparator + child, user, pass);
+  }
+
+  /**
+   * @param httpUrl Webdav URL
+   */
+  public WebdavFile(HttpURL httpUrl) throws URIException {
+    super(httpUrl.getURI());
+    this.httpUrl = httpUrl;
+  }
+
+  /**
+   * A WebdavFile with a relative file. Hence nobody keeps track
+   * of a "working directory" the resulting object is only
+   * a container for a String (pathname). You cannot do anything
+   * usefull with an instance created this way
+   */
+  public WebdavFile(String aPath) {
+    super(aPath);
+    relPath = aPath;
+  }
+
+  private WebdavResource createRes() {
+    try {
+      if(httpUrl==null)
+        throw new WebdavException(WebdavException.RELATIVE_FILE);
+      return new WebdavResource(httpUrl);
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    }
+  }
+
+  private void closeRes(WebdavResource res) {
+    try {
+      if(res!=null)
+        res.close();
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    }
+  }
+
+  private File [] toFileArray(List fileList) {
+    File files [] = new File [fileList.size()];
+    Iterator it = fileList.iterator();
+    for(int i=0; i<files.length; i++)
+      files[i] = (WebdavFile)it.next();
+    return files;
+  }
+
+  public String getUser() throws URIException {
+    if(relPath!=null)
+      return null;
+    return httpUrl.getUser();
+  }
+
+  public String getPass() throws URIException {
+    if(relPath!=null)
+      return null;
+    return httpUrl.getPassword();
+  }
+
+  public String getName() {
+    if(relPath!=null)
+      return relPath;
+    String escapedPath = httpUrl.getEscapedPath();
+    String escapedName =
+        URIUtil.getName(escapedPath.endsWith("/")
+                        ? escapedPath.substring(0, escapedPath.length() - 1)
+                        : escapedPath);
+    try {
+        return URIUtil.decode(escapedName);
+    } catch (URIException e) {
+        return escapedName;
+    }
+  }
+
+  public String getParent() {
+    if(relPath!=null)
+      return null;
+    String escapedPath = httpUrl.getEscapedPath();
+    String parent = escapedPath.substring(
+        0, escapedPath.lastIndexOf('/', escapedPath.length() - 2) + 1);
+    if (parent.length() <= 1)
+      return null;
+    try {
+        return URIUtil.decode(parent);
+    } catch (URIException e) {
+        return parent;
+    }
+  }
+
+  public File getParentFile() {
+    String parent = getParent();
+    if(parent==null)
+      return null;
+
+    try {
+      return new WebdavFile(parent, getUser(), getPass());
+    } catch(URIException e) {
+      throw new WebdavException(e);
+    }
+  }
+
+  public String getPath() {
+    if(relPath!=null)
+      return relPath;
+    try {
+        return httpUrl.getURI();
+    } catch (URIException e) {
+        throw new WebdavException(e);
+    }
+  }
+
+  public boolean isAbsolute() {
+    return relPath==null;
+  }
+
+  public String getAbsolutePath() {
+    return getPath();
+  }
+
+  public File getAbsoluteFile() {
+    return this;
+  }
+
+  public String getCanonicalPath() {
+    return getPath();
+  }
+
+  public File getCanonicalFile() {
+    return this;
+  }
+
+  public URL toURL() throws MalformedURLException {
+    if(relPath!=null)
+      return null;
+    try {
+        return new URL(httpUrl.getURI());
+    } catch (URIException e) {
+        throw new MalformedURLException(e.getMessage());
+    }
+  }
+
+  public boolean canRead() {
+    return true;
+  }
+
+  public boolean canWrite() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return !res.isLocked();
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public boolean exists() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return res.exists();
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public boolean isDirectory() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return res.isCollection();
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public boolean isFile() {
+    return !isDirectory();
+  }
+
+  public boolean isHidden() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return res.getIsHidden();
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public long lastModified() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return res.getGetLastModified();
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public long length() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return res.getGetContentLength();
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public boolean createNewFile() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return res.putMethod("");
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public boolean delete() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return res.deleteMethod();
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public void deleteOnExit() {
+    throw new WebdavException(WebdavException.NOT_IMPLEMENTED);
+  }
+
+  public String[] list() {
+    return list(null);
+  }
+
+  public String[] list(FilenameFilter filter) {
+    File [] files = listFiles(filter);
+    String [] names = new String[files.length];
+    for(int i=0; i<names.length; i++)
+      names[i] = files[i].getAbsolutePath();
+
+    return names;
+  }
+
+  public File [] listFiles() {
+    return listFiles((FilenameFilter)null);
+  }
+
+  public File [] listFiles(FilenameFilter filter) {
+
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      WebdavResource allFiles [] = res.listWebdavResources();
+      if(allFiles==null)
+        return null;
+
+      ArrayList filtered = new ArrayList();
+      for(int i=0; i<allFiles.length; i++) {
+        if(filter==null || filter.accept(this, allFiles[i].getDisplayName()))
+          filtered.add( new WebdavFile(allFiles[i].getHttpURL()) );
+      }
+
+      return toFileArray(filtered);
+
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public File [] listFiles(FileFilter filter) {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      WebdavResource allFiles [] = res.listWebdavResources();
+      if(allFiles==null)
+        return null;
+
+      ArrayList filtered = new ArrayList();
+      for(int i=0; i<allFiles.length; i++) {
+        WebdavFile file = new WebdavFile(allFiles[i].getHttpURL());
+        if(filter==null || filter.accept(file))
+          filtered.add(file);
+      }
+
+      return toFileArray(filtered);
+
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public boolean mkdir() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return res.mkcolMethod();
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public boolean mkdirs() {
+    return mkdir();
+  }
+
+  public boolean renameTo(File dest) {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      return res.moveMethod(dest.getAbsolutePath());
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  public boolean setLastModified(long time) {
+    throw new WebdavException(WebdavException.NOT_IMPLEMENTED);
+  }
+
+  public boolean setReadOnly() {
+    WebdavResource res = null;
+    try {
+      res = createRes();
+      res.setOverwrite(false);
+      return true;
+    } catch(Exception e) {
+      throw new WebdavException(e);
+    } finally {
+      closeRes(res);
+    }
+  }
+
+  /** todo */
+  public static File[] listRoots() {
+    throw new WebdavException(WebdavException.NOT_IMPLEMENTED);
+  }
+
+  /** todo */
+  public static File createTempFile(String prefix, String suffix, File directory) {
+    throw new WebdavException(WebdavException.NOT_IMPLEMENTED);
+  }
+
+  /** todo */
+  public static File createTempFile(String prefix, String suffix) {
+    return WebdavFile.createTempFile(prefix, suffix, null);
+  }
+
+  public String toString() {
+    if(relPath!=null)
+      return relPath;
+    return httpUrl.getEscapedURI();
+  }
+
+  public int compareTo(File pathname) {
+    if(pathname instanceof WebdavFile) {
+      WebdavFile df = (WebdavFile)pathname;
+      return df.getPath().compareTo(getPath());
+    }
+    return -1;
+  }
+
+  public int compareTo(Object o) {
+    return compareTo((File)o);
+  }
+
+  public boolean equals(Object x) {
+    if(x==null)
+      return false;
+
+    if(x instanceof WebdavFile) {
+      WebdavFile xf = (WebdavFile)x;
+      return xf.getPath().equals(getPath());
+    }
+
+    return false;
+  }
+
+  public int hashCode() {
+    return getPath().hashCode();
+  }
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,5400 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java,v 1.29.2.3 2004/11/30 07:05:54 masonjm Exp $
+ * $Revision: 1.29.2.3 $
+ * $Date: 2004/11/30 07:05:54 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Locale;
+import java.util.TimeZone;
+import java.util.Vector;
+
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.HttpsURL;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.HeadMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.util.URIUtil;
+
+import org.apache.webdav.lib.methods.*;
+import org.apache.webdav.lib.properties.AclProperty;
+import org.apache.webdav.lib.properties.LockDiscoveryProperty;
+import org.apache.webdav.lib.properties.PrincipalCollectionSetProperty;
+import org.apache.webdav.lib.properties.ResourceTypeProperty;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+/**
+ * The class <code>WebdavResource</code> is an abstract representation
+ * for WebDAV resource.<p>
+ *
+ * <pre>
+ * A functional comparison of WebdavResource and JDK(It's different a lot).
+ * ----------------------------------+-------------------------------------
+ *   File class (JDK 1.3.x)          |  WebdavResource class
+ * ----------------------------------+-------------------------------------
+ *   File(String)                    |  WebdavResource(HttpURL)
+ *   File(String, String)            |  X (need to escape)
+ *   File(File, String)              |  WebdavResource(HttpURL, String)
+ *   getName()                       |  getName()
+ *   getParent()                     |  *see getHttpURL() and HttpURL
+ *   getParentFile()                 |  X (not yet)
+ *   getPath()                       |  getPath()
+ *   isAbsolute()                    |  X
+ *   getAbsolutePath()               |
+ *   getAbsoluteFile()               |  X
+ *   getCanonicalPath()              |
+ *   getCanonicalFile()              |  X
+ *   toURL()                         |  *see HttpURL
+ *   canRead()                       |
+ *   !canWrite()                     |  !isLocked()
+ *   exists()                        |  exists()
+ *   isDirectory()                   |  isCollection()
+ *   isFile()                        |  !isCollection()
+ *   isHidden()                      |  getIsHidden()
+ *   lastModified()                  |  getGetLastModified()
+ *   length()                        |  getGetContentLength()
+ *   createNewFile()                 |  putMethod(String)
+ *   delete()                        |  deleteMethod()
+ *   deleteOnExit()                  |  X
+ *   list()                          |  list()
+ *   list(FilenameFilter)            |  X
+ *   listFiles()                     |  listWebdavResources()
+ *   listFiles(FilenameFilter)       |  X
+ *   listFiles(FileFilter)           |  X
+ *   mkdir()                         |  mkcolMethod()
+ *   mkdirs()                        |  mkcolMethod()
+ *   renameTo(File)                  |  moveMethod(String)
+ *   setLastModified()               |  X
+ *   setReadOnly()                   |  setOverwrite(boolean)
+ *   listRoots()                     |  *see WebdavSession
+ *   generateFile()                  |
+ *   createTempFile(...)             |  setGetTempDir(String)
+ *   compareTo(Object)               |  compareTo(Object)
+ *   equals(Object)                  |  equals(Object)
+ *   hashCode()                      |  X
+ * ----------------------------------+-------------------------------------
+ *   URL class (JDK 1.3.x)           |  Webdavresource and HttpURL classes
+ * ----------------------------------+-------------------------------------
+ *   getQuery()                      |  getQuery()
+ *   getPath()                       |  getPath()
+ *   getUserInfo()                   |  getUserInfo()
+ *   getAuthority()                  |  getAuthority()
+ *   getPort()                       |  getPort()
+ *   getProtocol()                   |  getScheme()
+ *   getHost()                       |  getHost()
+ *   getFile()                       |  getPath()
+ *   getRef()                        |  getFragmenet()
+ *   hashCode()                      |  X
+ *   sameFile()                      |
+ *   toExternalForm()                |  toExternalForm()
+ *   openConnection()                |
+ *   openStream()                    |
+ *   getContent()                    |  getMethodDataAsString()
+ * ----------------------------------+-------------------------------------
+ *   URLConnection class (JDK 1.3.x) |  HttpClient Library and more
+ * ----------------------------------+-------------------------------------
+ *   getFileNameMap()                |  X
+ *   setFileNameMap()                |  X
+ *   connect()                       |
+ *   getURL()                        |  HttpURL#getURL()
+ *   getContenetLength()()           |
+ *   getContentType()                |
+ *   getContentEncoding()            |
+ *   getExpiration()                 |
+ *   getDate()                       |
+ *   getLastModified()               |
+ *   getHeaderField()                |
+ *   getHeaderFieldInt()             |  X
+ *   getHeaderFielDate()             |  X
+ *   getHeaderFieldKey()             |  X
+ *   getHeaderFiled(int)             |  X
+ *   getContenet()                   |
+ *   getInputStream()                |  WebdavResource#getMethodData()
+ *   getOutputStream()               |  WebdavResource#putMethod(...)
+ *   setDoInput()                    |  X
+ *   getDoInput()                    |  X
+ *   setAllowUserInteraction()       |  *see WebdavException and WebdavStatus
+ *   getAllowUserInteraction()       |  *see WebdavException and WebdavStatus
+ *   setUseCaches()                  |
+ *   getUseCaches()                  |
+ *   getIfModifiedSince()            |  X
+ *   setIfModifiedSince(boolean)     |  X
+ *   setRequestProperty(...)         |  X
+ *   getRequestProperty(...)         |  X
+ *   guessContentTypeFromStream(...) |  X
+ * ----------------------------------+-------------------------------------
+ * </pre>
+ *
+ */
+public class WebdavResource extends WebdavSession {
+
+
+    // -------------------------------------------------------  Constructors
+
+    /**
+     * The default constructor.
+     */
+    protected WebdavResource() {
+    }
+
+
+    /**
+     * The constructor.
+     */
+    protected WebdavResource(HttpClient client) {
+        super();
+        this.client = client;
+    }
+
+    /**
+     * The constructor.
+     *
+     * @param httpURL The specified http URL.
+     * @param credentials The credentials to use for authentication.
+     * @param action The action to set properties of this resource.
+     * @param depth The depth to find properties.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(HttpURL httpURL, Credentials credentials, int action,
+                          int depth)
+        throws HttpException, IOException {
+
+        setCredentials(credentials);
+        setHttpURL(httpURL, action, depth);
+    }
+
+
+    /**
+     * The constructor.
+     *
+     * @param httpURL The specified http URL.
+     * @param action The action to set properties of this resource.
+     * @param depth The depth to find properties.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(HttpURL httpURL, int action, int depth)
+        throws HttpException, IOException {
+
+        setHttpURL(httpURL, action, depth);
+    }
+
+    /**
+     * The constructor.
+     *
+     * @param httpURL The specified http URL.
+     * @param action The action to set properties of this resource.
+     * @param depth The depth to find properties.
+     * @param followRedirects shall redirects from the server be accepted
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(HttpURL httpURL, int action, int depth,
+             boolean followRedirects)
+       throws HttpException, IOException {
+       
+       setFollowRedirects(this.followRedirects);
+       setHttpURL(httpURL, action, depth);
+    }
+
+
+    /**
+     * The constructor.
+     *
+     * @param httpURL The specified http URL.
+     * @param depth The depth to find properties.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(HttpURL httpURL, int depth)
+        throws HttpException, IOException {
+
+        setHttpURL(httpURL, defaultAction, depth);
+
+    }
+    /**
+     * The constructor.
+     *
+     * @param httpURL The specified http URL.
+     * @param depth The depth to find properties.
+     * @param followRedirects Shall redirects be followed automatically.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(HttpURL httpURL, int depth, boolean followRedirects)
+       throws HttpException, IOException {
+       
+       setFollowRedirects(followRedirects);
+       setHttpURL(httpURL, defaultAction, depth);
+    }
+
+
+    /**
+     * The constructor.
+     *
+     * @param httpURL The specified http URL.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(HttpURL httpURL)
+        throws HttpException, IOException {
+
+        setHttpURL(httpURL);
+    }
+    /**
+     * The constructor.
+     *
+     * @param httpURL The specified http URL.
+     * @param followRedirects shall redirects from the server be accepted
+     */
+    public WebdavResource(HttpURL httpURL, boolean followRedirects)
+        throws HttpException, IOException {
+        
+        setFollowRedirects(followRedirects);
+        setHttpURL(httpURL);
+    }
+
+
+    /**
+     * The constructor.
+     *
+     * @param httpURL The specified http URL.
+     * @param proxyHost The hostname of the proxy to use.
+     * @param proxyPort The port number of the proxy to use.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(HttpURL httpURL, String proxyHost, int proxyPort)
+        throws HttpException, IOException {
+
+        setProxy(proxyHost, proxyPort);
+        setHttpURL(httpURL);
+    }
+    public WebdavResource(HttpURL httpURL, String proxyHost, int proxyPort, boolean followRedirects)
+       throws HttpException, IOException {
+       
+       setFollowRedirects(followRedirects);
+       setProxy(proxyHost, proxyPort);
+       setHttpURL(httpURL);
+    }
+
+
+    /**
+     * The constructor.
+     *
+     * @param httpURL The specified http URL.
+     * @param proxyHost The hostname of the proxy to use.
+     * @param proxyPort The port number of the proxy to use.
+     * @param proxyCredentials Credentials to use for proxy authentication.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(HttpURL httpURL, String proxyHost, int proxyPort,
+                          Credentials proxyCredentials)
+        throws HttpException, IOException {
+
+        setProxy(proxyHost, proxyPort);
+        setProxyCredentials(proxyCredentials);
+        setHttpURL(httpURL);
+    }
+    
+    public WebdavResource(HttpURL httpURL, String proxyHost, int proxyPort,
+          Credentials proxyCredentials, boolean followRedirects)
+        throws HttpException, IOException {
+       
+        setFollowRedirects(followRedirects);
+        setProxy(proxyHost, proxyPort);
+        setProxyCredentials(proxyCredentials);
+        setHttpURL(httpURL);
+    }
+
+    /**
+     * The constructor.
+     * It must be put an escaped http URL as an argument.
+     *
+     * @param escapedHttpURL The escaped http URL string.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(String escapedHttpURL)
+        throws HttpException, IOException {
+
+        setHttpURL(escapedHttpURL);
+    }
+    public WebdavResource(String escapedHttpURL, boolean followRedirects)
+       throws HttpException, IOException {
+       
+       setFollowRedirects(followRedirects);
+       setHttpURL(escapedHttpURL);
+    }
+
+
+    /**
+     * The constructor.
+     * It must be put an escaped http URL as an argument.
+     *
+     * @param escapedHttpURL The escaped http URL string.
+     * @param credentials The credentials used for Authentication.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(String escapedHttpURL, Credentials credentials)
+        throws HttpException, IOException {
+
+        setCredentials(credentials);
+        setHttpURL(escapedHttpURL);
+    }
+    
+    public WebdavResource(String escapedHttpURL, Credentials credentials,
+          boolean followRedirects)
+       throws HttpException, IOException {
+       
+       setFollowRedirects(followRedirects);
+       setCredentials(credentials);
+       setHttpURL(escapedHttpURL);
+    }
+
+
+    /**
+     * The constructor.
+     * It must be put an escaped http URL as an argument.
+     *
+     * @param escapedHttpURL The escaped http URL string.
+     * @param proxyHost The hostname of the proxy to use.
+     * @param proxyPort The port number of the proxy to use.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(String escapedHttpURL, String proxyHost,
+                          int proxyPort) throws HttpException, IOException {
+
+        setProxy(proxyHost, proxyPort);
+        setHttpURL(escapedHttpURL);
+    }
+
+    /**
+     * The constructor.
+     * It must be put an escaped http URL as an argument.
+     *
+     * @param escapedHttpURL The escaped http URL string.
+     * @param proxyHost The hostname of the proxy to use.
+     * @param proxyPort The port number of the proxy to use.
+     * @param proxyCredentials Credentials to use for proxy authentication.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(String escapedHttpURL, String proxyHost,
+                          int proxyPort, Credentials proxyCredentials)
+        throws HttpException, IOException {
+
+        setProxy(proxyHost, proxyPort);
+        setProxyCredentials(proxyCredentials);
+        setHttpURL(escapedHttpURL);
+    }
+
+
+    /**
+     * The constructor.
+     *
+     * @param httpURL The http URL.
+     * @param additionalPath The added relative path.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setDefaultAction(int)
+     */
+    public WebdavResource(HttpURL httpURL, String additionalPath)
+        throws HttpException, IOException {
+
+        setHttpURL(httpURL, additionalPath);
+    }
+
+    /**
+     * The constructor.
+     *
+     * @param httpURL The http URL.
+     * @param additionalPath The added relative path.
+     * @param followRedirects shall redirects be accepted
+     */
+    public WebdavResource(HttpURL httpURL, String additionalPath, boolean followRedirects)
+       throws HttpException, IOException {
+   
+       setFollowRedirects(followRedirects);
+       setHttpURL(httpURL, additionalPath);
+    }
+
+
+    // -------------------------------------- Constants for WebDAV properties.
+
+
+    /**
+     * The displayname property.
+     */
+    public static final String DISPLAYNAME = "displayname";
+
+
+    /**
+     * The getcontentlanguage property.
+     */
+    public static final String GETCONTENTLANGUAGE = "getcontentlanguage";
+
+
+    /**
+     * The getcontentlength property.
+     */
+    public static final String GETCONTENTLENGTH = "getcontentlength";
+
+
+    /**
+     * The getlastmodifed property.
+     */
+    public static final String GETLASTMODIFIED = "getlastmodified";
+
+
+    /**
+     * The creationdate property.
+     */
+    public static final String CREATIONDATE = "creationdate";
+
+
+    /**
+     * The resourcetype property.
+     */
+    public static final String RESOURCETYPE = "resourcetype";
+
+
+    /**
+     * The source property.
+     */
+    public static final String SOURCE = "source";
+
+
+    /**
+     * The getcontenttype property.
+     */
+    public static final String GETCONTENTTYPE = "getcontenttype";
+
+
+    /**
+     * The getetag property.
+     */
+    public static final String GETETAG = "getetag";
+
+
+    /**
+     * The ishidden property.
+     */
+    public static final String ISHIDDEN = "ishidden";
+
+
+    /**
+     * The iscollection property.
+     */
+    public static final String ISCOLLECTION = "iscollection";
+
+
+    /**
+     * The supportedlock property.
+     */
+    public static final String SUPPORTEDLOCK = "supportedlock";
+
+
+    /**
+     * The lockdiscovery property.
+     */
+    public static final String LOCKDISCOVERY = "lockdiscovery";
+
+
+    // ------------------------------------------------------------ Constants
+
+
+    /**
+     * No action to find properties for this resource.
+     */
+    public static final int NOACTION = 1;
+
+
+    /**
+     * The action setting only the displayname for this resource.
+     */
+    public static final int NAME = 2;
+
+
+    /**
+     * The action setting the basic properties for this resource.
+     */
+    public static final int BASIC = 3;
+
+
+    /**
+     * The action setting the default DAV properties for this resource.
+     */
+    public static final int DEFAULT = 4;
+
+
+    /**
+     * The action setting the all properties for this resource.
+     */
+    public static final int ALL = 5;
+
+
+    /**
+     *
+     */
+    public static final int OPTIONS_WORKSPACE = 8;
+
+    /**
+     *
+     */
+    public static final int OPTIONS_VERSION_HISTORY = 9;
+
+    public static final int LABEL_SET = 10;
+    public static final int LABEL_REMOVE = 11;
+    public static final int LABEL_ADD = 12;
+
+
+    /**
+     * Owner information for locking and unlocking.
+     */
+    public static final String defaultOwner = "Slide";
+
+
+    /**
+     * The true constant string.
+     */
+    public static final String TRUE = "1";
+
+
+    /**
+     * The false constant string.
+     */
+    public static final String FALSE = "0";
+
+
+    /**
+     * Date formats using for Date parsing.
+     */
+    public static final SimpleDateFormat formats[] = {
+        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
+            new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US),
+            new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
+            new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US),
+            new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US),
+            new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", Locale.US)
+    };
+
+
+    /**
+     * GMT timezone.
+     */
+    protected final static TimeZone gmtZone = TimeZone.getTimeZone("GMT");
+
+
+    static {
+        for (int i = 0; i < formats.length; i++) {
+            formats[i].setTimeZone(gmtZone);
+        }
+    }
+
+
+    // --------------------------------------------------- Instance Variables
+
+
+    /**
+     * The HttpURL to represent a WebDAV resource.
+     */
+    protected HttpURL httpURL;
+
+
+    /**
+     * Table of the hrefs gotten in a collection.
+     */
+    protected WebdavResources childResources = new WebdavResources();
+
+
+    /**
+     * The default action to find properties.
+     */
+    protected static int defaultAction = BASIC;
+
+
+    /**
+     * The default depth for WebDAV methods.
+     */
+    protected static int defaultDepth = DepthSupport.DEPTH_0;
+
+
+    /**
+     * The default temporary directory for the GET method.
+     * @deprecated The client is responsible for disk I/O.
+     */
+    protected static String tempDirForGet;
+
+
+    /**
+     * The flag setter to use the disk for the GET method.
+     * @deprecated The client is responsible for disk I/O.
+     */
+    protected static boolean useDiskForGet = true;
+
+
+    /**
+     * The flag to set the status code by propfind.
+     */
+    protected boolean thisResource;
+
+
+    /**
+     * The allowed HTTP methods.
+     */
+    protected Enumeration allowedMethods;
+
+
+    /**
+     * The capabilities of the WebDAV server.
+     */
+    protected Enumeration davCapabilities;
+
+
+    /**
+     * An WebdavResource flag to check its existence;
+     */
+    protected boolean exists;
+
+
+    /**
+     * An WebdavResource flag to check overwriting;
+     */
+    protected boolean overwrite;
+
+
+    /**
+     * An status code performed by HTTP methods at the most recent.
+     */
+    protected int latestStatusCode;
+
+
+    /**
+     * An status message performed by HTTP methods at the most recent.
+     */
+    protected String latestStatusMessage = "";
+
+
+    /**
+     * An WebDAV property, displayname.
+     */
+    protected String displayName = "";
+
+
+    /**
+     * An WebDAV property, getcontentlength.
+     */
+    protected long getContentLength;
+
+
+    /**
+     * An WebDAV property, getcontenttype.
+     */
+    protected String getContentType = "";
+
+
+    /**
+     * An WebDAV property, resourcetype.
+     */
+    protected ResourceTypeProperty resourceType;
+
+
+    /**
+     * An WebDAV property, getlastmodified.
+     */
+    protected long getLastModified;
+
+
+    /**
+     * An WebDAV property, creationdate.
+     */
+    protected long creationDate;
+
+
+    /**
+     * An WebDAV property, getetag.
+     */
+    protected String getEtag = "";
+
+    /**
+     * Owner information for locking and unlocking.
+     */
+    protected String owner = null;
+
+
+    /**
+     * An WebDAV property, ishidden.
+     */
+    protected boolean isHidden;
+
+
+    /**
+     * An WebDAV property, iscollection.
+     */
+    protected boolean isCollection;
+
+
+    /**
+     * An WebDAV property, supportedlock.
+     */
+    protected String supportedLock = "";
+
+
+    /**
+     * An WebDAV property, lockdiscovery.
+     */
+    protected LockDiscoveryProperty lockDiscovery;
+
+    protected boolean followRedirects = false;
+
+    // --------------------------------------------------------- Basic settings
+
+    /**
+     * Generates and adds the "Transaction" header if this method is part of
+     * an externally controlled transaction.
+     */
+    protected void generateTransactionHeader(HttpMethod method) {
+        if (client == null || method == null) return;
+
+        WebdavState state = (WebdavState) client.getState();
+        String txHandle = state.getTransactionHandle();
+        if (txHandle != null) {
+            method.setRequestHeader("Transaction", "<" + txHandle + ">");
+        }
+    }
+    
+    /**
+     * Generate and add the If header to the specified HTTP method.
+     */
+    protected void generateIfHeader(HttpMethod method) {
+
+        if (client == null) return;
+        if (method == null) return;
+
+        WebdavState state = (WebdavState) client.getState();
+        String[] lockTokens = state.getAllLocks(method.getPath());
+
+        if (lockTokens.length == 0) return;
+
+        StringBuffer ifHeaderValue = new StringBuffer();
+
+        for (int i = 0; i < lockTokens.length; i++) {
+            ifHeaderValue.append("(<").append(lockTokens[i]).append(">) ");
+        }
+
+        method.setRequestHeader("If", ifHeaderValue.toString());
+
+    }
+
+
+    /**
+     * Parse the <code>java.util.Date</code> string for HTTP-date.
+     *
+     * @return The parsed date.
+     */
+    protected Date parseDate(String dateValue) {
+        // TODO: move to the common util package related to http.
+        Date date = null;
+        for (int i = 0; (date == null) && (i < formats.length); i++) {
+            try {
+                synchronized (formats[i]) {
+                    date = formats[i].parse(dateValue);
+                }
+            } catch (ParseException e) {
+            }
+        }
+
+        return date;
+    }
+
+
+    /**
+     * Set only the displayname property for this resource.
+     *
+     * @param depth The depth to find properties.
+     */
+    protected void setNameProperties(int depth)
+        throws HttpException, IOException {
+
+        Vector properties = new Vector();
+        properties.addElement(DISPLAYNAME);
+
+        setNamedProp(depth, properties);
+    }
+
+
+    /**
+     * Sets the basic properties on a resource by indirectly issuing a PROPFIND
+     * on the resource.
+     *
+     * <p>Properties retrieved include:
+     *
+     * <ul>
+     *  <li>displayname</li>
+     *  <li>getcontentlength</li>
+     *  <li>getcontenttype</li>
+     *  <li>resourcetype</li>
+     *  <li>getlastmodified</li>
+     *  <li>lockdiscovery</li>
+     * </ul>
+     *
+     * @param depth The depth to find properties.
+     */
+    protected void setBasicProperties(int depth)
+        throws HttpException, IOException {
+
+        Vector properties = new Vector();
+        properties.addElement(DISPLAYNAME);
+        properties.addElement(GETCONTENTLENGTH);
+        properties.addElement(GETCONTENTTYPE);
+        properties.addElement(RESOURCETYPE);
+        properties.addElement(GETLASTMODIFIED);
+        properties.addElement(LOCKDISCOVERY);
+
+        setNamedProp(depth, properties);
+    }
+
+
+    /**
+     * Set the default properties on the resource by indirectly issuing a PROPFIND request
+     * for a default set of properties.
+     *
+     * <p>Properties retrieved include:
+     *
+     * <ul>
+     *  <li>creationdate</li>
+     *  <li>displayname</li>
+     *  <li>getcontentlanguage</li>
+     *  <li>getcontentlength</li>
+     *  <li>getcontenttype</li>
+     *  <li>getetag</li>
+     *  <li>getlastmodified</li>
+     *  <li>lockdiscovery</li>
+     *  <li>resourcetype</li>
+     *  <li>source</li>
+     *  <li>supportedlock</li>
+     * </ul>
+     *
+     * @param depth The depth to find properties.
+     */
+    protected void setDefaultProperties(int depth)
+        throws HttpException, IOException {
+
+        Vector properties = new Vector();
+        properties.addElement(CREATIONDATE);
+        properties.addElement(DISPLAYNAME);
+        properties.addElement(GETCONTENTLANGUAGE);
+        properties.addElement(GETCONTENTLENGTH);
+        properties.addElement(GETCONTENTTYPE);
+        properties.addElement(GETETAG);
+        properties.addElement(GETLASTMODIFIED);
+        properties.addElement(LOCKDISCOVERY);
+        properties.addElement(RESOURCETYPE);
+        properties.addElement(SOURCE);
+        properties.addElement(SUPPORTEDLOCK);
+
+        setNamedProp(depth, properties);
+    }
+
+
+    /**
+     * Set the named properties for this resource.
+     *
+     * @param depth The depth.
+     * @param propertyNames The property-names.
+     */
+    protected void setNamedProp(int depth, Vector propertyNames)
+        throws HttpException, IOException {
+
+        Enumeration responses = propfindMethod(depth, propertyNames);
+        setWebdavProperties(responses);
+    }
+
+
+    /**
+     * Set all properties for this resource.
+     *
+     * @param depth The depth
+     */
+    protected void setAllProp(int depth)
+        throws HttpException, IOException {
+
+        Enumeration responses = propfindMethod(depth);
+        setWebdavProperties(responses);
+    }
+
+
+    /**
+     * Set WebDAV properties following to the given http URL.
+     * This method is fundamental for getting information of a collection.
+     *
+     * @param responses An enumeration over {@link ResponseEntity} items, one
+     * for each resource for which information was returned via PROPFIND.
+     *
+     * @exception HttpException
+     * @exception IOException The socket error with a server.
+     */
+    protected void setWebdavProperties(Enumeration responses)
+        throws HttpException, IOException {
+    
+        // Make the resources in the collection empty.
+        childResources.removeAll();
+        while (responses.hasMoreElements()) {
+    
+            ResponseEntity response =
+                (ResponseEntity) responses.nextElement();
+    
+            boolean itself = false;
+            String href = response.getHref();
+            if (!href.startsWith("/"))
+                href = URIUtil.getPath(href);
+            href = decodeMarks(href);
+
+            /*
+             * Decode URIs to common (unescaped) format for comparison 
+             * as HttpClient.URI.setPath() doesn't escape $ and : chars.
+             */
+            String httpURLPath = httpURL.getPath();
+            String escapedHref = URIUtil.decode(href);
+            
+            // Normalize them to both have trailing slashes if they differ by one in length.
+            int lenDiff = escapedHref.length() - httpURLPath.length();
+            int compareLen = 0;
+            
+            if ( lenDiff == -1 && !escapedHref.endsWith("/")) {
+                compareLen = escapedHref.length();
+                lenDiff = 0;
+            }
+            else
+            if ( lenDiff == 1 && !httpURLPath.endsWith("/")) {
+                compareLen = httpURLPath.length();
+                lenDiff = 0;
+            }
+
+            // if they are the same length then compare them.
+            if (lenDiff == 0) {
+                if ((compareLen == 0 && httpURLPath.equals(escapedHref))
+                    || httpURLPath.regionMatches(0, escapedHref, 0, compareLen))
+                {
+                    // escaped href and http path are the same
+                    // Set the status code for this resource.
+                    if (response.getStatusCode() > 0)
+                        setStatusCode(response.getStatusCode());
+                    setExistence(true);
+                    itself = true;
+                }
+            }
+    
+            // Get to know each resource.
+            WebdavResource workingResource = null;
+            if (itself) {
+                workingResource = this;
+            }
+            else {
+                workingResource = createWebdavResource(client);
+                workingResource.setDebug(debug);
+            }
+    
+            // clear the current lock set
+            workingResource.setLockDiscovery(null);
+    
+            // Process the resource's properties
+            Enumeration properties = response.getProperties();
+            while (properties.hasMoreElements()) {
+    
+                Property property = (Property) properties.nextElement();
+    
+                // ------------------------------  Checking WebDAV properties
+                workingResource.processProperty(property);
+            }
+    
+            String displayName = workingResource.getDisplayName();
+    
+            if (displayName == null || displayName.trim().equals("")) {
+                displayName = getName(href);
+            }
+            if (!itself) {
+                String myURI = httpURL.getEscapedURI();
+                char[] childURI = (myURI + (myURI.endsWith("/") ? "" : "/")
+                                   + URIUtil.getName(href)).toCharArray();
+                HttpURL childURL = httpURL instanceof HttpsURL
+                                   ? new HttpsURL(childURI)
+                                   : new HttpURL(childURI);
+                childURL.setRawAuthority(httpURL.getRawAuthority());
+                workingResource.setHttpURL(childURL, NOACTION, defaultDepth);
+                workingResource.setExistence(true);
+                workingResource.setOverwrite(getOverwrite());
+            }
+            workingResource.setDisplayName(displayName);
+    
+            if (!itself)
+                childResources.addResource(workingResource);
+        }
+    }
+
+
+    // ------------------------------------------------------------ Properties
+
+
+    /**
+     * Set the default action for this resource.
+     * The default action is set as 'BASIC' for the first time.
+     *
+     * ex)
+     *  WebdavResource.NOACTION
+     *  WebdavResource.NAME
+     *  WebdavResource.BASIC
+     *  WebdavResource.DEFAULT
+     *  WebdavResource.ALL
+     *
+     * @param action The action type.
+     * @see #NOACTION
+     * @see #NAME
+     * @see #BASIC
+     * @see #DEFAULT
+     * @see #ALL
+     */
+    public static void setDefaultAction(int action) {
+        defaultAction = action;
+    }
+
+
+    /**
+     * Get the default action.
+     *
+     * @return The action type.
+     */
+    public static int getDefaultAction() {
+        return defaultAction;
+    }
+
+
+    /**
+     * Set the default action for this resource.
+     *
+     * ex)
+     *   DepthSupport.DEPTH_0
+     *   DepthSupport.DEPTH_1
+     *   DepthSupport.DEPTH_INFINITY
+     *
+     * @param depth The depth.
+     */
+    public static void setDefaultDepth(int depth) {
+        defaultDepth = depth;
+    }
+
+
+    /**
+     * Get the default action.
+     *
+     * @return The depth.
+     */
+    public static int getDefaultDepth() {
+        return defaultDepth;
+    }
+
+
+    /**
+     * Get the default temporary directory for the GET method.
+     *
+     * @param tempDir The temporary directory.
+     * @deprecated The given directory will not be used.
+     */
+    public static void setGetTempDir(String tempDir) {
+        tempDirForGet = tempDir;
+    }
+
+
+    /**
+     * Get the default temporary directory for the GET method.
+     * The default temporary directory is "temp/".
+     *
+     * @return The temporary directory path.
+     *         It's set by default, if it returns null.
+     * @deprecated The returned directory is not used by the GET method.
+     */
+    public static String getGetTempDir() {
+        return tempDirForGet;
+    }
+
+
+
+    /**
+     * Set the use disk flag for the GET method.
+     *
+     * @param useDisk The use disk flag.
+     * @deprecated This method has no effect.
+     */
+    public static void setGetUseDisk(boolean useDisk) {
+        //useDiskForGet = useDisk;
+    }
+
+
+    /**
+     * Get the use disk flag for the GET method.
+     *
+     * @return The current flag of the use disk.
+     *         By default, it's true.
+     * @deprecated This method always returns false.
+     */
+    public static boolean getGetUseDisk() {
+        return false;
+    }
+
+    /**
+     * Sets a flag indicating that redirect responses from
+     * the server shall be followed.
+     */
+    public void setFollowRedirects(boolean value) {
+       this.followRedirects = value;
+    }
+    /**
+     * Returns the current "follow redirects" flag.
+     * @see #setFollowRedirects(boolean)
+     */
+    public boolean getFollowRedirects() {
+       return this.followRedirects;
+    }
+
+
+    /**
+     * Test that the httpURL is the same with the client.
+     *
+     * @return true if the given httpURL is the client for this resource.
+     */
+    protected synchronized boolean isTheClient() throws URIException {
+        HostConfiguration hostConfig = client.getHostConfiguration();
+        Credentials creds =
+            client.getState().getCredentials(null, hostConfig.getHost());
+        String userName = null;
+        String password = null;
+
+        if (creds instanceof UsernamePasswordCredentials) {
+            UsernamePasswordCredentials upc = (UsernamePasswordCredentials) creds;
+            userName = upc.getUserName();
+            password = upc.getPassword();
+        }
+        String ref = httpURL.getUser();
+        boolean userMatches = userName != null ? userName.equals(ref)
+                                               : ref == null;
+        if (userMatches) {
+            ref = httpURL.getPassword();
+            userMatches = password != null ? password.equals(ref)
+                                           : ref == null;
+        } else {
+            return false;
+        }
+        if (userMatches) {
+            return httpURL.getHost().equalsIgnoreCase(hostConfig.getHost())
+                && httpURL.getPort()
+                == hostConfig.getProtocol().resolvePort(hostConfig.getPort());
+        }
+        return false;
+    }
+
+
+    /**
+     * Set the client for this resource.
+     *
+     * @exception IOException
+     */
+    protected void setClient() throws IOException {
+        setClient(httpURL);
+    }
+
+
+    /**
+     * Set the client for this resource and the given http URL.
+     *
+     * @param httpURL The http URL.
+     * @exception IOException
+     */
+    protected synchronized void setClient(HttpURL httpURL) throws IOException {
+
+        if (client == null) {
+            client = getSessionInstance(httpURL);
+        } else if (!isTheClient()) {
+            closeSession();
+            client = getSessionInstance(httpURL);
+        }
+    }
+
+
+    /**
+     * Set the HttpURL for this WebdavResource.
+     *
+     * @param httpURL the specified HttpURL.
+     * @param action The action to decide, which properties to find.
+     * @param depth The depth to find properties.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setHttpURL(java.lang.String)
+     * @see #setUserInfo(java.lang.String, java.lang.String)
+     * @see #setPath(java.lang.String)
+     * @see #setDefaultAction(int)
+     */
+    public void setHttpURL(HttpURL httpURL, int action, int depth)
+        throws HttpException, IOException {
+
+        this.httpURL = httpURL;
+        setClient(httpURL);
+        // make its existence false
+        setExistence(false);
+        setProperties(action, depth);
+    }
+
+
+    /**
+     * Set the HttpURL for this WebdavResource.
+     *
+     * @param httpURL the specified HttpURL.
+     * @param depth The depth to find properties.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setHttpURL(java.lang.String)
+     * @see #setUserInfo(java.lang.String, java.lang.String)
+     * @see #setPath(java.lang.String)
+     */
+    public void setHttpURL(HttpURL httpURL, int depth)
+        throws HttpException, IOException {
+
+        // Follow the default action.
+        setHttpURL(httpURL, defaultAction, depth);
+    }
+
+
+    /**
+     * Set the HttpURL for this WebdavResource.
+     * It must be put an escaped path part of the http URL as an argument.
+     *
+     * @param httpURL The specified HttpURL.
+     * @param additionalPath The added relative path.
+     * @param action The action to decide, which properties to find.
+     * @param depth The depth.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setHttpURL(java.lang.String)
+     * @see #setUserInfo(java.lang.String, java.lang.String)
+     * @see #setPath(java.lang.String)
+     * @see #setDefaultAction(int)
+     */
+    public void setHttpURL
+        (HttpURL httpURL, String additionalPath, int action, int depth)
+        throws HttpException, IOException {
+
+        setHttpURL(httpURL instanceof HttpsURL
+                   ? new HttpsURL((HttpsURL) httpURL, additionalPath)
+                   : new HttpURL(httpURL, additionalPath), action, depth);
+    }
+
+
+    /**
+     * Set the HttpURL for this WebdavResource.
+     * It must be put an escaped path part of the http URL as an argument.
+     *
+     * @param httpURL The specified HttpURL.
+     * @param additionalPath The added relative path.
+     * @param action The action to decide, which properties to find.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setHttpURL(java.lang.String)
+     * @see #setUserInfo(java.lang.String, java.lang.String)
+     * @see #setPath(java.lang.String)
+     * @see #setDefaultAction(int)
+     */
+    public void setHttpURL
+        (HttpURL httpURL, String additionalPath, int action)
+        throws HttpException, IOException {
+
+        setHttpURL(httpURL instanceof HttpsURL
+                   ? new HttpsURL((HttpsURL) httpURL, additionalPath)
+                   : new HttpURL(httpURL, additionalPath),
+                   action, defaultDepth);
+    }
+
+
+    /**
+     * Set the HttpURL for this WebdavResource.
+     *
+     * @param httpURL The specified HttpURL.
+     * @param additionalPath The added relative path.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setHttpURL(java.lang.String)
+     * @see #setUserInfo(java.lang.String, java.lang.String)
+     * @see #setPath(java.lang.String)
+     */
+    public void setHttpURL(HttpURL httpURL, String additionalPath)
+        throws HttpException, IOException {
+
+        setHttpURL(httpURL instanceof HttpsURL
+                   ? new HttpsURL((HttpsURL) httpURL, additionalPath)
+                   : new HttpURL(httpURL, additionalPath),
+                   defaultAction, defaultDepth);
+    }
+
+
+    /**
+     * Set the HttpURL for this WebdavResource.
+     *
+     * @param httpURL the specified HttpURL.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setHttpURL(java.lang.String)
+     * @see #setUserInfo(java.lang.String, java.lang.String)
+     * @see #setPath(java.lang.String)
+     */
+    public void setHttpURL(HttpURL httpURL)
+        throws HttpException, IOException {
+
+        setHttpURL(httpURL, defaultDepth);
+    }
+
+
+    /**
+     * Set the HttpURL of this WebdavResource.
+     * It must be put an escaped http URL as an argument.
+     *
+     * @param escapedHttpURL The escaped http URL string.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setHttpURL(HttpURL)
+     * @see #setUserInfo(java.lang.String, java.lang.String)
+     * @see #setPath(java.lang.String)
+     */
+    public void setHttpURL(String escapedHttpURL)
+        throws HttpException, IOException {
+
+        setHttpURL(escapedHttpURL.startsWith("https")
+                   ? new HttpsURL(escapedHttpURL)
+                   : new HttpURL(escapedHttpURL));
+    }
+
+
+    /**
+     * Get the HttpURL of this WebdavResource.
+     *
+     * @return httpURL the http URL.
+     */
+    public HttpURL getHttpURL() {
+        return httpURL;
+    }
+
+
+    /**
+     * Get the HttpURL except for userinfo.
+     *
+     * @return httpURL the http URL.
+     */
+    public HttpURL getHttpURLExceptForUserInfo()
+        throws URIException {
+
+        return httpURL instanceof HttpsURL ? new HttpsURL(httpURL.getRawURI())
+                                           : new HttpURL(httpURL.getRawURI());
+    }
+
+
+    /**
+     * Set the path part of this WebdavResource.
+     *
+     * @param path the specified path.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setHttpURL(HttpURL)
+     * @see #setHttpURL(java.lang.String)
+     * @see #setUserInfo(java.lang.String, java.lang.String)
+     */
+    public void setPath(String path)
+        throws HttpException, IOException {
+
+        httpURL.setPath(path);
+        setHttpURL(httpURL);
+    }
+
+
+    /**
+     * Get the path part of this WebdavResource.
+     * If the decoding of the path fails, this method will not throw an
+     * exception but return the escaped path instead.
+     *
+     * @return the path for this WebdavResource.
+     * @see org.apache.commons.httpclient.HttpURL#getPath()
+     * @see #setPath(java.lang.String)
+     */
+    public String getPath() {
+        try {
+            return httpURL.getPath();
+        } catch (URIException e) {
+            return httpURL.getEscapedPath();
+        }
+    }
+
+
+    /**
+     * Get the name of this WebdavResource.
+     * If the decoding of the name fails, this method will not throw an
+     * exception but return the escaped name instead.
+     *
+     * @return the name of this WebdavResource.
+     * @see org.apache.commons.httpclient.HttpURL#getName()
+     */
+    public String getName() {
+        return getName(httpURL.getEscapedPath());
+    }
+
+
+    /**
+     * Get the hostname of this WebdavResource.
+     *
+     * @return the hostname.
+     * @exception URIException
+     */
+    public String getHost() throws URIException {
+        return httpURL.getHost();
+    }
+
+
+    /**
+     * Set the userinfo part of this WebdavResource.
+     *
+     * @exception HttpException
+     * @exception IOException
+     * @see #setHttpURL(HttpURL)
+     * @see #setHttpURL(java.lang.String)
+     * @see #setPath(java.lang.String)
+     */
+    public void setUserInfo(String userName, String password)
+        throws HttpException, IOException {
+
+        httpURL.setUserinfo(userName, password);
+        setHttpURL(httpURL);
+    }
+
+
+    // ------------------------------------------------ DAV properties checking
+
+
+    /**
+     * Get the value of DAV property, displayname.
+     *
+     * @return The displayname string.
+     */
+    public String getDisplayName() {
+        return displayName;
+    }
+
+
+    /**
+     * Set the value of DAV property, displayname.
+     *
+     * @param displayName The displayname string.
+     */
+    protected void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+
+
+    /**
+     * Get the value of DAV property, getcontentlength.
+     *
+     * @return The getcontentlength value.
+     */
+    public long getGetContentLength() {
+        return getContentLength;
+    }
+
+
+    /**
+     * Set the value of DAV property, getcontentlength.
+     *
+     * @param getContentLength The getcontentlength value.
+     */
+    protected void setGetContentLength(long getContentLength) {
+        this.getContentLength = getContentLength;
+    }
+
+
+    /**
+     * Set the value of DAV property, getcontentlength.
+     *
+     * @param getContentLength The getcontentlength value.
+     */
+    protected void setGetContentLength(String getContentLength) {
+        try {
+            this.getContentLength = Long.parseLong(getContentLength);
+        } catch (NumberFormatException nfe) {
+            // it's ok to ignore this error.
+        }
+    }
+
+
+    /**
+     * Get the value of DAV property, resourcetype.
+     *
+     * @return The resourcetype property.
+     * @see #isCollection()
+     */
+    public ResourceTypeProperty getResourceType() {
+        return resourceType;
+    }
+
+
+    /**
+     * Set the value of DAV property, resourcetype.
+     *
+     * @param resourceType The resourcetype property.
+     */
+    protected void setResourceType(ResourceTypeProperty resourceType) {
+        this.resourceType = resourceType;
+    }
+
+
+    /**
+     * Get the value of DAV property, resourcetype
+     *
+     * @return The resourcetype string.
+     * @see #getResourceType()
+     * @see #getIsCollection()
+     */
+    public boolean isCollection() {
+        if (getResourceType() == null) return false;
+        return getResourceType().isCollection();
+    }
+
+
+    /**
+     * Get the value of DAV property, getcontenttype.
+     *
+     * @return The getcontenttype string.
+     */
+    public String getGetContentType() {
+        return getContentType;
+    }
+
+
+    /**
+     * Set the value of DAV property, getcontenttype.
+     *
+     * @param getContentType The getcontenttype string.
+     */
+    protected void setGetContentType(String getContentType) {
+        this.getContentType = getContentType;
+    }
+
+    /**
+     * Set the content-type to use for this resource, for PUTs.
+     * @param contentType The content-type string.
+     */
+    public void setContentType(String contentType) {
+        this.getContentType = contentType;
+    }
+
+    /**
+     * Get the value of DAV property, getlastmodified.
+     *
+     * @return The getlastmodified value.
+     */
+    public long getGetLastModified() {
+        return getLastModified;
+    }
+
+
+    /**
+     * Set the value of DAV property, getlastmodified.
+     *
+     * @param getLastModified The getlastmodified value.
+     * @see #setGetLastModified(java.lang.String)
+     */
+    protected void setGetLastModified(long getLastModified) {
+        this.getLastModified = getLastModified;
+    }
+
+
+    /**
+     * Set the value of DAV property, getlastmodified.
+     *
+     * @param getLastModified The getlastmodified value.
+     * @see #setGetLastModified(long)
+     */
+    protected void setGetLastModified(String getLastModified) {
+        Date date = parseDate(getLastModified);
+        if (date != null)
+            this.getLastModified = date.getTime();
+    }
+
+
+    /**
+     * Get the value of DAV property, creationdate.
+     *
+     * @return The creationdate string.
+     */
+    public long getCreationDate() {
+        return creationDate;
+    }
+
+
+    /**
+     * Set the value of DAV property, creationdate.
+     *
+     * @param creationDate The creationdate string.
+     */
+    protected void setCreationDate(long creationDate) {
+        this.creationDate = creationDate;
+    }
+
+
+    /**
+     * Set the value of DAV property, creationdate.
+     *
+     * @param creationDate The creationdate string.
+     */
+    protected void setCreationDate(String creationDate) {
+        Date date = parseDate(creationDate);
+        if (date != null)
+            this.creationDate = date.getTime();
+    }
+
+
+    /**
+     * Get the value of DAV property, getetag.
+     *
+     * @return The getetag string.
+     */
+    public String getGetEtag() {
+        return getEtag;
+    }
+
+
+    /**
+     * Set the value of DAV property, getetag.
+     *
+     * @param getEtag The getetag string.
+     */
+    protected void setGetEtag(String getEtag) {
+        this.getEtag = getEtag;
+    }
+
+    /**
+     * Get the owner string, as used for locking purposes.
+     */
+    public String getOwner() {
+        return owner;
+    }
+
+    /**
+     * Get the value of DAV property, supportedlock.
+     *
+     * @return The supportedlock string.
+     */
+    public String getSupportedLock() {
+        return supportedLock;
+    }
+
+
+    /**
+     * Set the value of DAV property, supportedlock.
+     *
+     * @param supportedLock The supportedlock string.
+     */
+    protected void setSupportedLock(String supportedLock) {
+        this.supportedLock = supportedLock;
+    }
+
+
+    /**
+     * Get the value of DAV property, lockdiscovery.
+     *
+     * @return The lockdiscovery property.
+     */
+    public LockDiscoveryProperty getLockDiscovery() {
+        return lockDiscovery;
+    }
+
+    /**
+     * Set the value of DAV property, lockdiscovery.
+     *
+     * @param lockDiscovery The lockdiscovery property.
+     */
+    protected void setLockDiscovery(LockDiscoveryProperty lockDiscovery) {
+        this.lockDiscovery = lockDiscovery;
+    }
+
+
+    /**
+     * Get the activelock owners for this resource.
+     *
+     * @return An enumeration of owners.
+     */
+    public Enumeration getActiveLockOwners() {
+        if (lockDiscovery == null) return null;
+        Lock[] activeLocks = lockDiscovery.getActiveLocks();
+        if (activeLocks == null) return null;
+        Vector buff = new Vector();
+        int count = activeLocks.length;
+        for (int i = 0; i < count; i++) {
+            buff.addElement(activeLocks[i].getOwner());
+        }
+        return buff.elements();
+    }
+
+
+    /**
+     * Test that this resource is locked.
+     *
+     * @return true if it's locked.
+     */
+    public boolean isLocked() {
+        if (lockDiscovery == null) return false;
+        Lock[] activeLocks = lockDiscovery.getActiveLocks();
+        if (activeLocks == null) return false;
+        for (int i = 0; i < activeLocks.length; i++) {
+            if (activeLocks[i].getLockType() == Lock.TYPE_WRITE) return true;
+        }
+        return false;
+    }
+
+
+    /**
+     * Get the value of DAV property, ishidden.
+     *
+     * @return true if it is hidden, otherwise false.
+     */
+    public boolean getIsHidden() {
+        return isHidden;
+    }
+
+
+    /**
+     * Set the value of DAV property, ishidden.
+     *
+     * @param isHidden
+     */
+    protected void setIsHidden(boolean isHidden) {
+        this.isHidden = isHidden;
+    }
+
+
+    /**
+     * Set the value of DAV property, ishidden.
+     *
+     * @param isHidden
+     */
+    protected void setIsHidden(String isHidden) {
+        this.isHidden = isHidden.equals(TRUE) ? true : false;
+    }
+
+
+    /**
+     * Get the value of DAV property, iscollection
+     *
+     * @return true if it is collection, otherwise false.
+     * @see #isCollection()
+     */
+    public boolean getIsCollection() {
+        return isCollection;
+    }
+
+
+    /**
+     * Set the value of DAV property, iscollection
+     *
+     * @param isCollection
+     */
+    protected void setIsCollection(boolean isCollection) {
+        this.isCollection = isCollection;
+    }
+
+
+    /**
+     * Set the value of DAV property, iscollection
+     *
+     * @param isCollection
+     */
+    protected void setIsCollection(String isCollection) {
+        this.isCollection = isCollection.equals(TRUE) ? true : false;
+    }
+
+
+    // --------------------------------------- WebDAV Resource Public Methods
+
+
+    /**
+     * Set the properties for this resource.
+     *
+     * @param action The action to find properties for this resource.
+     * @param depth the depth to which properties shall be found
+     * @see #setDefaultAction(int)
+     */
+    public void setProperties(int action, int depth)
+        throws HttpException, IOException {
+
+        switch (action) {
+            case NAME:
+                setNameProperties(depth);
+                break;
+            case BASIC:
+                setBasicProperties(depth);
+                break;
+            case DEFAULT:
+                setDefaultProperties(depth);
+                break;
+            case ALL:
+                setAllProp(depth);
+                break;
+            case NOACTION:
+            default:
+                break;
+        }
+    }
+
+
+    /**
+     * Set the properties for this resource.
+     *
+     * @param depth the depth to which properties shall be found
+     */
+    public void setProperties(int depth)
+        throws HttpException, IOException {
+
+        setProperties(defaultAction, depth);
+    }
+
+    /**
+     * Refresh the properties of this resource
+     * without changing the status of the previous command
+     */
+    protected void refresh() throws HttpException, IOException {
+        int latestStatusCode = this.latestStatusCode;
+        String latestStatusMessage = this.latestStatusMessage;
+        setProperties(DepthSupport.DEPTH_0);
+        this.latestStatusCode = latestStatusCode;
+        this.latestStatusMessage = latestStatusMessage;
+    }
+
+    /**
+     * Returns the last known information about the existence of this resource.
+     * This is a wrapper method for getExistence.
+     *
+     * A previous call to the method setProperties might be necessary to update
+     * that information.
+     *  
+     * @return true if the resource is known to exist<br>
+     *         false if the resource is known not to exist or its status is unknown.
+     * @see #getExistence()
+     * @see #setProperties(int, int)
+     */
+    public boolean exists() {
+        return getExistence();
+    }
+
+
+    /**
+     * Set its existence.
+     *
+     * @param exists The boolean value to be set for its existence.
+     */
+    protected void setExistence(boolean exists) {
+        this.exists = exists;
+    }
+
+
+    /**
+     * Returns the last known information about the existence of this resource.
+     *
+     * A previous call to the method setProperties might be necessary to update that
+     * information.
+     *  
+     * @return true if the resource is known to exist<br>
+     *         false if the resource is known not to exist or its status is unknown.
+     * @see #setProperties(int, int)
+     */
+    public boolean getExistence() {
+        return exists;
+    }
+
+
+    /**
+     * Set the overwrite flag for COPY, MOVE, BIND and REBIND.
+     * Should be set before the method is executed.
+     *
+     * @param overwrite the overwrite flag
+     * @see #getOverwrite()
+     */
+    public void setOverwrite(boolean overwrite) {
+        this.overwrite = overwrite;
+    }
+
+
+    /**
+     * Get the current value of the overwrite flag for COPY, MOVE, BIND and
+     * REBIND.
+     *
+     * @return true if the current flag is overwriting.
+     * @see #setOverwrite(boolean)
+     */
+    public boolean getOverwrite() {
+        return overwrite;
+    }
+
+
+    /**
+     * Close the session of this client
+     */
+    public void close() throws IOException {
+        closeSession();
+    }
+
+
+    /**
+     * Get the lastest value of the status message by HTTP methods.
+     *
+     * @return The http status string.
+     */
+    public String getStatusMessage() {
+        return latestStatusMessage;
+    }
+
+
+    /**
+     * Get the lastest value of the status code by HTTP methods.
+     *
+     * @return The http status code.
+     */
+    public int getStatusCode() {
+        return latestStatusCode;
+    }
+
+
+    /**
+     * Set the lastest value of the status code by HTTP methods.
+     *
+     * @param statusCode the HTTP status code.
+     */
+    protected void setStatusCode(int statusCode) {
+        setStatusCode(statusCode, null);
+    }
+
+
+    /**
+     * Set the lastest value of the status code by HTTP methods.
+     *
+     * @param statusCode the HTTP status code.
+     * @param message the additional message.
+     */
+    protected void setStatusCode(int statusCode, String message) {
+
+        latestStatusCode = statusCode;
+        latestStatusMessage = WebdavStatus.getStatusText(statusCode) +
+            " (" + statusCode + ")" + ((message == null) ? "" : message);
+    }
+
+
+    /**
+     * Get the allowed methods, checked by HTTP OPTIONS.
+     *
+     * @return the allowed HTTP methods.
+     * @see #optionsMethod(java.lang.String)
+     */
+    public Enumeration getAllowedMethods() {
+        return allowedMethods;
+    }
+
+
+    /**
+     * Get the WebDAV capabilities, checked by HTTP OPTIONS.
+     *
+     * @return the WebDAV capabilities.
+     * @see #optionsMethod(java.lang.String)
+     */
+    public Enumeration getDavCapabilities() {
+        return davCapabilities;
+    }
+
+
+    /**
+     * Get all resources in this collection with the depth 1.
+     *
+     * @return resources in this collection with the depth 1.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public WebdavResources getChildResources()
+        throws HttpException, IOException {
+
+        setProperties(DepthSupport.DEPTH_1);
+
+        return childResources;
+    }
+
+
+    /**
+     * Get an array of resources denoting the WebDAV child resources in the
+     * collection of this resources.
+     *
+     * @return An array of child resources in this resource.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public WebdavResource[] listWebdavResources()
+        throws HttpException, IOException {
+
+        return getChildResources().listResources();
+    }
+
+
+    /**
+     * Get an array of pathnames denoting the WebDAV resources in the
+     * collection denoted by this pathname.
+     *
+     * @return An array of pathnames denoting the resources, null if an
+     *         IOException occurs.
+     */
+    public String[] list() {
+
+        try {
+            setNameProperties(DepthSupport.DEPTH_1);
+        } catch (IOException e) {
+            return null;
+        }
+        Enumeration hrefs = childResources.getResourceNames();
+
+        // To be atomic.
+        Vector hrefList = new Vector();
+        while (hrefs.hasMoreElements()) {
+            hrefList.addElement((String) hrefs.nextElement());
+        }
+        // Calculate the size of the string array.
+        int num = hrefList.size();
+        String[] pathnames = new String[num];
+        for (int i = 0; i < num; i++) {
+            pathnames[i] = (String) hrefList.elementAt(i);
+        }
+
+        return pathnames;
+    }
+
+
+    /**
+     * Get an array of pathnames and basic information denoting the WebDAV
+     * resources in the denoted by this pathname.
+     *
+     * array 0: displayname
+     * array 1: getcontentlength
+     * array 2: iscollection or getcontentype
+     * array 3: getlastmodifieddate
+     * array 4: name
+     *
+     * @return An array of pathnames and more denoting the resources.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Vector listBasic()
+        throws HttpException, IOException {
+
+        setBasicProperties(DepthSupport.DEPTH_1);
+        Enumeration hrefs = childResources.getResourceNames();
+
+        Vector hrefList = new Vector();
+        while (hrefs.hasMoreElements()) {
+            try {
+                String resourceName = (String) hrefs.nextElement();
+                WebdavResource currentResource =
+                    childResources.getResource(resourceName);
+
+                String[] longFormat = new String[5];
+                // displayname.
+                longFormat[0] = currentResource.getDisplayName();
+
+
+                long length = currentResource.getGetContentLength();
+                // getcontentlength
+                longFormat[1] = new Long(length).toString();
+                // resourcetype
+                ResourceTypeProperty resourceTypeProperty =
+                    currentResource.getResourceType();
+                // getcontenttype
+                String getContentType =
+                    currentResource.getGetContentType();
+                longFormat[2] = resourceTypeProperty.isCollection() ?
+                    "COLLECTION" : getContentType ;
+                Date date = new Date(currentResource.getGetLastModified());
+                // getlastmodified
+                // Save the dummy what if failed.
+                longFormat[3] = (date == null) ? "-- -- ----" :
+                    // Print the local fancy date format.
+                    DateFormat.getDateTimeInstance().format(date);
+                hrefList.addElement(longFormat);
+
+                // real name of componente
+                longFormat[4] = currentResource.getName();
+
+
+            } catch (Exception e) {
+                // FIXME: After if's gotten an exception, any solution?
+                if (debug > 0)
+                    e.printStackTrace();
+                //log.error(e,e);
+            }
+        }
+
+        return hrefList;
+    }
+
+
+    /**
+     * Set the URL encoding flag for this http URL.
+     *
+     * @param encodeURLs true if it is encoded.
+     * @exception MalformedURLException
+     * @exception IOException
+     *
+     * @deprecated  No longer has any effect.
+     */
+    public void setEncodeURLs(boolean encodeURLs) {
+
+    }
+
+
+    // -------------------------- General accessor to use http request methods.
+
+
+    /**
+     * Retrieve the current http client for this resource.
+     *
+     * @return The http client.
+     * @see #executeHttpRequestMethod(HttpClient, HttpMethod)
+     */
+    public HttpClient retrieveSessionInstance()
+        throws IOException {
+
+        setClient();
+        return client;
+    }
+
+
+    /**
+     * Execute the http request method.  And get its status code.
+     *
+     * @param client The http client.
+     * @param method The http method.
+     * @return The status code.
+     * @see #retrieveSessionInstance()
+     */
+    public int executeHttpRequestMethod(HttpClient client, HttpMethod method)
+        throws IOException, HttpException {
+
+        client.executeMethod(method);
+        return method.getStatusCode();
+    }
+
+
+    // --------------------------------- WebDAV Request-method Public Methods
+
+    /**
+     * Updates the resource with a new set of aces.
+     *
+     * @param path the server relative path of the resource to which the given
+     *        ACEs shall be applied
+     * @param aces the ACEs to apply
+     * @return true if the method succeeded
+     */
+    public boolean aclMethod(String path, Ace[] aces)
+        throws HttpException, IOException {
+
+        setClient();
+
+        AclMethod method = new AclMethod(URIUtil.encodePath(path));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        for (int i=0; i<aces.length ; i++) {
+            Ace ace = aces[i];
+            method.addAce(ace);
+        }
+
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Return the <code>AclProperty</code> for the current resource
+     *
+     * @return acl property, null if the server doesn't respond with
+     * <code>AclProperty</code>
+     */
+    public AclProperty aclfindMethod() throws HttpException, IOException {
+        thisResource = true;
+        return aclfindMethod(httpURL.getPath());
+    }
+
+
+    /**
+     * Return the <code>AclProperty</code> for the resource at the given path
+     *
+     * @param path the server relative path of the resource to request
+     * @return acl property, null if the server doesn't respond with
+     * <code>AclProperty</code>
+     */
+    public AclProperty aclfindMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+
+        AclProperty acl = null;
+
+        Vector properties = new Vector();
+        properties.addElement(AclProperty.TAG_NAME);
+
+        // Default depth=0, type=by_name
+        PropFindMethod method = new PropFindMethod(URIUtil.encodePath(path),
+                                                   DepthSupport.DEPTH_0,
+                                                   properties.elements());
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        Enumeration responses = method.getResponses();
+        if (responses.hasMoreElements()) {
+            ResponseEntity response =
+                (ResponseEntity) responses.nextElement();
+            String href = response.getHref();
+
+            // Set status code for this resource.
+            if ((thisResource == true) && (response.getStatusCode() > 0))
+                setStatusCode(response.getStatusCode());
+            thisResource = false;
+
+            Enumeration responseProperties =
+                method.getResponseProperties(href);
+            while (responseProperties.hasMoreElements()) {
+                Property property =
+                    (Property) responseProperties.nextElement();
+                if (property instanceof AclProperty) {
+                    acl = (AclProperty)property;
+                }
+
+            }
+        }
+
+        return acl;
+    }
+
+
+    /**
+     * Get the <code>PrincipalCollectionSetProperty</code> for the current
+     * resource.
+     *
+     * @return principal collection set Property, null if the server doesn't
+     * respond with a <code>PrincipalCollectionSetProperty</code>
+     */
+    public PrincipalCollectionSetProperty principalCollectionSetFindMethod()
+        throws HttpException, IOException {
+        thisResource = true;
+        return principalCollectionSetFindMethod(httpURL.getPath());
+    }
+
+    /**
+     * Get the <code>PrincipalCollectionSetProperty</code> for the resource.
+     *
+     * @param path the server relative path of the resource to request
+     * @return principal collection set Property, null if the server doesn't
+     * respond with a <code>PrincipalCollectionSetProperty</code>
+     */
+    public PrincipalCollectionSetProperty principalCollectionSetFindMethod(
+        String path) throws HttpException, IOException {
+
+        setClient();
+
+        PrincipalCollectionSetProperty set = null;
+
+        Vector properties = new Vector();
+        properties.addElement(PrincipalCollectionSetProperty.TAG_NAME);
+
+        // Default depth=0, type=by_name
+        PropFindMethod method = new PropFindMethod(URIUtil.encodePath(path),
+                                                   DepthSupport.DEPTH_0,
+                                                   properties.elements());
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        Enumeration responses = method.getResponses();
+        if (responses.hasMoreElements()) {
+            ResponseEntity response =
+                (ResponseEntity) responses.nextElement();
+            String href = response.getHref();
+
+            // Set status code for this resource.
+            if ((thisResource == true) && (response.getStatusCode() > 0))
+                setStatusCode(response.getStatusCode());
+            thisResource = false;
+
+            Enumeration responseProperties =
+                method.getResponseProperties(href);
+            while (responseProperties.hasMoreElements()) {
+                Property property =
+                    (Property) responseProperties.nextElement();
+                if (property instanceof PrincipalCollectionSetProperty) {
+                    set = (PrincipalCollectionSetProperty)property;
+                }
+
+            }
+        }
+
+        return set;
+    }
+
+
+    /**
+     * Return the LockDiscoveryProperty for the current resource
+     *
+     * @return null if the server doesn't respond with a LockDiscoveryProperty
+     */
+    public LockDiscoveryProperty lockDiscoveryPropertyFindMethod()
+        throws HttpException, IOException {
+        thisResource = true;
+        return lockDiscoveryPropertyFindMethod(httpURL.getPath());
+    }
+
+
+    /**
+     * Return the LockDiscoveryProperty for the resource at the given path
+     *
+     * @param path the server relative path of the resource to request
+     * @return null if the server doesn't respond with a LockDiscoveryProperty
+     */
+    public LockDiscoveryProperty lockDiscoveryPropertyFindMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+
+        LockDiscoveryProperty set = null;
+
+        Vector properties = new Vector();
+        properties.addElement(LockDiscoveryProperty.TAG_NAME);
+
+        // Default depth=0, type=by_name
+        PropFindMethod method = new PropFindMethod(URIUtil.encodePath(path),
+                                                   DepthSupport.DEPTH_0,
+                                                   properties.elements());
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        Enumeration responses = method.getResponses();
+        if (responses.hasMoreElements()) {
+            ResponseEntity response =
+                (ResponseEntity) responses.nextElement();
+            String href = response.getHref();
+
+            // Set status code for this resource.
+            if ((thisResource == true) && (response.getStatusCode() > 0))
+                setStatusCode(response.getStatusCode());
+            thisResource = false;
+
+            Enumeration responseProperties =
+                method.getResponseProperties(href);
+            while (responseProperties.hasMoreElements()) {
+                Property property =
+                    (Property) responseProperties.nextElement();
+                if (property instanceof LockDiscoveryProperty) {
+                    set = (LockDiscoveryProperty)property;
+                }
+
+            }
+        }
+
+        return set;
+    }
+
+
+    /**
+     * Get InputStream for the GET method.
+     *
+     * @return InputStream
+     * @exception HttpException
+     * @exception IOException
+     */
+    public InputStream getMethodData()
+        throws HttpException, IOException {
+
+        return getMethodData(httpURL.getPathQuery());
+    }
+
+
+    /**
+     * Get InputStream for the GET method for the given path.
+     *
+     * @param path the server relative path of the resource to get
+     * @return InputStream
+     * @exception HttpException
+     * @exception IOException
+     */
+    public InputStream getMethodData(String path)
+        throws HttpException, IOException {
+
+        setClient();
+
+        GetMethod method = new GetMethod(URIUtil.encodePathQuery(path));
+
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        int statusCode = method.getStatusLine().getStatusCode();
+        setStatusCode(statusCode);
+
+        if(statusCode >= 200 && statusCode < 300)
+            return method.getResponseBodyAsStream();
+        else
+            throw new IOException("Couldn't get file");
+    }
+
+
+    /**
+     * Get data as a String for the GET method.
+     *
+     * @return the contents of this resource as a string
+     * @exception HttpException
+     * @exception IOException
+     */
+    public String getMethodDataAsString()
+        throws HttpException, IOException {
+
+        return getMethodDataAsString(httpURL.getPathQuery());
+    }
+
+
+    /**
+     * Get data as a String for the GET method for the given path.
+     *
+     * @param path the server relative path of the resource to get
+     * @return the contents of the given resource as a string
+     * @exception HttpException
+     * @exception IOException
+     */
+    public String getMethodDataAsString(String path)
+        throws HttpException, IOException {
+
+        setClient();
+        GetMethod method = new GetMethod(URIUtil.encodePathQuery(path));
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        return method.getResponseBodyAsString();
+    }
+
+
+    /**
+     * Execute the GET method for this WebdavResource path.
+     *
+     * @param file The local file.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean getMethod(File file)
+        throws HttpException, IOException {
+
+        return getMethod(httpURL.getPathQuery(), file);
+    }
+
+
+    /**
+     * Execute the GET method for the given path.
+     *
+     * @param path the server relative path of the resource to get
+     * @param file The local file.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean getMethod(String path, File file)
+        throws HttpException, IOException {
+
+        setClient();
+        GetMethod method = new GetMethod(URIUtil.encodePathQuery(path));
+
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        // get the file only if status is any kind of OK
+        if (statusCode >= 200 && statusCode < 300) {
+
+            // Do a simple little loop to read the response back into the passed
+            // file parameter.
+            InputStream inStream = method.getResponseBodyAsStream();
+
+            FileOutputStream fos = new FileOutputStream(file);
+            byte buffer[] = new byte[65535];
+            int bytesRead;
+            while ((bytesRead = inStream.read(buffer)) >= 0) {
+                fos.write(buffer, 0, bytesRead);
+            }
+            inStream.close();
+            fos.close();
+
+            return true;
+
+        } else {
+            return false;
+
+        }
+
+
+   }
+
+
+    /**
+     * Execute the PUT method for this resource.
+     *
+     * @param data The byte array.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(byte[] data)
+        throws HttpException, IOException {
+
+        boolean result = putMethod(httpURL.getPathQuery(), data);
+        if (result) refresh();
+        return result;
+    }
+
+
+    /**
+     * Execute the PUT method for the given path.
+     *
+     * @param path the server relative path to put the data
+     * @param data The byte array.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(String path, byte[] data)
+        throws HttpException, IOException {
+
+        setClient();
+        PutMethod method = new PutMethod(URIUtil.encodePathQuery(path));
+        generateIfHeader(method);
+        if (getGetContentType() != null && !getGetContentType().equals(""))
+            method.setRequestHeader("Content-Type", getGetContentType());
+
+        method.setRequestHeader("Content-Length", String.valueOf(data.length));
+        method.setRequestBody(new ByteArrayInputStream(data));
+
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the PUT method for this resource.
+     *
+     * @param is The input stream.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(InputStream is)
+        throws HttpException, IOException {
+
+        return putMethod(httpURL.getPathQuery(), is);
+    }
+
+
+    /**
+     * Execute the PUT method for the given path.
+     *
+     * @param path the server relative path to put the data
+     * @param is The input stream.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(String path, InputStream is)
+        throws HttpException, IOException {
+
+        setClient();
+        PutMethod method = new PutMethod(URIUtil.encodePathQuery(path));
+        generateIfHeader(method);
+        if (getGetContentType() != null && !getGetContentType().equals(""))
+            method.setRequestHeader("Content-Type", getGetContentType());
+        method.setRequestContentLength(PutMethod.CONTENT_LENGTH_CHUNKED);
+        method.setRequestBody(is);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the PUT method for this WebdavResource.
+     *
+     * @param data String</cdoe> data to send.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(String data)
+        throws HttpException, IOException {
+
+        boolean result = putMethod(httpURL.getPathQuery(), data);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute the PUT method for the given path.
+     *
+     * @param path the server relative path to put the data
+     * @param data String to send.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(String path, String data)
+        throws HttpException, IOException {
+
+        setClient();
+        PutMethod method = new PutMethod(URIUtil.encodePathQuery(path));
+        generateIfHeader(method);
+        if (getGetContentType() != null && !getGetContentType().equals(""))
+            method.setRequestHeader("Content-Type", getGetContentType());
+        method.setRequestBody(data);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the PUT method for this WebdavResource.
+     *
+     * @param file the filename to get on local.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(File file)
+        throws HttpException, IOException {
+
+        boolean result = putMethod(httpURL.getPathQuery(), file);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute the PUT method for the given path.
+     *
+     * @param path the server relative path to put the given file
+     * @param file the filename to get on local.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(String path, File file)
+        throws HttpException, IOException {
+
+        setClient();
+        PutMethod method = new PutMethod(URIUtil.encodePathQuery(path));
+        generateIfHeader(method);
+        if (getGetContentType() != null && !getGetContentType().equals(""))
+            method.setRequestHeader("Content-Type", getGetContentType());
+        long fileLength = file.length();
+        method.setRequestContentLength(fileLength <= Integer.MAX_VALUE
+                                       ? (int) fileLength
+                                       : PutMethod.CONTENT_LENGTH_CHUNKED);
+        method.setRequestBody(new FileInputStream(file));
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+
+    /**
+     * Execute the PUT method for this resource from the given url.
+     * It's like a streaming copy about a resource of the specified remote url
+     * to another remote url of this resource.
+     *
+     * @param url The URL to get a resource.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(URL url)
+        throws HttpException, IOException {
+
+        boolean result = putMethod(httpURL.getPathQuery(), url);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute the PUT method for the given path from the given url.
+     *
+     * @param path the server relative path to put the data
+     * @param url The URL to get a resource.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean putMethod(String path, URL url)
+        throws HttpException, IOException {
+
+        setClient();
+        PutMethod method = new PutMethod(URIUtil.encodePathQuery(path));
+        generateIfHeader(method);
+        if (getGetContentType() != null && !getGetContentType().equals(""))
+            method.setRequestHeader("Content-Type", getGetContentType());
+        method.setRequestBody(url.openStream());
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute OPTIONS method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean optionsMethod()
+        throws HttpException, IOException {
+
+        return optionsMethod(httpURL.getPath());
+    }
+
+
+    /**
+     * Execute OPTIONS method for the given path.
+     *
+     * @param path the server relative path of the resource to request
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @see #getAllowedMethods()
+     */
+    public boolean optionsMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+        OptionsMethod method;
+        if (path.trim().equals("*"))
+            method = new OptionsMethod("*");
+        else
+            method = new OptionsMethod(URIUtil.encodePath(path));
+
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        if  (statusCode >= 200 && statusCode < 300) {
+            // check if the specific method is possbile
+            allowedMethods = method.getAllowedMethods();
+            // check WebDAV capabilities.
+            davCapabilities = method.getDavCapabilities();
+            return true;
+        }
+
+        return false;
+    }
+
+
+    /**
+     * Execute OPTIONS method for the given path.
+     *
+     * @param path the server relative path to send the request
+     * @param aMethod a method to check it's supported.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean optionsMethod(String path, String aMethod)
+        throws HttpException, IOException {
+
+        if (aMethod != null && optionsMethod(path)) {
+            while (allowedMethods.hasMoreElements()) {
+                if (aMethod.equalsIgnoreCase((String)
+                                                 allowedMethods.nextElement()))
+                    return true;
+            }
+        }
+
+        return false;
+    }
+
+
+    /**
+     * Execute OPTIONS method for the given http URL.
+     *
+     * @param httpURL the http URL.
+     * @return the allowed methods and capabilities.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration optionsMethod(HttpURL httpURL)
+        throws HttpException, IOException {
+
+        HttpClient client = getSessionInstance(httpURL, true);
+
+        OptionsMethod method = new OptionsMethod(httpURL.getEscapedPath());
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        Vector options = new Vector();
+        int statusCode = method.getStatusLine().getStatusCode();
+        if (statusCode >= 200 && statusCode < 300) {
+            // check if the specific method is possbile
+            Enumeration allowedMethods = method.getAllowedMethods();
+            while (allowedMethods.hasMoreElements()) {
+                options.addElement(allowedMethods.nextElement());
+            }
+            // check WebDAV capabilities.
+            Enumeration davCapabilities = method.getDavCapabilities();
+            while (davCapabilities.hasMoreElements()) {
+                options.addElement(davCapabilities.nextElement());
+            }
+            Enumeration responses = method.getResponses();
+            if (responses.hasMoreElements()) {
+                ResponseEntity response =
+                    (ResponseEntity) responses.nextElement();
+                Enumeration workspaces = response.getWorkspaces();
+                String sResult="";
+                while (workspaces.hasMoreElements()){
+                    sResult += workspaces.nextElement().toString();
+                }
+                Enumeration histories = response.getHistories();
+                while (histories.hasMoreElements()){
+                    sResult += histories.nextElement().toString();
+                }
+                // Set status code for this resource.
+                if ((thisResource == true) && (response.getStatusCode() > 0))
+                    setStatusCode(response.getStatusCode());
+                thisResource = false;
+                options.addElement(sResult);
+            }
+        }
+
+        return options.elements();
+    }
+
+
+    /**
+     * Execute OPTIONS method for the given http URL, DELTAV
+     *
+     * @param httpURL the http URL.
+     * @return the allowed methods and capabilities.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration optionsMethod(HttpURL httpURL, int type)
+        throws HttpException, IOException {
+
+        HttpClient client = getSessionInstance(httpURL, true);
+
+        OptionsMethod method = new OptionsMethod(httpURL.getEscapedPath(),
+                                                 type);
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        Vector options = new Vector();
+        int statusCode = method.getStatusLine().getStatusCode();
+        if  (statusCode >= 200 && statusCode < 300) {
+            Enumeration responses = method.getResponses();
+            if (responses.hasMoreElements()) {
+                ResponseEntity response =
+                    (ResponseEntity) responses.nextElement();
+                // String sResult="";
+                if (type == OPTIONS_WORKSPACE){
+                    Enumeration workspaces = response.getWorkspaces();
+                    while (workspaces.hasMoreElements()){
+                        options.add(workspaces.nextElement().toString());
+                    }
+                } else if (type == OPTIONS_VERSION_HISTORY){
+                    Enumeration histories = response.getHistories();
+                    while (histories.hasMoreElements()){
+                        options.add(histories.nextElement().toString());
+                    }
+                }
+
+                // Set status code for this resource.
+                if ((thisResource == true) && (response.getStatusCode() > 0))
+                    setStatusCode(response.getStatusCode());
+                thisResource = false;
+                // options.addElement(sResult);
+            }
+        }
+
+        return options.elements();
+    }
+
+
+    /**
+     * Execute OPTIONS method for the given path.
+     *
+     * @param path the server relative path of the resource to request
+     * @return the allowed methods and capabilities.
+     * @exception HttpException
+     * @exception IOException
+     * @see #getAllowedMethods()
+     */
+    public Enumeration optionsMethod(String path, int type)
+        throws HttpException, IOException {
+
+        setClient();
+
+        OptionsMethod method = new OptionsMethod(URIUtil.encodePath(path),
+                                                 type);
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        Vector options = new Vector();
+        int statusCode = method.getStatusLine().getStatusCode();
+        if  (statusCode >= 200 && statusCode < 300) {
+            Enumeration responses = method.getResponses();
+            if (responses.hasMoreElements()) {
+                ResponseEntity response =
+                    (ResponseEntity) responses.nextElement();
+                // String sResult="";
+                if (type == OPTIONS_WORKSPACE){
+                    Enumeration workspaces = response.getWorkspaces();
+                    while (workspaces.hasMoreElements()){
+                        options.add(workspaces.nextElement().toString());
+                    }
+                } else if (type == OPTIONS_VERSION_HISTORY){
+                    Enumeration histories = response.getHistories();
+                    while (histories.hasMoreElements()){
+                        options.add(histories.nextElement().toString());
+                    }
+                }
+
+                // Set status code for this resource.
+                if ((thisResource == true) && (response.getStatusCode() > 0))
+                    setStatusCode(response.getStatusCode());
+                thisResource = false;
+                // options.addElement(sResult);
+            }
+        }
+
+        return options.elements();
+    }
+
+    /**
+     * Execute a LABEL method on the current path, setting the given label
+     *
+     * @param labelname the label to set
+     * @param type the type of action. One of:
+     *        <ul>
+     *        <li> LABEL_ADD
+     *        <li> LABEL_REMOVE
+     *        <li> LABEL_SET
+     *        </ul>
+     * @return true if the method succeeded
+     */
+    public boolean labelMethod(String labelname, int type)
+        throws HttpException, IOException {
+        return labelMethod(httpURL.getPath(), labelname, type);
+    }
+
+    /**
+     * Execute a LABEL method on the given path, setting the given label
+     *
+     * @param path the server relative path of the resource to act on
+     * @param labelname the label to set
+     * @param type the type of action. One of:
+     *        <ul>
+     *        <li> LABEL_ADD
+     *        <li> LABEL_REMOVE
+     *        <li> LABEL_SET
+     *        </ul>
+     * @return true if the method succeeded
+     */
+    public boolean labelMethod(String path, String labelname, int type)
+        throws HttpException, IOException {
+        int labeltype=0;
+
+        switch(type) {
+            case LABEL_SET:
+                labeltype = LabelMethod.LABEL_SET;
+                break;
+            case LABEL_REMOVE:
+                labeltype = LabelMethod.LABEL_REMOVE;
+                break;
+            case LABEL_ADD:
+                labeltype = LabelMethod.LABEL_ADD;
+                break;
+        }
+
+        setClient();
+        LabelMethod method = new LabelMethod(URIUtil.encodePath(path),
+                                             labeltype, labelname);
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+    /**
+     * Execute the REPORT method.
+     */
+    public Enumeration reportMethod(HttpURL httpURL, int depth)
+
+        throws HttpException, IOException {
+        setClient();
+        // Default depth=0, type=by_name
+        ReportMethod method = new ReportMethod(httpURL.getEscapedPath(),
+                                               depth);
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        Vector results = new Vector();
+
+        Enumeration responses = method.getResponses();
+        while (responses.hasMoreElements()) {
+            ResponseEntity response = (ResponseEntity) responses.nextElement();
+            String href = response.getHref();
+            String sResult = href;
+
+            // Set status code for this resource.
+            if ((thisResource == true) && (response.getStatusCode() > 0))
+                setStatusCode(response.getStatusCode());
+            thisResource = false;
+
+            Enumeration responseProperties = method.getResponseProperties(href);
+            while (responseProperties.hasMoreElements()) {
+                Property property = (Property) responseProperties.nextElement();
+                sResult += "\n" + property.getName() + ":\t" +
+                    DOMUtils.getTextValue(property.getElement());
+
+            }
+            results.addElement(sResult);
+        }
+
+        return results.elements();
+    }
+
+    public Enumeration reportMethod(HttpURL httpURL, Vector properties)
+
+        throws HttpException, IOException {
+        setClient();
+        // Default depth=0, type=by_name
+        ReportMethod method =
+            new ReportMethod(httpURL.getEscapedPath(), DepthSupport.DEPTH_0,
+                             properties.elements());
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        return method.getResponses();
+    }
+
+    public Enumeration reportMethod(HttpURL httpURL, Vector properties,
+                                    int depth)
+
+        throws HttpException, IOException {
+        setClient();
+        // Default depth=0, type=by_name
+        ReportMethod method = new ReportMethod(httpURL.getEscapedPath(), depth,
+                                               properties.elements());
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        /*first draft, does work anyhow
+         Enumeration results = method.getAllResponseURLs();
+
+         return results;*/
+        /*  Enumeration responses = method.getResponses();
+         ResponseEntity response = (ResponseEntity) responses.nextElement();
+         String href = (String) response.getHref();
+         Enumeration results = method.getResponseProperties(href);
+
+         return results;*/
+
+        Vector results = new Vector();
+
+        Enumeration responses = method.getResponses();
+        while (responses.hasMoreElements()) {
+            ResponseEntity response = (ResponseEntity) responses.nextElement();
+            String href = response.getHref();
+            String sResult = href;
+
+            // Set status code for this resource.
+            if ((thisResource == true) && (response.getStatusCode() > 0))
+                setStatusCode(response.getStatusCode());
+            thisResource = false;
+
+            Enumeration responseProperties = method.getResponseProperties(href);
+            while (responseProperties.hasMoreElements()) {
+                Property property = (Property) responseProperties.nextElement();
+                sResult += "\n" + property.getName() + ":\t" +
+                    DOMUtils.getTextValue(property.getElement());
+                // results.addElement(DOMUtils.getTextValue(property.getElement()));
+            }
+            results.addElement(sResult);
+        }
+
+        return results.elements();
+    }
+
+
+    // locate-by-history Report
+    public Enumeration reportMethod(HttpURL httpURL, Vector properties,
+                                    Vector histUri, int depth)
+
+        throws HttpException, IOException {
+        setClient();
+        // Default depth=0, type=by_name
+        ReportMethod method = new ReportMethod(httpURL.getEscapedPath(), depth,
+                                               properties.elements(),
+                                               histUri.elements());
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        Vector results = new Vector();
+
+        Enumeration responses = method.getResponses();
+        while (responses.hasMoreElements()) {
+            ResponseEntity response = (ResponseEntity) responses.nextElement();
+            String href = response.getHref();
+            String sResult = href;
+
+            // Set status code for this resource.
+            if ((thisResource == true) && (response.getStatusCode() > 0))
+                setStatusCode(response.getStatusCode());
+            thisResource = false;
+
+            Enumeration responseProperties = method.getResponseProperties(href);
+            while (responseProperties.hasMoreElements()) {
+                Property property = (Property) responseProperties.nextElement();
+                sResult += "\n" + property.getName() + ":\t" +
+                    DOMUtils.getTextValue(property.getElement());
+            }
+            results.addElement(sResult);
+        }
+
+        return results.elements();
+    }
+    // expand-property Report
+    public Enumeration reportMethod(HttpURL httpURL, String sQuery, int depth)
+
+        throws HttpException, IOException {
+        setClient();
+        // Default depth=0, type=by_name
+        ReportMethod method = new ReportMethod(httpURL.getEscapedPath(), depth,
+                                               sQuery);
+
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        client.executeMethod(method);
+
+        Vector results = new Vector();
+
+        Enumeration responses = method.getResponses();
+        while (responses.hasMoreElements()) {
+            ResponseEntity response = (ResponseEntity) responses.nextElement();
+            //String href = (String) response.getHref();
+            String sResult; //= href;
+
+            // Set status code for this resource.
+            if ((thisResource == true) && (response.getStatusCode() > 0))
+                setStatusCode(response.getStatusCode());
+            thisResource = false;
+
+            sResult = response.toString();
+            /*while (responseProperties.hasMoreElements()) {
+             Property property = (Property) responseProperties.nextElement();
+             sResult += "\t" + DOMUtils.getTextValue(property.getElement());
+
+             }*/
+            results.addElement(sResult);
+        }
+
+        return results.elements();
+    }
+
+
+    /**
+     * Execute PROPFIND method with allprop for this WebdavResource.
+     * Get list of all WebDAV properties on this WebDAV resource.
+     *
+     * <p>Once used this method, the the status code in the 207
+     * reponse is need to be set for the method of WebdavResource.
+     *
+     * <p>The values of DepthSupport.DEPTH_0, DepthSupport.DEPTH_1,
+     * DepthSupport.DEPTH_INFINITY is possbile for the depth.
+     *
+     * @param depth
+     * @return an enumeration of <code>ResponseEntity</code>
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration propfindMethod(int depth)
+        throws HttpException, IOException {
+
+        thisResource = true;
+        return propfindMethod(httpURL.getPath(), depth);
+    }
+
+
+    /**
+     * Execute PROPFIND method with allprop for the given path.
+     * Get list of all WebDAV properties on the given resource.
+     *
+     * <p>Once used this method, the the status code in the 207
+     * reponse is need to be set for the method of WebdavResource.
+     *
+     * <p>The values of DepthSupport.DEPTH_0, DepthSupport.DEPTH_1,
+     * DepthSupport.DEPTH_INFINITY is possbile for the depth.
+     *
+     * @param path the server relative path of the resource to request
+     * @param depth
+     * @return an enumeration of <code>ResponseEntity</code>
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration propfindMethod(String path, int depth)
+        throws HttpException, IOException {
+
+        setClient();
+        // Change the depth for allprop
+        PropFindMethod method = new PropFindMethod(URIUtil.encodePath(path),
+                                                   depth);
+
+        method.setDebug(debug);
+
+        // Default depth=infinity, type=allprop
+        generateTransactionHeader(method);
+        int status = client.executeMethod(method);
+
+        // Set status code for this resource.
+        if (thisResource == true) {
+            setStatusCode(status);
+        }
+        // Also accept OK sent by buggy servers.
+        if (status != HttpStatus.SC_MULTI_STATUS
+            && status != HttpStatus.SC_OK) {
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            throw ex;
+        }
+        thisResource = false;
+
+        return method.getResponses();
+    }
+
+
+
+    /**
+     * Execute PROPFIND method with by propname for this resource.
+     * Get list of named WebDAV properties on this resource.
+     *
+     * <p>Once used this method, the the status code in the 207
+     * reponse is need to be set for the method of WebdavResource.
+     *
+     * <p>The values of DepthSupport.DEPTH_0, DepthSupport.DEPTH_1
+     * DepthSupport.DEPTH_INFINITY is possbile for the depth.
+     *
+     * @param depth The depth.
+     * @param properties The named properties.
+     * @return an enumeration of <code>ResponseEntity</code>
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration propfindMethod(int depth, Vector properties)
+        throws HttpException, IOException {
+
+        thisResource = true;
+        return propfindMethod(httpURL.getPath(), depth, properties);
+    }
+
+
+    /**
+     * Execute PROPFIND method with by propname for the given path.
+     * Get list of named WebDAV properties on the given resource.
+     *
+     * <p>Once used this method, the the status code in the 207
+     * reponse is need to be set for the method of WebdavResource.
+     *
+     * <p>The values of DepthSupport.DEPTH_0, DepthSupport.DEPTH_1
+     * DepthSupport.DEPTH_INFINITY is possbile for the depth.
+     *
+     * @param path the server relative path of the resource to request
+     * @param depth The depth.
+     * @param properties The named properties.
+     * @return an enumeration of <code>ResponseEntity</code>
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration propfindMethod(String path, int depth,
+                                      Vector properties)
+        throws HttpException, IOException {
+
+        setClient();
+        // Change the depth for prop
+        PropFindMethod method = new PropFindMethod(URIUtil.encodePath(path),
+                                                   depth,
+                                                   properties.elements());
+
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        int status = client.executeMethod(method);
+
+        // Set status code for this resource.
+        if (thisResource == true) {
+            // Set the status code.
+            setStatusCode(method.getStatusLine().getStatusCode());
+        }
+        // Also accept OK sent by buggy servers.
+        if (status != HttpStatus.SC_MULTI_STATUS
+            && status != HttpStatus.SC_OK) {
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            throw ex;
+        }
+        thisResource = false;
+
+        return method.getResponses();
+    }
+
+
+    /**
+     * Execute PROPFIND method for this WebdavResource.
+     * Get list of given WebDAV properties on this WebDAV resource.
+     *
+     * @param propertyName the WebDAV property to find.
+     * @return Enumeration list of WebDAV properties on a resource.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration propfindMethod(String propertyName)
+        throws HttpException, IOException {
+
+        Vector property = new Vector();
+        property.addElement(propertyName);
+
+        thisResource = true;
+        return propfindMethod(httpURL.getPath(), property);
+    }
+
+
+    /**
+     * Execute PROPFIND method for the given WebdavResource path.
+     * Get list of given WebDAV properties on this WebDAV resource.
+     *
+     * @param path the server relative path of the resource to request
+     * @param propertyName the WebDAV property to find.
+     * @return Enumeration list of WebDAV properties on a resource.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration propfindMethod(String path, String propertyName)
+        throws HttpException, IOException {
+
+        Vector property = new Vector();
+        property.addElement(propertyName);
+
+        thisResource = false;
+        return propfindMethod(path, property);
+    }
+
+
+    /**
+     * Execute PROPFIND method for this WebdavResource.
+     * Get list of given WebDAV properties on this WebDAV resource.
+     *
+     * @param properties the WebDAV properties to find.
+     * @return Enumeration list of WebDAV properties on a resource.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration propfindMethod(Vector properties)
+        throws HttpException, IOException {
+
+        thisResource = true;
+        return propfindMethod(httpURL.getPath(), properties);
+    }
+
+
+    /**
+     * Execute PROPFIND method for the given path and properties.
+     * Get list of given WebDAV properties on the given resource.
+     *
+     * @param path the server relative path of the resource to request
+     * @param properties the WebDAV properties to find.
+     * @return Enumeration list of WebDAV properties on a resource.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration propfindMethod(String path, Vector properties)
+        throws HttpException, IOException {
+
+        setClient();
+        // Default depth=0, type=by_name
+        PropFindMethod method = new PropFindMethod(URIUtil.encodePath(path),
+                                                   DepthSupport.DEPTH_0,
+                                                   properties.elements());
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        int status = client.executeMethod(method);
+
+        // Also accept OK sent by buggy servers.
+        if (status != HttpStatus.SC_MULTI_STATUS
+            && status != HttpStatus.SC_OK) {
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            throw ex;
+        }
+
+        // It contains the results.
+        Vector results = new Vector();
+
+        Enumeration responses = method.getResponses();
+        if (responses.hasMoreElements()) {
+            ResponseEntity response =
+                (ResponseEntity) responses.nextElement();
+            String href = response.getHref();
+
+            // Set status code for this resource.
+            if ((thisResource == true) && (response.getStatusCode() > 0))
+                setStatusCode(response.getStatusCode());
+            thisResource = false;
+
+            Enumeration responseProperties =
+                method.getResponseProperties(href);
+            while (responseProperties.hasMoreElements()) {
+                Property property =
+                    (Property) responseProperties.nextElement();
+                results.addElement(property.getPropertyAsString());
+            }
+        }
+
+        return results.elements();
+    }
+
+
+    /**
+     * Execute PROPATCH method for this WebdavResource.
+     *
+     * @param propertyName the name of the property to set
+     * @param propertyValue the value of the property to set
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @deprecated it could be removed after the major version changes
+     */
+    public boolean proppatchMethod(String propertyName, String propertyValue)
+        throws HttpException, IOException {
+
+        boolean result = proppatchMethod(httpURL.getPath(),
+                                         propertyName, propertyValue, true);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute PROPATCH method for this resource with the given property.
+     *
+     * @param propertyName the property name string (in "DAV:" namespace)
+     * @param propertyValue the property value string
+     * If the proppatch action is being removed, the value is null or any.
+     * @param action true if it's being set, false if it's being removed
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean proppatchMethod(String propertyName, String propertyValue,
+                                   boolean action) throws HttpException, IOException {
+
+        boolean result = proppatchMethod(httpURL.getPath(),
+                                         propertyName, propertyValue, action);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute PROPATCH method for this WebdavResource.
+     *
+     * @param propertyName the name of the property to set
+     * @param propertyValue the value of the property to set
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @deprecated it could be removed after the major version changes
+     */
+    public boolean proppatchMethod(PropertyName propertyName,
+                                   String propertyValue)
+        throws HttpException, IOException {
+
+        boolean result = proppatchMethod(httpURL.getPath(),
+                                         propertyName, propertyValue, true);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute PROPATCH method for this resource with the given property.
+     *
+     * @param propertyName the name of the property to set
+     * @param propertyValue the value of the property to set
+     * If the proppatch action is being removed, the value is null or any.
+     * @param action true if it's being set, false if it's being removed
+     * @return true if the method is succeeded
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean proppatchMethod(PropertyName propertyName,
+                                   String propertyValue, boolean action)
+        throws HttpException, IOException {
+
+        boolean result = proppatchMethod(httpURL.getPath(),
+                                         propertyName, propertyValue, action);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute PROPATCH method for the given WebdavResource.
+     *
+     * @param path the server relative path of the resource to act on
+     * @param propertyName the property name in "DAV:" namespace
+     * @param propertyValue the property value string
+     * @return true if the method is succeeded
+     * @exception HttpException
+     * @exception IOException
+     * @deprecated it could be removed after the major version changes
+     */
+    public boolean proppatchMethod(String path, String propertyName,
+                                   String propertyValue) throws HttpException, IOException {
+
+        Hashtable property = new Hashtable();
+        property.put(propertyName, propertyValue);
+        return proppatchMethod(path, property, true);
+    }
+
+
+    /**
+     * Execute PROPATCH method for the specified resource with the given
+     * property.
+     *
+     * @param path the server relative path of the resource to act on
+     * @param propertyName the property name string (in "DAV:" namespace)
+     * @param propertyValue the property value string
+     * If the proppatch action is being removed, the value is null or any.
+     * @param action true if it's to be set, false if it's to be removed
+     * @return true if the method is succeeded
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean proppatchMethod(String path, String propertyName,
+                                   String propertyValue, boolean action)
+        throws HttpException, IOException {
+
+        Hashtable property = new Hashtable();
+        property.put(propertyName, propertyValue);
+        return proppatchMethod(path, property, action);
+    }
+
+
+    /**
+     * Execute PROPATCH method for the given WebdavResource.
+     *
+     * @param path the server relative path of the resource to act on
+     * @param propertyName the property name.
+     * @param propertyValue the property value.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @deprecated it could be removed after the major version changes
+     */
+    public boolean proppatchMethod(String path, PropertyName propertyName,
+                                   String propertyValue) throws HttpException, IOException {
+
+        Hashtable property = new Hashtable();
+        property.put(propertyName, propertyValue);
+
+        return proppatchMethod(path, property, true);
+    }
+
+
+    /**
+     * Execute PROPATCH method for the given resource with the given
+     * properties.
+     *
+     * @param path the server relative path of the resource to act on
+     * @param propertyName the property name
+     * @param propertyValue the property value string
+     * If the proppatch action is being removed, the value is null or any.
+     * @param action true if it's to be set, false if it's to be removed
+     * @return true if the method is succeeded
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean proppatchMethod(String path, PropertyName propertyName,
+                                   String propertyValue, boolean action)
+        throws HttpException, IOException {
+
+        Hashtable property = new Hashtable();
+        property.put(propertyName, propertyValue);
+        return proppatchMethod(path, property, action);
+    }
+
+
+    /**
+     * Execute PROPATCH method for this WebdavResource.
+     *
+     * @param properties name and value pairs to set
+     * (name can be a String or PropertyName)
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @deprecated it could be removed after the major version changes
+     */
+    public boolean proppatchMethod(Hashtable properties)
+        throws HttpException, IOException {
+
+        boolean result = proppatchMethod(httpURL.getPath(), properties, true);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute PROPATCH method for this resource with the given properties.
+     *
+     * @param properties the name(= <code>String</code> or <code>PropertyName
+     * </code> and value(= <code>String</code>) pairs for proppatch action
+     * If the proppatch action is being removed, the value is null or any.
+     * @param action true if it's being set, false if it's being removed
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean proppatchMethod(Hashtable properties, boolean action)
+        throws HttpException, IOException {
+
+        boolean result = proppatchMethod(httpURL.getPath(), properties, action);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute PROPATCH method for the given WebdavResource.
+     *
+     * @param path the server relative path of the resource to act on
+     * @param properties name and value pairs to set
+     * (name can be a String or PropertyName)
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @deprecated it could be removed after the major version changes
+     */
+    public boolean proppatchMethod(String path, Hashtable properties)
+        throws HttpException, IOException {
+
+        return proppatchMethod(path, properties, true);
+    }
+
+
+    /**
+     * Execute PROPATCH method for the specified resource with the given
+     * properties.
+     *
+     * @param path the server relative path of the resource to act on
+     * @param properties the name(= <code>String</code> or <code>PropertyName
+     * </code> and value(= <code>String</code>) pairs for proppatch action
+     * If the proppatch action is being removed, the value is null or any.
+     * @param action true if it's being set, false if it's being removed
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean proppatchMethod(String path, Hashtable properties,
+                                   boolean action) throws HttpException, IOException {
+
+        setClient();
+        PropPatchMethod method = new PropPatchMethod(URIUtil.encodePath(path));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        Enumeration names = properties.keys();
+        boolean hasSomething = false;
+        if (names.hasMoreElements()) {
+            hasSomething = true;
+        }
+        while (names.hasMoreElements()) {
+            Object item = names.nextElement();
+            if (item instanceof String) {
+                String name = (String) item;
+                String value = (String) properties.get(item);
+                if (action) {
+                    method.addPropertyToSet(name, value);
+                } else {
+                    method.addPropertyToRemove(name);
+                }
+            } else if (item instanceof PropertyName) {
+                String name         = ((PropertyName) item).getLocalName();
+                String namespaceURI = ((PropertyName) item).getNamespaceURI();
+                String value        = (String) properties.get(item);
+                if (action) {
+                    method.addPropertyToSet(name, value, null, namespaceURI);
+                } else {
+                    method.addPropertyToRemove(name, null, namespaceURI);
+                }
+            } else {
+                // unknown type, debug or ignore it
+            }
+        }
+        if (hasSomething) {
+            generateTransactionHeader(method);
+            int statusCode = client.executeMethod(method);
+            // Possbile Status Codes => SC_OK
+            // WebdavStatus.SC_FORBIDDEN, SC_CONFLICT, SC_LOCKED, 507
+            setStatusCode(statusCode);
+            if (statusCode >= 200 && statusCode < 300) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    /**
+     * Execute the HEAD method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean headMethod()
+        throws HttpException, IOException {
+
+        return headMethod(httpURL.getPathQuery());
+    }
+
+
+    /**
+     * Execute the HEAD method for the given path.
+     *
+     * @param path the server relative path of the resource to request
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean headMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+        HeadMethod method = new HeadMethod(URIUtil.encodePathQuery(path));
+
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the DELETE method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean deleteMethod()
+        throws HttpException, IOException {
+
+        boolean result = deleteMethod(httpURL.getPath());
+        if (result) {
+            setExistence(false);
+        }
+
+        return result;
+    }
+
+
+    /**
+     * Execute the DELETE method for the given path.
+     *
+     * @param path the server relative path of the resource to delete
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean deleteMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+        DeleteMethod method = new DeleteMethod(URIUtil.encodePath(path));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the MOVE method for this WebdavReource.
+     *
+     * @param destination the destination to move to as a server relative path
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean moveMethod(String destination)
+        throws HttpException, IOException {
+
+        boolean result = moveMethod(httpURL.getPath(), destination);
+        if (result) {
+            httpURL.setPath(destination);
+            refresh();
+        }
+
+        return result;
+    }
+
+
+    /**
+     * Execute the MOVE method for the given source and destination.
+     *
+     * @param source the source resource as a server relativ path
+     * @param destination the destination to move to as a server relative path
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean moveMethod(String source, String destination)
+        throws HttpException, IOException {
+
+        setClient();
+        MoveMethod method = new MoveMethod(URIUtil.encodePath(source),
+                                           URIUtil.encodePath(destination));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateIfHeader(method);
+        method.setOverwrite(overwrite);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        // Possbile MOVE Status Codes => SC_CREATED, SC_NO_CONTENT
+        // WebdavStatus.SC_FORBIDDEN, SC_CONFLICT, SC_PRECONDITION_FAILED,
+        // SC_LOCKED, SC_BAD_GATEWAY
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the COPY method for the given destination path.
+     *
+     * @param destination the destination as a server relative path
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean copyMethod(String destination)
+        throws HttpException, IOException {
+
+        boolean result = copyMethod(httpURL.getPath(), destination);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute the COPY method the given source and destination.
+     *
+     * @param source the source resource as a server relative path
+     * @param destination the destination as a server relative path
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean copyMethod(String source, String destination)
+        throws HttpException, IOException {
+
+        setClient();
+        CopyMethod method = new CopyMethod(URIUtil.encodePath(source),
+                                           URIUtil.encodePath(destination));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        method.setOverwrite(overwrite);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        // Possbile COPY Status Codes => SC_CREATED, SC_NO_CONTENT
+        // WebdavStatus.SC_FORBIDDEN, SC_CONFLICT, SC_PRECONDITION_FAILED,
+        // SC_LOCKED, SC_BAD_GATEWAY, SC_INSUFFICIENT_STORAGE
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+
+    /**
+     * Execute the MKCOL method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean mkcolMethod()
+        throws HttpException, IOException {
+
+        boolean result = mkcolMethod(httpURL.getPath());
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute the MKCOL method for the given path.
+     *
+     * @param path the server relative path at which to create a new collection
+     *        resource
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean mkcolMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+        MkcolMethod method = new MkcolMethod(URIUtil.encodePath(path));
+
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        // Possbile MKCOL Status Codes => SC_CREATED
+        // WebdavStatus.SC_FORBIDDEN, SC_METHOD_NOT_ALLOWED, SC_CONFLICT,
+        // SC_LOCKED, SC_UNSUPPORTED_MEDIA_TYPE, SC_INSUFFICIENT_STORAGE
+        setStatusCode(statusCode);
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the LOCK method for this WebdavResource. This method tries to
+     * acquire an exclusive write lock with a timeout of 120 seconds.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean lockMethod()
+        throws HttpException, IOException {
+
+        String owner = (httpURL.getUser() != null) ?
+            httpURL.getUser() : defaultOwner;
+
+        boolean result = lockMethod(httpURL.getPath(), owner, 120);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+
+    /**
+     * Execute the LOCK method for this WebdavResource. This method tries to
+     * acquire an exclusive write lock with the given timeout value.
+     *
+     * @param owner the owner string.
+     * @param timeout the timeout
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean lockMethod(String owner, int timeout)
+        throws HttpException, IOException {
+
+        boolean result = lockMethod(httpURL.getPath(), owner, timeout);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute the LOCK method for the given path. This method tries to acquire
+     * an exclusive write lock with a timeout of 120 seconds.
+     *
+     * @param path the server relative path of the resource to lock
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean lockMethod(String path)
+        throws HttpException, IOException {
+
+        String owner = (httpURL.getUser() != null) ?
+            httpURL.getUser() : defaultOwner;
+
+        return lockMethod(path, owner, 120);
+    }
+
+
+    /**
+     * Execute the LOCK method for the given path. This method tries to acquire
+     * an exclusive write lock with the given timeout value.
+     *
+     * @param path the server relative path of the resource to lock
+     * @param owner The owner string.
+     * @param timeout the timeout value.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean lockMethod(String path, String owner, int timeout)
+        throws HttpException, IOException {
+
+        return lockMethod(path, owner, timeout, LockMethod.SCOPE_EXCLUSIVE);
+    }
+
+    /**
+     * Execute the LOCK method for the given path. This method tries to acquire
+     * an exclusive write lock with the given timeout value.
+     *
+     * @param path the server relative path of the resource to lock
+     * @param owner The owner string.
+     * @param timeout the timeout value.
+     * @param locktype, the scope of lock.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean lockMethod(String path, String owner, int timeout, short lockType)
+        throws HttpException, IOException {
+
+        return lockMethod(path, owner, timeout, lockType, DepthSupport.DEPTH_INFINITY);    
+    }    
+    
+
+    /**
+     * Execute the LOCK method for the given path. This method tries to acquire
+     * an exclusive write lock with the given timeout value.
+     *
+     * @param path the server relative path of the resource to lock
+     * @param owner The owner string.
+     * @param timeout the timeout value.
+     * @param locktype, the scope of lock.
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean lockMethod(String path, String owner, int timeout, short lockType, int depth)
+        throws HttpException, IOException {            
+
+        setClient();
+
+        if (owner == null) {
+            owner = (httpURL.getUser() != null) ? httpURL.getUser() : defaultOwner;
+        }
+
+        // default lock type setting
+        LockMethod method = new LockMethod(URIUtil.encodePath(path), owner,
+                                           lockType, timeout);
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        method.setDepth(depth);        
+
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+        String lock = method.getLockToken();
+        WebdavState state = (WebdavState) client.getState();
+        if (state != null) {
+            state.addLock(path, lock);
+        }
+        this.owner = method.getOwner();
+
+        // Possbile LOCK Status Codes => SC_OK
+        // WebdavStatus.SC_SC_PRECONDITION_FAILED, SC_LOCKED
+        setStatusCode(statusCode, lock);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the LOCK method for this WebdavResource.
+     *
+     * @see LockMethod
+     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
+     */
+    public boolean lockMethod(String owner, short timeout)
+        throws HttpException, IOException {
+
+        return lockMethod(owner, (int) timeout);
+    }
+
+
+    /**
+     * Execute the LOCK method for the given path.
+     *
+     * @see LockMethod
+     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
+     */
+    public boolean lockMethod(String path, String owner, short timeout)
+        throws HttpException, IOException {
+
+        return lockMethod(path, owner, (int) timeout);
+    }
+
+    /**
+     * Begins a new transaction. 
+     * The transaction handle returned by the WebDAV server will be remembered and included
+     * as a header of subsequent requests until either {@link #commitTransaction()} or {@link #abortTransaction()}
+     * are called. You can retrieve it using {@link #getTransactionHandle()}.    
+     * 
+     * @param owner the owner of this transaction
+     * @param timeout timeout in milleseconds
+     * @return <code>true</code> if the transaction has been successfully started, <code>false</code> otherwise
+     * @throws IOException if anything goes wrong
+     * @see #commitTransaction()
+     * @see #abortTransaction()
+     * @see #getTransactionHandle()
+     */
+    public boolean startTransaction(String owner, int timeout) throws IOException {
+        String path = httpURL.getPath();
+        
+        setClient();
+
+        if (owner == null) {
+            owner = (httpURL.getUser() != null) ? httpURL.getUser() : defaultOwner;
+        }
+
+        // default lock type setting
+        LockMethod method = new LockMethod(path, owner, timeout, true);
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        int statusCode = client.executeMethod(method);
+        String txHandle = method.getLockToken();
+        WebdavState state = (WebdavState) client.getState();
+        if (state != null) {
+            state.setTransactionHandle(txHandle);
+        }
+        this.owner = method.getOwner();
+
+        // Possbile LOCK Status Codes => SC_OK
+        // WebdavStatus.SC_SC_PRECONDITION_FAILED, SC_LOCKED
+        setStatusCode(statusCode, txHandle);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+    /**
+     * Returns the transaction handle set by {@link #startTransaction(String, int)}. 
+     * 
+     * @return the current transaction handle or <code>null</code> if the client does not operate inside a transaction
+     * @throws IOException if anything goes wrong
+     * @see #startTransaction(String, int)
+     */
+    public String getTransactionHandle() throws IOException {
+        setClient();
+
+        // Get the lock for the given path.
+        WebdavState state = (WebdavState) client.getState();
+        if (state == null) return null;
+        String txHandle = state.getTransactionHandle();
+        return txHandle;
+    }
+    
+    /**
+     * Commits the transaction started by {@link #startTransaction(String, int)} and resets the transaction handle.
+     *  
+     * @return <code>true</code> if the transaction has been successfully committed, <code>false</code> otherwise
+     * @throws IOException if anything goes wrong
+     * @see #startTransaction(String, int)
+     * @see #abortTransaction()
+     * @see #getTransactionHandle()
+     */
+    public boolean commitTransaction() throws IOException {
+        String path = httpURL.getPath();
+        return endTransaction(path, UnlockMethod.COMMIT_TRANSACTION);
+    }
+
+    /**
+     * Aborts - i.e. rolls back all changes of - the transaction started by {@link #startTransaction(String, int)} and resets the transaction handle.
+     *  
+     * @return <code>true</code> if the transaction has been successfully committed, <code>false</code> otherwise
+     * @throws IOException if anything goes wrong
+     * @see #startTransaction(String, int)
+     * @see #abortTransaction()
+     * @see #getTransactionHandle()
+     */
+    public boolean abortTransaction() throws IOException {
+        String path = httpURL.getPath();
+        return endTransaction(path, UnlockMethod.ABORT_TRANSACTION);
+    }
+
+    protected boolean endTransaction(String path, int transactionStatus) throws IOException {
+        setClient();
+
+        // Get the lock for the given path.
+        WebdavState state = (WebdavState) client.getState();
+        if (state == null) return false;
+        String txHandle = state.getTransactionHandle();
+        if (txHandle == null) return false;
+        UnlockMethod method = new UnlockMethod(path, txHandle, transactionStatus);
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        if (statusCode >= 200 && statusCode < 300) {
+            state.setTransactionHandle(null);
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Execute the Unlock method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean unlockMethod() throws HttpException, IOException {
+
+        String owner = (httpURL.getUser() != null) ?
+            httpURL.getUser() : defaultOwner;
+
+        boolean result = unlockMethod(httpURL.getPath(), owner);
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute the Unlock method for the given path.
+     *
+     * @param path the server relative path of the resource to unlock
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean unlockMethod(String path)
+        throws HttpException, IOException {
+
+        String owner = (httpURL.getUser() != null) ?
+            httpURL.getUser() : defaultOwner;
+
+        return unlockMethod(path, owner);
+    }
+
+
+    /**
+     * Execute the Unlock method for the given path.
+     *
+     * @param path the server relative path of the resource to unlock
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean unlockMethod(String path, String owner)
+        throws HttpException, IOException {
+
+        setClient();
+
+        if (owner == null) {
+            owner = (httpURL.getUser() != null) ? httpURL.getUser() : defaultOwner;
+        }
+
+        // Get the lock for the given path.
+        WebdavState state = (WebdavState) client.getState();
+        // Discover the locktoken from the given lock owner
+
+        state = discoverLock(owner, path, state);
+        String lock = state.getLock(path);
+        if (lock == null) return false;
+        // unlock for the given path.
+        UnlockMethod method = new UnlockMethod(URIUtil.encodePath(path));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        method.setLockToken(lock);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+        if (statusCode >= 200 && statusCode < 300) {
+            state.removeLocks(path);
+            return true;
+        }
+
+        return false;
+    }
+
+
+    /**
+     * Discover and refresh lock tokens.
+     *
+     * @exception HttpException
+     * @exception IOException
+     */
+    public void discoverOwnLocks()
+    throws HttpException, IOException {
+
+        setClient();
+        String owner = (httpURL.getUser() != null) ?
+            httpURL.getUser() : defaultOwner;
+
+        WebdavState state = (WebdavState) client.getState();
+        state = discoverLock(owner, httpURL.getPath(), state);
+        client.setState(state);
+    }
+
+
+    /**
+     * Discover and refresh lock tokens for a specific owner.
+     *
+     * @param owner the owner who's locks are to be discovered.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public void discoverOwnLocks(String owner)
+    throws HttpException, IOException {
+
+        setClient();
+
+        WebdavState state = (WebdavState) client.getState();
+        state = discoverLock(owner, httpURL.getPath(), state);
+        client.setState(state);
+    }
+
+
+    /**
+     * Discover the given owner and locktoken and set the locktoken
+     *
+     * @param owner the activelock owner
+     * @param path the server relative path of the resource to request
+     * @param state the state to save the locktoken
+     * @return state probably having lock information renewly
+     */
+    protected WebdavState discoverLock(String owner, String path,
+                                       WebdavState state) {
+        try {
+            lockDiscovery=lockDiscoveryPropertyFindMethod(path);
+        } catch (Exception e) {
+            return state;
+        }
+
+
+        if (lockDiscovery == null) return state;
+        Lock[] activeLocks = lockDiscovery.getActiveLocks();
+
+        if (activeLocks == null) return state;
+        for (int i = 0; i < activeLocks.length; i++) {
+            String activeLockOwner = activeLocks[i].getOwner();
+            if (activeLockOwner.equals(owner)) {
+                String locktoken = activeLocks[i].getLockToken();
+                state.addLock(path, locktoken);
+            }
+        }
+        return state;
+    }
+
+
+    /**
+     * Update this resource to the specified target
+     *
+     * @param target the path of the history element to update this resource
+     *        from
+     * @return true if the method has succeeded
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean updateMethod(String target)
+        throws HttpException, IOException {
+
+        return updateMethod(httpURL.getPath(), target);
+    }
+
+
+    /**
+     * Update the specified resource to the specified target
+     *
+     * @param path the server relative path of the resource to update
+     * @param target path of the target to update from (history resource)
+     * @return true if the method has succeeded
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean updateMethod(String path, String target)
+        throws HttpException, IOException {
+
+        setClient();
+        UpdateMethod method = new UpdateMethod(URIUtil.encodePath(path),
+                                               URIUtil.encodePath(target));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    public boolean versionControlMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+
+        VersionControlMethod method = new VersionControlMethod(
+                                            URIUtil.encodePath(path));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    public boolean versionControlMethod(String path, String target)
+        throws HttpException, IOException {
+
+        setClient();
+
+        VersionControlMethod method = new VersionControlMethod(
+                                     URIUtil.encodePath(path),
+                                     URIUtil.encodePath(target));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the MKWORKSPACE method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean mkWorkspaceMethod()
+        throws HttpException, IOException {
+
+        boolean result = mkWorkspaceMethod(httpURL.getPath());
+        if (result) refresh();
+
+        return result;
+    }
+
+
+    /**
+     * Execute the MKCOL method for the given path.
+     *
+     * @param path the server relative path at which to create a new workspace
+     *        resource
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean mkWorkspaceMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+        MkWorkspaceMethod method =
+            new MkWorkspaceMethod(URIUtil.encodePath(path));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        // Possbile MKCOL Status Codes => SC_CREATED
+        // WebdavStatus.SC_FORBIDDEN, SC_METHOD_NOT_ALLOWED, SC_CONFLICT,
+        // SC_LOCKED, SC_UNSUPPORTED_MEDIA_TYPE, SC_INSUFFICIENT_STORAGE
+
+        setStatusCode(statusCode);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    // -------------------------------------------------------- Basic Methods
+
+
+    /**
+     * Compare to the WebdavResource object.
+     *
+     * @param another the other WebdavResource object
+     * @return the value 0 if the argument is equal.
+     */
+    public int compareToWebdavResource(WebdavResource another) {
+
+        try {
+            HttpURL anotherUrl = another.getHttpURL();
+
+            String thisHost = httpURL.getHost();
+            String anotherHost= anotherUrl.getHost();
+            if (!thisHost.equalsIgnoreCase(anotherHost))
+                return thisHost.compareTo(anotherHost);
+
+            int thisPort = httpURL.getPort();
+            int anotherPort= anotherUrl.getPort();
+            if (thisPort != anotherPort)
+                return (thisPort < anotherPort) ? -1 : 1;
+
+            boolean thisCollection = isCollection();
+            boolean anotherCollection = another.isCollection();
+            if (thisCollection && !anotherCollection)
+                return -1;
+            if (anotherCollection && !thisCollection)
+                return 1;
+
+            String thisPath = httpURL.getPathQuery();
+            String anotherPath= anotherUrl.getPathQuery();
+            return thisPath.compareTo(anotherPath);
+        } catch (Exception e) {
+            // FIXME: not to return 0.
+        }
+
+        return 0;
+    }
+
+
+    /**
+     * Compare to the given another object.
+     *
+     * @param another the other WebdavResource object
+     * @return the value 0 if another is equal.
+     */
+    public int compareTo(Object another) {
+
+        if ((another != null) && (another instanceof WebdavResource)) {
+            return compareToWebdavResource((WebdavResource) another);
+        }
+
+        String thisUrl = toString();
+        String anotherUrl = another.toString();
+
+        return thisUrl.compareTo(anotherUrl);
+    }
+
+
+    /**
+     * Test the object.
+     *
+     * @param obj the other object
+     * @return true if it's equal.
+     */
+    public boolean equals(Object obj) {
+
+        if ((obj != null) && (obj instanceof WebdavResource)) {
+            return compareTo(obj) == 0;
+        }
+        return false;
+    }
+
+
+    /**
+     * Return the http URL string.
+     *
+     * @return the http URL string.
+     */
+    public String toString() {
+        return httpURL.toString();
+    }
+
+
+    /**
+     * Execute the CHECKIN method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean checkinMethod()
+        throws HttpException, IOException {
+
+        return checkinMethod(httpURL.getPath());
+    }
+
+
+    /**
+     * Execute the CHECKIN method for the given path.
+     *
+     * @param path the server relative path of the resource to check in
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean checkinMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+        CheckinMethod method = new CheckinMethod(URIUtil.encodePath(path));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the CHECKOUT method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean checkoutMethod()
+        throws HttpException, IOException {
+
+        return checkoutMethod(httpURL.getPath());
+    }
+
+
+    /**
+     * Execute the CHECKOUT method for the given path.
+     *
+     * @param path the server relative path of the resource to check out
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean checkoutMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+        CheckoutMethod method = new CheckoutMethod(URIUtil.encodePath(path));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+
+    /**
+     * Execute the CHECKOUT method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean uncheckoutMethod()
+        throws HttpException, IOException {
+
+        return uncheckoutMethod(httpURL.getPath());
+    }
+
+
+
+
+    /**
+     * Execute the CHECKOUT method for the given path.
+     *
+     * @param path the server relative path of the resource to act on
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean uncheckoutMethod(String path)
+        throws HttpException, IOException {
+
+        setClient();
+        UncheckoutMethod method =
+            new UncheckoutMethod(URIUtil.encodePath(path));
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+
+        generateIfHeader(method);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        setStatusCode(statusCode);
+
+        return (statusCode >= 200 && statusCode < 300) ? true : false;
+    }
+
+    /**
+     * Create a new WebdavResource object (as a seperate method so that it can
+     * be overridden by subclasses.
+     *
+     * @param client HttpClient to be used by this webdavresource.
+     * @return A new WebdavResource object.
+     */
+    protected WebdavResource createWebdavResource(HttpClient client) {
+        WebdavResource resource = new WebdavResource(client);
+        resource.setProxy(proxyHost, proxyPort);
+        resource.setProxyCredentials(proxyCredentials);
+        return resource;
+    }
+
+    /**
+     * Process a property, setting various member variables depending
+     * on what the property is.
+     *
+     * @param property The property to process.
+     */
+    protected void processProperty(Property property) {
+        if (property.getLocalName().equals(DISPLAYNAME)) {
+            displayName = property.getPropertyAsString();
+        }
+        else if (property.getLocalName().equals(GETCONTENTLENGTH)) {
+            String getContentLength = property.getPropertyAsString();
+            setGetContentLength(getContentLength);
+        }
+        else if (property.getLocalName().equals(RESOURCETYPE)) {
+            ResourceTypeProperty resourceType =
+                (ResourceTypeProperty) property;
+            setResourceType(resourceType);
+        }
+        else if (property.getLocalName().equals(GETCONTENTTYPE)) {
+            String getContentType = property.getPropertyAsString();
+            setGetContentType(getContentType);
+        }
+        else if (property.getLocalName().equals(GETLASTMODIFIED)) {
+            String getLastModified = property.getPropertyAsString();
+            setGetLastModified(getLastModified);
+        }
+        else if (property.getLocalName().equals(CREATIONDATE)) {
+            String creationDate = property.getPropertyAsString();
+            setCreationDate(creationDate);
+        }
+        else if (property.getLocalName().equals(GETETAG)) {
+            String getEtag = property.getPropertyAsString();
+            setGetEtag(getEtag);
+        }
+        else if (property.getLocalName().equals(ISHIDDEN)) {
+            String isHidden = property.getPropertyAsString();
+            setIsHidden(isHidden);
+        }
+        else if (property.getLocalName().equals(ISCOLLECTION)) {
+            String isCollection = property.getPropertyAsString();
+            setIsCollection(isCollection);
+        }
+        else if (property.getLocalName().equals(SUPPORTEDLOCK)) {
+            String supportedLock = property.getPropertyAsString();
+            setSupportedLock(supportedLock);
+        }
+        else if (property.getLocalName().equals(LOCKDISCOVERY)) {
+            LockDiscoveryProperty lockDiscovery =
+                (LockDiscoveryProperty) property;
+            setLockDiscovery(lockDiscovery);
+        }
+    }
+
+
+    /**
+     * Execute REPORT method.
+     * This method is for the special Access Control Reports:
+     * - acl-principal-prop-set (not supported yet)
+     * - principal-match (not supported yet)
+     * - principal-property-search
+     * - principal-search-property-set (not supported yet)
+     *
+     * @param path the server relative path of the resource to request
+     * @param properties The named properties.
+     * @return an enumeration of <code>ResponseEntity</code>
+     * @exception HttpException
+     * @exception IOException
+     */
+    public Enumeration aclReportMethod(
+        String path,
+        Collection properties,
+        int reportType)
+        throws HttpException, IOException {
+
+        setClient();
+        AclReportMethod method =
+            new AclReportMethod(
+                URIUtil.encodePath(path),
+                properties,
+                DepthSupport.DEPTH_INFINITY,
+                reportType);
+
+        method.setDebug(debug);
+        method.setFollowRedirects(this.followRedirects);
+        generateTransactionHeader(method);
+        int status = client.executeMethod(method);
+
+        // Set status code for this resource.
+        if (thisResource == true) {
+            // Set the status code.
+            setStatusCode(method.getStatusLine().getStatusCode());
+        }
+
+        //slide/tamino delivers status code OK.
+        //can be removed when the server sends MULTI_STATUS
+        if (status != HttpStatus.SC_MULTI_STATUS && status != HttpStatus.SC_OK) {
+            HttpException ex = new HttpException();
+            ex.setReasonCode(status);
+            throw ex;
+        }
+        thisResource = false;
+
+        return method.getResponses();
+    }
+
+
+    /**
+     * Execute the BIND method for this WebdavResource, given
+     * an existing path to bind with.
+     *
+     * @param newBinding  the new binding as a server relative path
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setOverwrite(boolean)
+     */
+    public boolean bindMethod(String newBinding)
+        throws HttpException, IOException {
+        return bindMethod(httpURL.getPath(), newBinding);
+    }
+
+    /**
+     * Execute the BIND method given the new path to bind to an existing path.
+     *
+     * @param existingBinding  the existing binding as a server relative path
+     * @param newBinding       the new binding as a server relative path
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setOverwrite(boolean)
+     */
+    public boolean bindMethod(String existingBinding, String newBinding)
+        throws HttpException, IOException {
+
+        setClient();
+        BindMethod method =
+            new BindMethod(URIUtil.encodePath(existingBinding),
+                           URIUtil.encodePath(newBinding));
+        method.setDebug(debug);
+        method.setOverwrite(overwrite);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        // Possbile BIND Status Codes => SC_CREATED, SC_NO_CONTENT
+        // SC_FORBIDDEN, SC_CONFLICT, SC_PRECONDITION_FAILED,
+        // SC_LOCKED, SC_BAD_GATEWAY, SC_INSUFFICIENT_STORAGE,
+        // SC_LOOP_DETECTED
+        setStatusCode(statusCode);
+        return statusCode >= 200 && statusCode < 300;
+    }
+
+    /**
+     * Execute the UNBIND method for this WebdavResource.
+     *
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean unbindMethod() throws HttpException, IOException {
+        boolean result = unbindMethod(httpURL.getPath());
+        if (result) {
+            setExistence(false);
+        }
+
+        return result;
+    }
+
+    /**
+     * Execute the UNBIND method given the resource to Unbind.
+     *
+     * @param binding  the server relative path of the resource to unbind
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     */
+    public boolean unbindMethod(String binding)
+        throws HttpException, IOException {
+
+        setClient();
+        UnbindMethod method =
+            new UnbindMethod(URIUtil.encodePath(binding));
+        method.setDebug(debug);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        // Possbile BIND Status Codes => SC_CREATED, SC_NOT_FOUND
+        // WebdavStatus.SC_FORBIDDEN, SC_CONFLICT, SC_PRECONDITION_FAILED,
+        // SC_LOCKED, SC_BAD_GATEWAY
+        setStatusCode(statusCode);
+        return statusCode >= 200 && statusCode < 300;
+    }
+
+    /**
+     * Execute the Rebind method for this WebdavResource given the new
+     * Resource to bind with.
+     * The REBIND method removes a binding to a resource from one collection,
+     * and adds a binding to that resource into another collection. It is
+     * effectively an atomic form of a MOVE request.
+     *
+     * @param newBinding the new binding as a server relative path
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setOverwrite(boolean)
+     */
+    public boolean rebindMethod(String newBinding)
+        throws HttpException, IOException {
+        boolean result = rebindMethod(httpURL.getPath(), newBinding);
+        if (result) {
+            httpURL.setPath(newBinding);
+            refresh();
+        }
+
+        return result;
+    }
+
+    /**
+     * Execute the Rebind method given a resource to rebind and the new
+     * Resource to bind with.
+     * The REBIND method removes a binding to a resource from one collection,
+     * and adds a binding to that resource into another collection. It is
+     * effectively an atomic form of a MOVE request
+     *
+     * @param existingBinding  the existing binding as a server relative path
+     * @param newBinding       the new binding as a server relative path
+     * @return true if the method is succeeded.
+     * @exception HttpException
+     * @exception IOException
+     * @see #setOverwrite(boolean)
+     */
+    public boolean rebindMethod(String existingBinding, String newBinding)
+        throws HttpException, IOException {
+
+        setClient();
+        RebindMethod method =
+            new RebindMethod(URIUtil.encodePath(existingBinding),
+                             URIUtil.encodePath(newBinding));
+        method.setDebug(debug);
+        method.setOverwrite(overwrite);
+        generateTransactionHeader(method);
+        int statusCode = client.executeMethod(method);
+
+        // Possbile BIND Status Codes => SC_CREATED, SC_NO_CONTENT
+        // WebdavStatus.SC_FORBIDDEN, SC_CONFLICT, SC_PRECONDITION_FAILED,
+        // SC_LOCKED, SC_BAD_GATEWAY, SC_INSUFFICIENT_STORAGE,
+        // SC_LOOP_DETECTED
+        setStatusCode(statusCode);
+        return statusCode >= 200 && statusCode < 300;
+    }
+
+    /**
+     * Subscribes for notifications for modifications of WebDAV resources.
+     * 
+     * @param path URL path of the resource that is to be subscribed
+     * @param notificationType 
+     * @param callback the URL to be registered for notification, may be 
+     *        <code>null</code> if no callback shall be registered.
+     * @param notificationDelay
+     * @param depth the depth of the subscription (for valid values see 
+     *    {@link DepthSupport})
+     * @param lifetime duration of that subscription in seconds (Note: the
+     *    server may change this and return an other one; 
+     *    see {@link Subscription#getLifetime()}.
+     * 
+     * @return a {@link Subscription} or <code>null</code> if an error occurs
+     * @throws HttpException
+     * @throws IOException
+     */
+    public Subscription subscribeMethod(String path, 
+          String notificationType,
+          String callback,
+          long notificationDelay,
+          int depth,
+          long lifetime) 
+       throws HttpException, IOException
+    {
+       setClient();
+       
+       SubscribeMethod method = new SubscribeMethod(path);
+       method.setDebug(debug);
+       method.setFollowRedirects(this.followRedirects);
+
+       method.setCallback(callback);
+       method.setDepth(depth);
+       method.setSubsciptionLifetime(lifetime);
+       method.setNotificationType(notificationType);
+       method.setNotificationDelay(notificationDelay);
+       generateTransactionHeader(method);
+       
+       int statusCode = client.executeMethod(method);
+       
+       if (statusCode == HttpStatus.SC_OK) {
+          return new Subscription(
+                      path, 
+                      method.getResponsedSubscriptionId(),
+                      method.getCallback(),
+                      method.getResponsedSubscriptionLifetime(),
+                      method.getResponsedContentLocation(),
+                      method.getNotificationType()
+                );
+       } else {
+          return null;
+       }
+    }
+    
+    /**
+     * Refreshes a subscription.
+     * 
+     * @return <code>true</code> on success.
+     */
+    public boolean subscribeMethod(String path, int subscriptionId)
+       throws HttpException, IOException
+    {
+       setClient();
+       
+       SubscribeMethod method = new SubscribeMethod(path);
+       method.setDebug(debug);
+       method.setFollowRedirects(this.followRedirects);
+       
+       method.setSubscriptionId(subscriptionId);
+       generateTransactionHeader(method);
+       
+       int statusCode = client.executeMethod(method);
+       
+       if (statusCode == HttpStatus.SC_OK) {
+          return true;
+       } else {
+          return false;
+       } 
+    }
+    
+    /**
+     * Refreshes a subscription.
+     * 
+     * @param subscription The subscription to be refreshed.
+     * @return <code>true</code> on success
+     */
+    public boolean subscribeMethod(Subscription subscription)
+       throws HttpException, IOException
+    {
+       return subscribeMethod(subscription.getPath(), subscription.getId());
+    }
+    
+    /**
+     * Cancels a subscription.
+     * @param path URL path for that was subscribed 
+     * @return <code>true</code> on success
+     */
+    public boolean unsubscribeMethod(String path, int subscriptionId) 
+       throws HttpException, IOException
+    {
+       setClient();
+       
+       UnsubscribeMethod method = new UnsubscribeMethod(path);
+       method.setDebug(debug);
+       method.setFollowRedirects(this.followRedirects);   
+       
+       method.addSubscriptionId(subscriptionId);
+       generateTransactionHeader(method);
+       
+       int statusCode = client.executeMethod(method);
+       
+       if (statusCode == HttpStatus.SC_OK) {
+          return true;
+       } else {
+          return false;
+       }
+    }
+    /**
+     * Cancels a subscription.
+     * @param subscription
+     * @return <code>true</code> on success
+     */
+    public boolean unsubscribeMethod(Subscription subscription) 
+       throws HttpException, IOException
+    {
+       return unsubscribeMethod(subscription.getPath(),subscription.getId());
+    }
+    
+    /**
+     * Asks the server whether events for a given subscription are fired.
+     * @param contentLocation URL path returned by the SUBSCRIBE methods
+     *                        Content-Location header
+     * @param subscriptionId id of the subscription
+     * @return <code>true</code> if an event was fired
+     */
+    public boolean pollMethod(String contentLocation, int subscriptionId)
+       throws HttpException, IOException
+    {
+       setClient();
+       
+       PollMethod method = new PollMethod(contentLocation);
+       method.setDebug(debug);
+       method.setFollowRedirects(this.followRedirects);
+       
+       method.addSubscriptionId(subscriptionId);
+       generateTransactionHeader(method);
+       
+       int statusCode = client.executeMethod(method);
+       
+       if (statusCode == HttpStatus.SC_MULTI_STATUS) {
+          return method.getSubscriptionsWithEvents().size() > 0;
+       } else {
+          return false;
+       }
+    }
+    /**
+     * Asks the server whether events for a given subscription are fired.
+     * @param subscription the subscription to ask for
+     * @return <code>true</code> if an event was fired
+     */
+    public boolean pollMethod(Subscription subscription)
+       throws HttpException, IOException
+    {
+       return pollMethod(subscription.getContentLocation(), subscription.getId());
+    }
+
+    
+    
+    private static String getName(String uri) {
+        String escapedName = URIUtil.getName(
+            uri.endsWith("/") ? uri.substring(0, uri.length() - 1): uri);
+        try {
+            return URIUtil.decode(escapedName);
+        } catch (URIException e) {
+            return escapedName;
+        }
+    }
+
+    /**
+     * Unescape octets for some characters that a server might (but should not)
+     * have escaped. These are: "-", "_", ".", "!", "~", "*", "'", "(", ")"
+     * Look at section 2.3 of RFC 2396.
+     */
+    private static String decodeMarks(String input) {
+        char[] sequence = input.toCharArray();
+        StringBuffer decoded = new StringBuffer(sequence.length);
+        for (int i = 0; i < sequence.length; i++) {
+            if (sequence[i] == '%' && i < sequence.length - 2) {
+                switch (sequence[i + 1]) {
+                case '2':
+                    switch (sequence[i + 2]) {
+                    case 'd':
+                    case 'D':
+                        decoded.append('-');
+                        i += 2;
+                        continue;
+                    case 'e':
+                    case 'E':
+                        decoded.append('.');
+                        i += 2;
+                        continue;
+                    case '1':
+                        decoded.append('!');
+                        i += 2;
+                        continue;
+                    case 'a':
+                    case 'A':
+                        decoded.append('*');
+                        i += 2;
+                        continue;
+                    case '7':
+                        decoded.append('\'');
+                        i += 2;
+                        continue;
+                    case '8':
+                        decoded.append('(');
+                        i += 2;
+                        continue;
+                    case '9':
+                        decoded.append(')');
+                        i += 2;
+                        continue;
+                    }
+                    break;
+                case '5':
+                    switch (sequence[i + 2]) {
+                    case 'f':
+                    case 'F':
+                        decoded.append('_');
+                        i += 2;
+                        continue;
+                    }
+                    break;
+                case '7':
+                    switch (sequence[i + 2]) {
+                    case 'e':
+                    case 'E':
+                        decoded.append('~');
+                        i += 2;
+                        continue;
+                    }
+                    break;
+                }
+            }
+            decoded.append(sequence[i]);
+        }
+        return decoded.toString();
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavResources.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavResources.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavResources.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,232 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResources.java,v 1.5 2004/07/28 09:31:38 ib Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/07/28 09:31:38 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+/**
+ * This WebdavResources class represents a set of {@link WebdavResource WebDAV resources }.
+ *
+ * Two WebdavResource instances are considered equal, if there {@link WebdavResource#getName()
+ * getName()} method returns the same string.
+ *
+ */
+
+public class WebdavResources {
+
+    // --------------------------------------------------------- Constructors
+
+    /**
+     * Default constuctor.
+     */
+    public WebdavResources() {
+    }
+
+
+    /**
+     * This constuctor.
+     *
+     * @param resource A resource to add.
+     */
+    public WebdavResources(WebdavResource resource) {
+        addResource(resource);
+    }
+
+
+    // --------------------------------------------------- Instance Variables
+
+
+    /**
+     * The resources for each href and its properties.
+     */
+    Hashtable hrefTable = new Hashtable();
+
+
+    // ------------------------------------------------------- Public Methods
+
+
+    /**
+     * Test if there is no resource.
+     *
+     * @return true if it's empty.
+     */
+    public boolean isEmpty() {
+        return hrefTable.isEmpty();
+    }
+
+
+    /**
+     * Test if there is a resource called the specified resource name.
+     *
+     * @param resourceName The resource name to check.
+     */
+    public boolean isThereResourceName(String resourceName) {
+        return hrefTable.containsKey(resourceName);
+    }
+
+
+    /**
+     * Test if there is a resource.
+     *
+     * @param resource The specified resource.
+     * @return true if it exists.
+     */
+    public boolean isThereResource(WebdavResource resource) {
+        return hrefTable.contains(resource);
+    }
+
+
+    /**
+     * Get an enumeration of the resource names.
+     *
+     * @return An enumeration of the resource names.
+     */
+    public Enumeration getResourceNames() {
+        return hrefTable.keys();
+    }
+
+
+    /**
+     * Get an enumeration of the resources.
+     *
+     * @return An enumeration of resources.
+     */
+    public Enumeration getResources() {
+        return hrefTable.elements();
+    }
+
+
+    /**
+     * Get an array of resource names.
+     *
+     * @return An array of resource names.
+     */
+    public String[] list() {
+
+        synchronized (hrefTable) {
+            int num = hrefTable.size();
+            String resourceNames[] = new String[num];
+
+            Enumeration resources = getResourceNames();
+            int i = 0;
+            while (resources.hasMoreElements()) {
+                resourceNames[i++] = (String) resources.nextElement();
+            }
+
+            return resourceNames;
+        }
+    }
+
+
+    /**
+     * Get an arraay of resources.
+     *
+     * @return An array of resources.
+     */
+    public WebdavResource[] listResources() {
+
+        synchronized (hrefTable) {
+            int num = hrefTable.size();
+            WebdavResource WebdavResources[] = new WebdavResource[num];
+
+            Enumeration resources = getResources();
+            int i = 0;
+            while (resources.hasMoreElements()) {
+                WebdavResources[i++] =
+                    (WebdavResource) resources.nextElement();
+            }
+
+            return WebdavResources;
+        }
+    }
+
+
+    /**
+     * Get an resource.
+     *
+     * @param resourceName The resource name.
+     * @return The wanted resource if it exists.
+     */
+    public WebdavResource getResource(String resourceName) {
+        return (WebdavResource) hrefTable.get(resourceName);
+    }
+
+
+    /**
+     * Maps the resource name to its resource.
+     * The resource name could be different from the displayname property.
+     * It's useful for representing itself or parent collection.
+     *
+     * @param resourceName The resource name.
+     * @param resource The resource.
+     * @see #addResource(WebdavResource)
+     */
+    public void addResource(String resourceName, WebdavResource resource) {
+        hrefTable.put(resourceName, resource);
+    }
+
+
+    /**
+     * Add the specified resource.
+     *
+     * @param resource The resource to add.
+     */
+    public void addResource(WebdavResource resource) {
+        hrefTable.put(resource.getName(), resource);
+    }
+
+
+    /**
+     * Remove the specified resource name.
+     *
+     * @param resourceName The specified resource name.
+     * @return The wanted resource.
+     */
+    public WebdavResource removeResource(String resourceName) {
+        return (WebdavResource) hrefTable.remove(resourceName);
+    }
+
+
+    /**
+     * Remove all resources.
+     */
+    public void removeAll() {
+        hrefTable.clear();
+    }
+
+
+    /**
+     * Return the string for this class.
+     */
+    public String toString() {
+        return hrefTable.toString();
+    }
+
+}
+
+
+
+
+
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavSession.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavSession.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavSession.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,262 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavSession.java,v 1.7 2004/07/30 13:20:48 ib Exp $
+ * $Revision: 1.7 $
+ * $Date: 2004/07/30 13:20:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import java.io.IOException;
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.HttpURL;
+
+/**
+ * This WebdavSession class is for the session management of WebDAV clients.
+ * This class saves and restores the requested client.
+ *
+ * Although this class is thread safe, it should only be accessed by one
+ * concurrent thread, since the underlying protocol, HTTP, is not multiplexed.
+ * If simultaneous operations are needed, it is recommended to create
+ * additional threads, each having its own associated WebDAV client.
+ *
+ * Clients that use persistent connections SHOULD limit the number of
+ * simultaneous connections that they maintain to a given server. A
+ * single-user client SHOULD NOT maintain more than 2 connections with
+ * any server or proxy. A proxy SHOULD use up to 2*N connections to
+ * another server or proxy, where N is the number of simultaneously
+ * active users. These guidelines are intended to improve HTTP response
+ * times and avoid congestion.
+ *
+ */
+public abstract class WebdavSession {
+
+
+    // -------------------------------------------------------  Constructors
+
+
+    /**
+     * Default constructor.
+     */
+    public WebdavSession() {
+        super();
+    }
+
+
+    // ---------------------------------------------------- Instance Variables
+
+
+    /**
+     * The Http client instance.
+     */
+    protected HttpClient client;
+
+    /**
+     * Credentials to use for authentication
+     */
+    protected Credentials hostCredentials = null;
+
+    /**
+     * The hostname to use for the proxy, if any
+     */
+    protected String proxyHost = null;
+
+    /**
+     * Port number to use for proxy, if any
+     */
+    protected int proxyPort = -1;
+
+    /**
+     * Credentials to use for an authenticating proxy
+     */
+    protected Credentials proxyCredentials = null;
+
+
+    /**
+     * Debug level.
+     */
+    protected int debug = 0;
+
+
+    // ------------------------------------------------------------- Properties
+
+
+    /**
+     * Set debug level.
+     */
+    public void setDebug(int debug) {
+        this.debug = debug;
+    }
+
+
+    // ------------------------------------------------------  Public methods
+
+
+    /**
+     * Get a <code>HttpClient</code> instance.
+     * This method returns a new client instance for the first time.
+     * And it is saved util it's closed or reset.
+     *
+     * @param httpURL The http URL to connect.  only used the authority part.
+     * @return An instance of <code>HttpClient</code>.
+     * @exception IOException
+     */
+    public HttpClient getSessionInstance(HttpURL httpURL)
+        throws IOException {
+
+        return getSessionInstance(httpURL, false);
+    }
+
+
+    /**
+     * Get a <code>HttpClient</code> instance.
+     * This method returns a new client instance, when reset is true.
+     *
+     * @param httpURL The http URL to connect.  only used the authority part.
+     * @param reset The reset flag to represent whether the saved information
+     *              is used or not.
+     * @return An instance of <code>HttpClient</code>.
+     * @exception IOException
+     */
+    public HttpClient getSessionInstance(HttpURL httpURL, boolean reset)
+        throws IOException {
+
+        if (reset || client == null) {
+            client = new HttpClient();
+            // Set a state which allows lock tracking
+            client.setState(new WebdavState());
+            HostConfiguration hostConfig = client.getHostConfiguration();
+            hostConfig.setHost(httpURL);
+            if (proxyHost != null && proxyPort > 0)
+                hostConfig.setProxy(proxyHost, proxyPort);
+
+            if (hostCredentials == null) {
+                String userName = httpURL.getUser();
+                if (userName != null && userName.length() > 0) {
+                    hostCredentials =
+                        new UsernamePasswordCredentials(userName,
+                                                        httpURL.getPassword());
+                }
+            }
+
+            if (hostCredentials != null) {
+                HttpState clientState = client.getState();
+                clientState.setCredentials(null, httpURL.getHost(),
+                                           hostCredentials);
+                clientState.setAuthenticationPreemptive(true);
+            }
+
+            if (proxyCredentials != null) {
+                client.getState().setProxyCredentials(null, proxyHost,
+                                                      proxyCredentials);
+            }
+        }
+
+        return client;
+    }
+
+    /**
+     * Set credentials for authentication.
+     *
+     * @param credentials The credentials to use for authentication.
+     */
+    public void setCredentials(Credentials credentials) {
+        hostCredentials = credentials;
+    }
+
+    /** Set proxy info, to use proxying.
+     */
+    public void setProxy(String host, int port)
+    {
+        this.proxyHost = host;
+        this.proxyPort = port;
+    }
+
+    /**
+     * Set credentials for authenticating against a proxy.
+     *
+     * @param credentials The credentials to use for authentication.
+     */
+    public void setProxyCredentials(Credentials credentials) {
+        proxyCredentials = credentials;
+    }
+
+    /**
+     * Close an session and delete the connection information.
+     *
+     * @exception IOException Error in closing socket.
+     */
+    public void closeSession()
+        throws IOException {
+        if (client != null) {
+            client.getHttpConnectionManager().getConnection(
+                client.getHostConfiguration()).close();
+            client = null;
+        }
+    }
+
+
+    /**
+     * Close an session and delete the connection information.
+     *
+     * @param client The HttpClient instance.
+     * @exception IOException Error in closing socket.
+     * @deprecated Replaced by closeSession()
+     */
+    public synchronized void closeSession(HttpClient client)
+        throws IOException {
+        closeSession();
+    }
+
+
+    /**
+     * Progressing by the progress event.
+     *
+     * @param pe The progress event.
+     */
+    /*
+    public void progressing(ProgressEvent pe) {
+        if (debug > 3)
+            System.err.println("[EVENT/WebdavSession] " +
+                               "action:" + pe.getAction() +
+                               ((pe.getResourceName() == null) ? "" :
+                               ", resource:" + pe.getResourceName()) +
+                               ", soMany:" + pe.getSoMany() +
+                               ", remained:" + pe.getRemainedSize() +
+                               ", total:" + pe.getTotalSize());
+        getProgressUtil().fireProgress(pe);
+    }
+    */
+
+
+    /**
+     * Get the utility of this progress event and listener.
+     *
+     * @return ProgressUtil
+     */
+    /*
+    public ProgressUtil getProgressUtil() {
+        return sessionProgress;
+    }
+    */
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavState.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavState.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/WebdavState.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,169 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavState.java,v 1.4 2004/07/28 09:31:38 ib Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/07/28 09:31:38 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Vector;
+import org.apache.commons.httpclient.HttpState;
+
+/**
+ * Session state.
+ *
+ */
+public class WebdavState extends HttpState {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    private static final String[] EMPTY_ARRAY = new String[0];
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Lock tokens.
+     */
+    protected HashMap locks = new HashMap();
+
+
+    /**
+     * Lock list.
+     */
+    protected ArrayList lockTokens = new ArrayList();
+
+    /**
+     * Transaction handle of current session of <code>null</code> if not inside of transaction.
+     */
+    protected String transactionHandle = null;
+
+    // ------------------------------------------------------------- Properties
+
+
+    /**
+     * Add a lock token.
+     *
+     * @param uri Uri
+     * @param value Lock token value
+     */
+    public void addLock(String uri, String value) {
+
+        if (value == null)
+            return;
+
+        if (lockTokens.contains(value))
+            return;
+
+        locks.put(uri, value);
+        lockTokens.add(value);
+
+    }
+
+
+    /**
+     * Remove a lock.
+     *
+     * @param uri Uri
+     * @param value LockToken value
+     */
+    public void removeLock(String uri, String value) {
+
+        locks.remove(uri);
+        int i = lockTokens.indexOf(value);
+        if (i != -1)
+            lockTokens.remove(i);
+
+    }
+
+
+    /**
+     * Remove locks.
+     *
+     * @param uri Uri
+     */
+    public void removeLocks(String uri) {
+
+        String result = (String) locks.remove(uri);
+        if (result != null) {
+            int i = lockTokens.indexOf(result);
+            if (i != -1)
+                lockTokens.remove(i);
+        }
+
+    }
+
+
+    /**
+     * Get lock
+     *
+     * @param uri Uri
+     */
+    public String getLock(String uri) {
+
+        return (String) locks.get(uri);
+
+    }
+
+
+    /**
+     * Get locks
+     *
+     * @param uri Uri
+     * @return Enumeration of lock tokens
+     * @deprecated
+     */
+    public Enumeration getLocks(String uri) {
+
+        Vector result = new Vector();
+        String lockToken = getLock(uri);
+        if (lockToken != null)
+            result.addElement(lockToken);
+        return result.elements();
+
+    }
+
+
+    /**
+     * Get all locks scoped to that uri.
+     *
+     * @param uri Uri
+     * @return Iterator of lock tokens
+     */
+    public String[] getAllLocks(String uri) {
+
+        return (String[]) lockTokens.toArray(EMPTY_ARRAY);
+
+    }
+
+    public String getTransactionHandle() {
+        return transactionHandle;
+    }
+
+    public void setTransactionHandle(String transactionHandle) {
+        this.transactionHandle = transactionHandle;
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/AclMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/AclMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/AclMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,218 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/AclMethod.java,v 1.8 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.8 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.Ace;
+import org.apache.webdav.lib.Privilege;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+/**
+ * ACL Method.
+ *
+ */
+public class AclMethod
+    extends XMLResponseMethodBase {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public AclMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public AclMethod(String path) {
+        super(path);
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    protected Vector aces = new Vector();
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Add an ace to the ace list which will be set by the method.
+     *
+     * @param ace Access control entry
+     */
+    public void addAce(Ace ace) {
+        checkNotUsed();
+        aces.addElement(ace);
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+
+    public void recycle() {
+        super.recycle();
+        aces.clear();
+    }
+
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state State token
+     * @param conn the connection
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        // set the default utf-8 encoding, if not already present
+        if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+        super.addRequestHeaders(state, conn);
+
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        XMLPrinter printer = new XMLPrinter();
+
+        printer.writeXMLHeader();
+        printer.writeElement("D", "DAV:", "acl",
+                             XMLPrinter.OPENING);
+
+        Enumeration aceList = aces.elements();
+
+        while (aceList.hasMoreElements()) {
+            Ace ace = (Ace) aceList.nextElement();
+
+            if (ace.isInherited() || ace.isProtected()) {
+                // draft-ietf-webdav-acl-06
+                // do not submit inherited and protected aces
+                // continue with next ace
+                continue;
+            }
+
+            printer.writeElement("D", null, "ace",
+                                 XMLPrinter.OPENING);
+
+            printer.writeElement("D", null, "principal",
+                                 XMLPrinter.OPENING);
+
+            boolean found = false;
+            String principal = ace.getPrincipal();
+            String[] types = {"all", "authenticated", "unauthenticated",
+                              "property", "self"};
+            for (int i = 0; i < types.length && !found; i++) {
+                if (types[i].equals(principal)) {
+                    found = true;
+                    if ("property".equals(principal)) {
+                        printer.writeElement("D", null, principal,
+                                             XMLPrinter.OPENING);
+                        PropertyName property = ace.getProperty();
+                        String nsURI = property.getNamespaceURI();
+                        if ("DAV:".equals(nsURI)) {
+                            printer.writeElement("D", null,
+                                                 property.getLocalName(),
+                                                 XMLPrinter.NO_CONTENT);
+                        } else {
+                            printer.writeElement("Z", nsURI,
+                                                 property.getLocalName(),
+                                                 XMLPrinter.NO_CONTENT);
+                        }
+                        printer.writeElement("D", null, principal,
+                                             XMLPrinter.CLOSING);
+                    } else {
+                        printer.writeElement("D", null, principal,
+                                             XMLPrinter.NO_CONTENT);
+                    }
+                }
+            }
+            if (!found) {
+                printer.writeElement("D", null, "href", XMLPrinter.OPENING);
+                printer.writeText(principal);
+                printer.writeElement("D", null, "href", XMLPrinter.CLOSING);
+            }
+
+            printer.writeElement("D", null, "principal",
+                                 XMLPrinter.CLOSING);
+
+            String positive = (ace.isNegative()) ? "deny" : "grant";
+
+            printer.writeElement("D", null, positive,
+                                 XMLPrinter.OPENING);
+
+            Enumeration privilegeList = ace.enumeratePrivileges();
+            while (privilegeList.hasMoreElements()) {
+                Privilege privilege = (Privilege) privilegeList.nextElement();
+                printer.writeElement("D", null, "privilege",
+                                     XMLPrinter.OPENING);
+                String nsURI = privilege.getNamespace();
+                if ("DAV:".equals(nsURI)) {
+                    printer.writeElement("D", null, privilege.getName(),
+                                         XMLPrinter.NO_CONTENT);
+                } else {
+                    printer.writeElement("Z", nsURI, privilege.getName(),
+                                         XMLPrinter.NO_CONTENT);
+                }
+                printer.writeElement("D", null, "privilege",
+                                     XMLPrinter.CLOSING);
+            }
+
+            printer.writeElement("D", null, positive,
+                                 XMLPrinter.CLOSING);
+
+            printer.writeElement("D", null, "ace",
+                                 XMLPrinter.CLOSING);
+
+        }
+
+        printer.writeElement("D", "acl", XMLPrinter.CLOSING);
+
+        return printer.toString();
+    }
+
+    public String getName() {
+        return "ACL";
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/AclReportMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/AclReportMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/AclReportMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,185 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/AclReportMethod.java,v 1.6 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.6 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.util.Collection;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+/**
+ * WebDAV Report method
+ * This class is used to send an report
+ * from the ACL specification.
+ * In this version only the principal-property-search is supported.
+ *
+ */
+public class AclReportMethod extends XMLResponseMethodBase implements DepthSupport {
+
+    //supported method types
+    public final static int PRINCIPAL_PROPERTY_SEARCH = 1;
+
+    private PropertyBodyHelper propertyBodyHelper = null;
+    private int depth = DepthSupport.DEPTH_INFINITY;
+    private int reportType = 0;
+
+    /**
+     * @param path
+     * @param propertyNames requested properties
+     * @param depth
+     * @param reportType - one of the supported report types
+     */
+    public AclReportMethod(
+        String path,
+        Collection propertyNames,
+        int depth,
+        int reportType) {
+
+        super(path);
+        setDepth(depth);
+        this.reportType = reportType;
+        propertyBodyHelper = new PropertyBodyHelper();
+        propertyBodyHelper.setPropertyNames(propertyNames);
+    }
+
+    /**
+     * @see org.apache.commons.httpclient.HttpMethod#getName()
+     */
+    public String getName() {
+        return "REPORT";
+    }
+
+    /**
+     * @see org.apache.webdav.lib.methods.DepthSupport#setDepth(int)
+     */
+    public void setDepth(int depth) {
+        checkNotUsed();
+        this.depth = depth;
+    }
+
+    /**
+     * @see org.apache.webdav.lib.methods.DepthSupport#getDepth()
+     */
+    public int getDepth() {
+        return depth;
+    }
+
+    /**
+     * Set a header value, redirecting the special case of header "Depth" to
+     * {@link #setDepth} as appropriate.
+     *
+     * @param headerName Header name
+     * @param headerValue Header value
+     */
+    public void setRequestHeader(String headerName, String headerValue) {
+        if (headerName.equalsIgnoreCase("Depth")) {
+            int depth = -1;
+            if (headerValue.equals("0")) {
+                depth = DEPTH_0;
+            }
+            if (headerValue.equals("1")) {
+                depth = DEPTH_1;
+            } else if (headerValue.equalsIgnoreCase("infinity")) {
+                depth = DEPTH_INFINITY;
+            }
+            setDepth(depth);
+        } else {
+            super.setRequestHeader(headerName, headerValue);
+        }
+    }
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state State token
+     * @param conn The connection being used for the request.
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+
+        super.addRequestHeaders(state, conn);
+
+        // set the default utf-8 encoding, if not already present
+        if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+
+        switch (getDepth()) {
+            case DEPTH_0 :
+                super.setRequestHeader("Depth", "0");
+                break;
+            case DEPTH_1 :
+                super.setRequestHeader("Depth", "1");
+                break;
+            case DEPTH_INFINITY :
+                super.setRequestHeader("Depth", "infinity");
+                break;
+        }
+    }
+
+    /**
+     * @see org.apache.webdav.lib.methods.XMLResponseMethodBase#generateRequestBody()
+     */
+    protected String generateRequestBody() {
+        XMLPrinter printer = new XMLPrinter();
+
+        printer.writeXMLHeader();
+
+        switch (reportType) {
+            case PRINCIPAL_PROPERTY_SEARCH :
+                generatePrincipalPropertySearchBody(printer);
+                break;
+            default :
+                System.err.println("AclReportMethod: type not supported " + reportType);
+        }
+        return printer.toString();
+    }
+
+    /**
+     * Generate the body for a principal-property-search report.
+     * Currently the <property-search> section is constant.
+     *
+     */
+    private void generatePrincipalPropertySearchBody(XMLPrinter printer) {
+        printer.writeElement(
+            "D",
+            "DAV:",
+            "principal-property-search",
+            XMLPrinter.OPENING);
+
+        //property-search
+        printer.writeElement("D", "property-search", XMLPrinter.OPENING);
+        printer.writeElement("D", "prop", XMLPrinter.OPENING);
+        printer.writeElement("D", "displayname", XMLPrinter.NO_CONTENT);
+        printer.writeElement("D", "prop", XMLPrinter.CLOSING);
+        printer.writeElement("D", "caseless-substring", XMLPrinter.NO_CONTENT);
+        printer.writeElement("D", "property-search", XMLPrinter.CLOSING);
+
+        //resulting properties
+        propertyBodyHelper.wirtePropElement(printer);
+
+        printer.writeElement("D", "principal-property-search", XMLPrinter.CLOSING);
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/BindMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/BindMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/BindMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,186 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/BindMethod.java,v 1.5 2004/08/02 15:45:47 unico Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/08/02 15:45:47 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+/**
+ * The BIND method modifies the collection identified by the Request-URI,
+ * by adding a new binding from the segment specified in the BIND body
+ * to the resource identified in the BIND body.
+ *
+ * BIND Method Example:
+ * >> Request:
+ *  BIND /CollY HTTP/1.1
+ *  Host: www.example.com
+ *  Content-Type: text/xml; charset="utf-8"
+ *  Content-Length: xxx
+ *  <?xml version="1.0" encoding="utf-8" ?>
+ *  <D:bind xmlns:D="DAV:">
+ *      <D:segment>bar.html</D:segment>
+ *      <D:href>http://www.example.com/CollX/foo.html</D:href>
+ *  </D:bind>
+ *
+ * >> Response:
+ *  HTTP/1.1 201 Created
+ * The server added a new binding to the collection, "http://www.example.com/CollY",
+ * associating "bar.html" with the resource identified by the URI
+ * "http://www.example.com/CollX/foo.html". Clients can now use the URI
+ * "http://www.example.com/CollY/bar.html", to submit requests to that resource.
+ *
+ */
+public class BindMethod
+    extends XMLResponseMethodBase {
+
+
+    public static final String NAME = "BIND";
+
+    private boolean overwrite = true;
+    private String segment = null;
+    private String href = null;
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public BindMethod() {
+    }
+
+    public BindMethod(String existingBinding, String newBinding) {
+        super(newBinding.substring(0, newBinding.lastIndexOf('/')));
+        this.href = existingBinding;
+        this.segment = newBinding.substring(newBinding.lastIndexOf('/') + 1);
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    /**
+     * By default, if there already is a binding for the specified segment
+     * in the collection, the new binding replaces the existing binding.
+     * This default binding replacement behavior can be overridden using
+     * the Overwrite header.
+     *
+     * @param overwrite New overwrite value
+     */
+    public void setOverwrite(boolean overwrite) {
+        checkNotUsed();
+        this.overwrite = overwrite;
+    }
+
+
+    /**
+     * By default, if there already is a binding for the specified segment
+     * in the collection, the new binding replaces the existing binding.
+     * This default binding replacement behavior can be overridden using
+     * the Overwrite header.
+     *
+     * @return the current value of the overwrite flag
+     */
+    public boolean isOverwrite() {
+        return overwrite;
+    }
+
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state HttpState token
+     * @param conn The connection being used for the request.
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        super.addRequestHeaders(state, conn);
+
+        if (!isOverwrite())
+            super.setRequestHeader("Overwrite", "F");
+
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        if (segment == null || href == null)
+            throw new IllegalStateException
+                ("Segment and Href must be set before " +
+                 "calling this function.");
+
+        XMLPrinter printer = new XMLPrinter();
+
+        printer.writeXMLHeader();
+        printer.writeElement("D", "DAV:", "bind", XMLPrinter.OPENING);
+        printer.writeElement("D", "segment", XMLPrinter.OPENING);
+        printer.writeText(segment);
+        printer.writeElement("D", "segment", XMLPrinter.CLOSING);
+        printer.writeElement("D", "href", XMLPrinter.OPENING);
+        printer.writeText(href);
+        printer.writeElement("D", "href", XMLPrinter.CLOSING);
+        printer.writeElement("D", "bind", XMLPrinter.CLOSING);
+
+        return printer.toString();
+    }
+
+    /**
+     * @return path of the resource to be bound
+     */
+    public String getHref() {
+        return href;
+    }
+
+    /**
+     * @return new resource name
+     */
+    public String getSegment() {
+        return segment;
+    }
+
+    /**
+     * @param href path of the resource to be bound
+     */
+    public void setHref(String href) {
+        this.href = href;
+    }
+
+    /**
+     * @param segment new resource name
+     */
+    public void setSegment(String segment) {
+        this.segment = segment;
+    }
+
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CheckinMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CheckinMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CheckinMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,121 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/CheckinMethod.java,v 1.4 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+
+/**
+ * The CHECKIN method can be applied to a checked-out version-controlled
+ * resource to produce a new version whose content and dead properties are
+ * copied from the checked-out resource.
+ *
+ * <p>   This implementation of a CHECKIN client method does support a
+ * a request body.</p>
+ *
+ * <p>   If a CHECKIN request fails, the server state preceding the request
+ * MUST be restored. The request body MUST be a DAV:checkin XML element with
+ * at most one DAV:keep-checked-out or DAV:fork-ok.</p>
+ *
+ *
+ * <h3>Example Request</h3>
+ * <pre>
+ * CHECKIN /foo.html HTTP/1.1
+ * Host: www.server.org
+ * Content-type: text/xml; charset="utf-8"
+ * Content-Length: xx
+ * </pre>
+ *
+ * <h3>Example Response</h3>
+ * <pre>
+ * HTTP/1.1 201 Created
+ * Location: http://server.org/history/1/1.1
+ * Content-type: text/xml; charset="utf-8"
+ * </pre>
+ *
+ */
+public class CheckinMethod
+    extends XMLResponseMethodBase {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public CheckinMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public CheckinMethod(String path) {
+        super(path);
+    }
+
+
+
+
+
+    // ------------------------------------------------------------- Properties
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            if (getStatusLine().getStatusCode() == WebdavStatus.SC_CONFLICT     ||
+                getStatusLine().getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+    public String getName() {
+        return "CHECKIN";
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CheckoutMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CheckoutMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CheckoutMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,104 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/CheckoutMethod.java,v 1.4 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+
+/**
+ * The Checkout method can be applied to a checked-in version-controlled
+ * resource.
+ *
+ *
+ *
+ * <h3>Example Request</h3>
+ * <pre>
+ * Checkout /foo.html HTTP/1.1
+ * Host: www.server.org
+ * Content-Length: xx
+ * </pre>
+ *
+ * <h3>Example Response</h3>
+ * <pre>
+ * HTTP/1.1 200 OK
+ * </pre>
+ *
+ */
+public class CheckoutMethod
+    extends XMLResponseMethodBase {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public CheckoutMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public CheckoutMethod(String path) {
+        super(path);
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            if (getStatusLine().getStatusCode() == WebdavStatus.SC_CONFLICT     ||
+                getStatusLine().getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+    public String getName() {
+        return "CHECKOUT";
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CopyMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CopyMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/CopyMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,238 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/CopyMethod.java,v 1.6 2004/07/28 09:30:48 ib Exp $
+ * $Revision: 1.6 $
+ * $Date: 2004/07/28 09:30:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+
+
+/**
+ * COPY Method.
+ *
+ */
+public class CopyMethod
+    extends XMLResponseMethodBase {
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public CopyMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public CopyMethod(String source) {
+        super(source);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public CopyMethod(String source, String destination) {
+        this(source);
+        setDestination(destination);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public CopyMethod(String source, String destination, boolean overwrite) {
+        this(source, destination);
+        setOverwrite(overwrite);
+    }
+
+    public CopyMethod(String source, String destination, boolean overwrite, int depth) {
+        this(source, destination, overwrite);
+        setDepth(depth);
+    }
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Destination.
+     */
+    private String destination;
+
+
+    /**
+     * Overwrite.
+     */
+    private boolean overwrite = true;
+
+    /**
+     * Depth.
+     */
+    private int depth = DepthSupport.DEPTH_INFINITY;
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Set a header value, redirecting the special case of Overwrite and Destination headers
+     * to {@link #setOverwrite} and {@link #setDestination} as appropriate.
+     *
+     * @param headerName Header name
+     * @param headerValue Header value
+     */
+    public void setRequestHeader(String headerName, String headerValue) {
+        if (headerName.equalsIgnoreCase("Overwrite")){
+            setOverwrite(! (headerValue.equalsIgnoreCase("F") ||
+                           headerValue.equalsIgnoreCase("False") ) );
+        }
+        else if (headerName.equalsIgnoreCase("Destination")){
+            setDestination(headerValue);
+        }
+        else if (headerName.equalsIgnoreCase("Depth")) {
+            if (headerValue.equalsIgnoreCase("Infinity")) {
+                setDepth(DepthSupport.DEPTH_INFINITY);
+            }
+            else if (headerValue.equalsIgnoreCase("0")) {
+                setDepth(0);
+            }
+        }
+        else{
+            super.setRequestHeader(headerName, headerValue);
+        }
+    }
+
+
+
+
+    /**
+     * Destination setter.
+     *
+     * @param destination New destination value
+     */
+    public void setDestination(String destination) {
+        checkNotUsed();
+        this.destination = destination;
+    }
+
+
+    /**
+     * Destination getter.
+     *
+     * @return String destination value
+     */
+    public String getDestination() {
+        return destination;
+    }
+
+
+    /**
+     * Overwrite setter.
+     *
+     * @param overwrite New overwrite value
+     */
+    public void setOverwrite(boolean overwrite) {
+        checkNotUsed();
+        this.overwrite = overwrite;
+    }
+
+
+    /**
+     * Overwrite getter.
+     *
+     * @return boolean Overwrite value
+     */
+    public boolean isOverwrite() {
+        return overwrite;
+    }
+
+
+    /**
+     * Overwrite getter.
+     *
+     * @return boolean Overwrite value
+     */
+    public boolean getOverwrite() {
+        return overwrite;
+    }
+
+    /**
+     * Depth setter.
+     * 
+     * @param depth New depth value
+     */
+    public void setDepth(int depth) {
+        checkNotUsed();
+        this.depth = depth;
+    }
+    
+    /**
+     * Depth getter.
+     * 
+     * @return int Depth value
+     */
+    public int getDepth() {
+        return this.depth;
+    }
+
+    public String getName() {
+        return "COPY";
+    }
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state HttpState token
+     * @param conn The connection being used for the request.
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        super.addRequestHeaders(state, conn);
+
+        String absoluteDestination = MoveMethod.getAbsoluteDestination(conn, destination);
+        super.setRequestHeader("Destination", absoluteDestination);
+
+        if (!isOverwrite())
+            super.setRequestHeader("Overwrite", "F");
+
+        switch (depth) {
+	        case DepthSupport.DEPTH_0:
+	            super.setRequestHeader("Depth", "0");
+	            break;
+	        case DepthSupport.DEPTH_INFINITY:
+	            super.setRequestHeader("Depth", "Infinity");
+	            break;
+        }
+    }
+
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/DeleteMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/DeleteMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/DeleteMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,115 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/DeleteMethod.java,v 1.4 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+/**
+ * DELETE Method.  The delete method can be sent to either a collection or
+ * non-collection resource.  If a delete is sent to a collection, then all
+ * members of that collection are deleted.
+ *
+ * <p>   Deletes can fail because of permission problems or if a resource is
+ * currently locked.
+ *
+ * <p>   A typical request/response pair might look like this:
+ *
+ * <h3>Request</h3>
+ * <pre>
+ * DELETE /container/ HTTP/1.1
+ * Host: www.foo.bar
+ * </pre>
+ *
+ * <h3>Response</h3>
+ * <pre>
+ * HTTP/1.1 207 Multi-Status
+ * Content-Type: text/xml; charset="utf-8"
+ * Content-Length: xxxx
+ * &lt;?xml version="1.0" encoding="utf-8" ?&gt;
+ *   &lt;d:multistatus xmlns:d="DAV:"&gt;
+ *   &lt;d:response&gt;
+ *     &lt;d:href&gt;http://www.foo.bar/container/resource3&lt;/d:href&gt;
+ *     &lt;d:status&gt;HTTP/1.1 423 Locked&lt;/d:status&gt;
+ *   &lt;/d:response&gt;
+ * &lt;/d:multistatus&gt;
+ * </pre>
+ *
+ * <p>   In this example, the delete failed because one of the members was
+ * locked.
+ *
+ */
+public class DeleteMethod
+    extends XMLResponseMethodBase {
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public DeleteMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public DeleteMethod(String path) {
+        super(path);
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            int code = getStatusLine().getStatusCode();
+            if (code == WebdavStatus.SC_CONFLICT     ||
+                code == WebdavStatus.SC_MULTI_STATUS ||
+                code == WebdavStatus.SC_FORBIDDEN ) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+    public String getName() {
+        return "DELETE";
+    }
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/DepthSupport.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/DepthSupport.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/DepthSupport.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,78 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/DepthSupport.java,v 1.3 2004/07/28 09:30:47 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:30:47 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+/**
+ * Methods that can act on collections (for example, DELETE, LOCK, PROPFIND,
+ * etc.) support a depth header.  The depth header indicates that the
+ * method applies to either:
+ * <ol>
+ * <li>the collection (depth 0);
+ * <li>the collection and its immediate contents (depth 1); or
+ * <li>the collection, its contents and all subcollections (depth infinity).
+ * </ol>
+ *
+ */
+public interface DepthSupport {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * Request with depth 0.
+     */
+    public static final int DEPTH_0 = 0;
+
+
+    /**
+     * Request with depth 1.
+     */
+    public static final int DEPTH_1 = 1;
+
+
+    /**
+     * Request with depth infinity.
+     */
+    public static final int DEPTH_INFINITY = Integer.MAX_VALUE;
+
+
+    // ------------------------------------------------------------- Properties
+
+
+    /**
+     * Depth setter.
+     *
+     * @param depth New depth value
+     */
+    public void setDepth(int depth);
+
+
+    /**
+     * Depth getter.
+     *
+     * @return int depth value
+     */
+    public int getDepth();
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/HttpRequestBodyMethodBase.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/HttpRequestBodyMethodBase.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/HttpRequestBodyMethodBase.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,261 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/HttpRequestBodyMethodBase.java,v 1.3 2004/07/28 09:30:46 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:30:46 $
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import org.apache.commons.httpclient.ChunkedOutputStream;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpConstants;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.HttpStatus;
+
+
+/**
+ * PUT Method.
+ *
+ *
+ * @since 1.0
+ */
+public abstract class HttpRequestBodyMethodBase extends HttpMethodBase {
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor.
+     */
+    public HttpRequestBodyMethodBase() {
+        super();
+    }
+
+
+
+    /**
+     * URI-setting constructor.
+     *
+     * @param uri the URI to request. The URI is expected
+     *        to be already URL encoded.  It may be either an absolute or
+     *        server relative path.
+     *
+     * @since 1.0
+     */
+    public HttpRequestBodyMethodBase(String uri) {
+        super(uri);
+    }
+
+
+    // ------------------------------------------------------- Instance Methods
+
+
+    /**
+     * Request body content to be sent.
+     */
+    private byte[] data = null;
+
+
+    /**
+     * Request body content to be sent.
+     */
+    private File file = null;
+
+
+    /**
+     * Request body content to be sent.
+     */
+    private URL url = null;
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Set my request body content to the contents of a file.
+     *
+     * @since 2.0
+     */
+    public void setRequestBody(File file) throws IOException {
+        checkNotUsed();
+        this.file = file;
+    }
+
+    /**
+     * Set my request body content to the resource at the specified URL.
+     *
+     * @since 2.0
+     */
+    public void setRequestBody(URL url) throws IOException {
+        checkNotUsed();
+        this.url = url;
+    }
+
+    /**
+     * Set my request body content to the contents of a byte array.
+     *
+     * @since 2.0
+     */
+    public void setRequestBody(byte[] bodydata) {
+        checkNotUsed();
+        this.data = bodydata;
+    }
+
+    /**
+     * Set my request body content to the contents of a string.
+     *
+     * @since 2.0
+     */
+    public void setRequestBody(String bodydata) {
+        checkNotUsed();
+        setRequestBody(HttpConstants.getContentBytes(bodydata, getRequestCharSet()));
+    }
+
+    /**
+     * Set my request body content to the contents of an input stream.
+     * The contents will be buffered into
+     * memory. To upload large entities, it is recommended to first buffer the
+     * data into a temporary file, and then send that file.
+     *
+     * @since 2.0
+     */
+    public void setRequestBody(InputStream is)
+        throws IOException {
+
+        checkNotUsed();
+        byte[] buffer = new byte[4096];
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        int nb = 0;
+        while (true) {
+            nb = is.read(buffer);
+            if (nb == -1) {
+                break;
+            }
+            os.write(buffer, 0, nb);
+        }
+        data = os.toByteArray();
+    }
+
+    /**
+     * Returns true if <tt>100 Continue</tt> status code
+     * is found.
+     *
+     * @since 2.0
+     */
+    public boolean readContinueCode() {
+        if (getStatusLine() == null) {
+            return false;
+        }
+        if(null != getRequestHeader("expect") &&
+           getStatusLine().getStatusCode() != HttpStatus.SC_CONTINUE) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Do write the request body.
+     * Override the method of {@link HttpMethodBase}
+     * if the method should wait until a <tt>100 Continue</tt> status code
+     * is expected (@link readContinueCode)
+     *
+     * @since 2.0
+     */
+    protected boolean writeRequestBody(HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        OutputStream out = conn.getRequestOutputStream();
+        if (isHttp11() && (null == getRequestHeader("Content-Length"))) {
+            out = new ChunkedOutputStream(out);
+        }
+
+        InputStream inputStream = null;
+        if (file != null && file.exists()) {
+            inputStream = new FileInputStream(file);
+        } else if (url != null) {
+            inputStream = url.openConnection().getInputStream();
+        } else if(data != null){
+            inputStream = new ByteArrayInputStream(data);
+        } else {
+            return true;
+        }
+
+        byte[] buffer = new byte[4096];
+        int nb = 0;
+        while (true) {
+            nb = inputStream.read(buffer);
+            if (nb == -1) {
+                break;
+            }
+            out.write(buffer, 0, nb);
+        }
+        out.flush();
+        return true;
+    }
+
+    /**
+     * Override the method of {@link HttpMethodBase}
+     * to return the appropriate content length.
+     *
+     * @since 2.0
+     */
+    protected int getRequestContentLength() {
+        if(null != data) {
+            return data.length;
+        } else if(null != file && file.exists()) {
+            return (int)(file.length());
+        } else if(url != null) {
+            return -1;
+        } else {
+            return 0;
+        }
+    }
+
+
+    /**
+     * return true, if the method setRequestContent has been called (with a null parameter)
+     *
+     * @since 2.0
+     */
+    protected boolean isRequestContentAlreadySet() {
+        return (data != null) || (file != null) || (url != null);
+    }
+
+    /**
+     *
+     * @since 1.0
+     */
+    public void recycle() {
+        super.recycle();
+        data = null;
+        url = null;
+        file = null;
+    }
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/LabelMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/LabelMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/LabelMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,236 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/LabelMethod.java,v 1.6 2004/08/02 15:45:47 unico Exp $
+ * $Revision: 1.6 $
+ * $Date: 2004/08/02 15:45:47 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+
+/**
+ * The Label method is used to manipulate labels on resources on the server.
+ *
+ * <h3>Example Request</h3>
+ * <pre>
+ * LABEL /files/testfile.xml HTTP/1.1
+ * Host: www.webdav.org
+ * Content-Type: text/xml; charset="utf-8"
+ *
+ * <?xml version="1.0" encoding="utf-8"?>
+ * <D:label xmlns:D="DAV:">
+ *   <D:set>
+ *     <D:label-name>newlabel</D:label-name>
+ *   </D:set>
+ * </D:label>
+ * </pre>
+ *
+ * <h3>Example Response</h3>
+ * <pre>
+ * HTTP/1.1 200 OK
+ * Cache-Control: no-cache
+ * </pre>
+ *
+ */
+public class LabelMethod extends XMLResponseMethodBase {
+
+    // ----------------------------------------------------- Instance Variables
+
+    /**
+     * The constant for setting a label.
+     */
+    public static final int LABEL_SET = 1;
+
+
+    /**
+     * The constant for adding a label.
+     */
+    public static final int LABEL_ADD = 2;
+
+
+    /**
+     * The constant for removing a label.
+     */
+    public static final int LABEL_REMOVE = 3;
+
+
+    /**
+     * The label name.
+     */
+    private String labelName = null;
+
+
+    /**
+     * The lable type.
+     */
+    private int type = 0;
+
+    // ----------------------------------------------------------- Constructors
+
+    /**
+     * The default constructor.
+     */
+    public LabelMethod() {
+    }
+
+
+    /**
+     * The label method constructor.
+     *
+     * @param path the path
+     * @param action the action
+     * @param labelName the label name
+     */
+    public LabelMethod(String path, int action, String labelName) {
+        super(path);
+        this.labelName = labelName;
+        this.type = action;
+    }
+
+
+    /**
+     * Set the type of label action to take.
+     *
+     * @param type the type of the label action
+     */
+    public void setType(int type) {
+        this.type = type;
+    }
+
+
+    /**
+     * Get the label type which has been set.
+     *
+     * @return the type
+     */
+    public int getType() {
+        return type;
+    }
+
+
+    /**
+     * Set the label-name this action will manipulate.
+     *
+     * @param labelName the label name
+     */
+    public void setLabelName(String labelName) {
+        this.labelName = labelName;
+    }
+
+
+    /**
+     * Get the label-name this action will manipulate.
+     *
+     * @return the label-name
+     */
+    public String getLabelName() {
+        return labelName;
+    }
+
+
+    /**
+     * Generate the protocol headers.
+     *
+     * @param state the state
+     * @param conn the connection
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        // set the default utf-8 encoding, if not already present
+        if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+        super.addRequestHeaders(state, conn);
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        if (type <= 0 || labelName == null)
+            throw new IllegalStateException
+                ("Action type and label name must be set before " +
+                 "calling this function");
+
+        XMLPrinter printer = new XMLPrinter();
+ 
+        printer.writeXMLHeader();
+        printer.writeElement("D", "DAV:", "label", XMLPrinter.OPENING);
+
+        String typeElement = null;
+        switch (type) {
+            case LABEL_SET:
+                typeElement = "set";
+                break;
+            case LABEL_REMOVE:
+                typeElement = "remove";
+                break;
+            case LABEL_ADD:
+                typeElement = "add";
+                break;
+        }
+
+        printer.writeElement("D", typeElement, XMLPrinter.OPENING);
+        printer.writeElement("D", "label-name", XMLPrinter.OPENING);
+        printer.writeText(labelName);
+        printer.writeElement("D", "label-name", XMLPrinter.CLOSING);
+        printer.writeElement("D", typeElement, XMLPrinter.CLOSING);
+        printer.writeElement("D", "label", XMLPrinter.CLOSING);
+
+        return printer.toString();
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            int code = getStatusLine().getStatusCode();
+            if (code == WebdavStatus.SC_CONFLICT     ||
+                code == WebdavStatus.SC_MULTI_STATUS ||
+                code == WebdavStatus.SC_FORBIDDEN ) {
+                parseXMLResponse(input);
+}
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+    public String getName() {
+        return "LABEL";
+    }
+}
+
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/LockMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/LockMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/LockMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,556 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/LockMethod.java,v 1.6.2.2 2004/10/02 17:33:49 luetzkendorf Exp $
+ * $Revision: 1.6.2.2 $
+ * $Date: 2004/10/02 17:33:49 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.util.URIUtil;
+
+import org.apache.webdav.lib.WebdavState;
+import org.apache.webdav.lib.properties.LockEntryProperty;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.apache.webdav.lib.util.DOMWriter;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * Web resources can be locked to ensure that only one user is updating
+ * the resource at a time.  Locking helps to prevent the "lost update" problem.
+ * There are two types of lock currently defined by the WebDAV specification:
+ * exclusive locks and shared locks.
+ *
+ * <p>   Per the specification, a lock indicates that someone is updating the
+ * resource, (hence the lock is a "write lock"), although the specification
+ * notes that the the syntax is extensible, and permits the eventual creation
+ * of locking for other access types.
+ *
+ * <h3>Shared and Exclusive Locks</h3>
+ *
+ * <p>   The most basic form of lock is an <em>exclusive lock</em>. This is a
+ * lock where the access right in question is only granted to a single client.
+ * The need for this arbitration results from a desire to avoid having to merge
+ * results.  However, there are times when the goal of a lock is not to exclude
+ * others from exercising an access right but rather to provide a mechanism for
+ * principals to indicate that they intend to exercise their access rights.
+ * <em>Shared locks</em> are provided for this case. A shared lock allows
+ * multiple clients to receive a lock. Hence any user with appropriate
+ * access can get the lock.
+ *
+ * <p>   With shared locks there are two trust sets that affect a resource.
+ * The first trust set is created by access permissions.  Principals who are
+ * trusted, for example, may have permission to write to the resource.  Among
+ * those who have access permission to write to the resource, the set of
+ * principals who have taken out a shared lock also must trust each other,
+ * creating a (typically) smaller trust set within the access permission write
+ * set.
+ *
+ * <h3>Lock Compatibility</h3>
+ *
+ * <p>   The following table indicates what happens if a new lock request
+ * is sent to a resource that is already locked: </p>
+ *
+ * <table border="1">
+ * <tr><th>             </th><th colspan="2">     Lock Request       </th></tr>
+ * <tr><th>Current Lock </th><th>Exclusive Lock </th><th>Shared Lock </th></tr>
+ * <tr><td>None         </td><td>Success        </td><td>Sucess      </td></tr>
+ * <tr><td>Shared       </td><td>Failure        </td><td>Sucess      </td></tr>
+ * <tr><td>Exclusive    </td><td>Failure        </td><td>Failure     </td></tr>
+ * </table>
+ *
+ */
+public class LockMethod
+    extends XMLResponseMethodBase implements DepthSupport {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    public static final short SCOPE_EXCLUSIVE =
+        LockEntryProperty.SCOPE_EXCLUSIVE;
+    public static final short SCOPE_SHARED = LockEntryProperty.SCOPE_SHARED;
+
+    public static final short TYPE_WRITE = LockEntryProperty.TYPE_WRITE;
+
+    // The timeout value for TimeType "Second" MUST NOT be greater than 2^32-1.
+    public static final int TIMEOUT_INFINITY = Integer.MAX_VALUE;
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * The scope of lock we're requesting.  The default scope is
+     * SCOPE_EXCLUSIVE.
+     */
+    private short scope = SCOPE_EXCLUSIVE;
+
+    /**
+     * Depth.
+     */
+    private int depth = DEPTH_INFINITY;
+
+
+    /**
+     * Opaque token of the lock we're trying to refresh.
+     */
+    private String refreshOpaqueToken = null;
+
+
+    /**
+     * Lock timeout.
+     */
+    private int timeout = TIMEOUT_INFINITY;
+
+
+    /**
+     * Lock owner.
+     */
+    private String owner = null;
+
+
+    /**
+     * Lock token.
+     */
+    private String lockToken = null;
+    
+    private boolean typeTransaction = false;
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Creates a lock method that can <em>start a transaction</em> when server supports
+     * them in a 
+     * <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_webdav_lock.asp">MS like style</a>.
+     * The transacion handle of the started transaction will be returned as the lock token. 
+     * To let subsequent requests participate in the transaction add a  
+     * <code>Transaction</code> header with the lock token as value. You will have to enclose it in '&lt;' and '>' just
+     * like ordinary lock tokens.  
+     * <br><br>
+     * To either commit or abort the transaction
+     * use {@link UnlockMethod}. 
+     *
+     * @param path any path inside Slide's scope
+     * @param owner of this transaction 
+     * @param timeout timeout of this transaction
+     * @param isTransaction <code>true</code> when this method is used to starte a transaction
+     * 
+     */
+    public LockMethod(String path, String owner, int timeout, boolean isTransaction) {
+        this(path);
+        setOwner(owner);
+        setTimeout(timeout);
+        setTypeTransaction(isTransaction);
+    }
+    
+    /**
+     * Method constructor.
+     */
+    public LockMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public LockMethod(String path) {
+        super(path);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public LockMethod(String path, String refreshOpaqueToken, int timeout) {
+        this(path);
+        this.refreshOpaqueToken = refreshOpaqueToken;
+        setTimeout(timeout);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public LockMethod(String path, String owner, short scope, int timeout) {
+        this(path);
+        setOwner(owner);
+        setScope(scope);
+        setTimeout(timeout);
+    }
+
+    /**
+     * Method constructor.
+     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
+     */
+    public LockMethod(String path, String refreshOpaqueToken, long timeout) {
+        this(path, refreshOpaqueToken, (int) timeout);
+    }
+
+
+    /**
+     * Method constructor.
+     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
+     */
+    public LockMethod(String path, String owner, short scope, long timeout) {
+        this(path, owner, scope, (int) timeout);
+    }
+
+    // ------------------------------------------------------------- Properties
+
+
+
+
+    /**
+     * Set a header value, redirecting the special cases of Depth and Time headers
+     * to {@link #setDepth} and {@link #setTimeout} as appropriate.
+     *
+     * @param headerName Header name
+     * @param headerValue Header value
+     */
+    public void setRequestHeader(String headerName, String headerValue) {
+        if (headerName.equalsIgnoreCase("Depth")){
+            int depth = -1;
+            if (headerValue.equals("0")){
+                depth = DEPTH_0;
+            }
+            if (headerValue.equals("1")){
+                depth = DEPTH_1;
+            }
+            else if (headerValue.equalsIgnoreCase("infinity")){
+                depth = DEPTH_INFINITY;
+            }
+            setDepth(depth);
+        }
+        else if(headerName.equalsIgnoreCase("Timeout")){
+            if (headerValue.startsWith("Second-"))
+                headerValue = headerValue.substring("Second-".length());
+            try {
+                setTimeout(Integer.parseInt(headerValue));
+            } catch (NumberFormatException e) {
+            }
+        }
+        else if(headerName.equalsIgnoreCase("Owner")){
+            setOwner(headerValue);
+        }
+        else{
+            super.setRequestHeader(headerName, headerValue);
+        }
+    }
+
+    public boolean isTypeTransaction() {
+        return typeTransaction;
+    }
+
+    public void setTypeTransaction(boolean typeTransaction) {
+        this.typeTransaction = typeTransaction;
+    }
+
+    /**
+     * Depth setter.
+     *
+     * @param depth New depth value
+     */
+    public void setDepth(int depth) {
+        checkNotUsed();
+        if (depth != DEPTH_0 && depth != DEPTH_INFINITY) {
+            throw new IllegalArgumentException
+            ("invalid depth value for lock method " + depth);
+        }
+        this.depth = depth;
+    }
+
+
+    /**
+     * Depth getter.
+     *
+     * @return int depth value
+     */
+    public int getDepth() {
+        return depth;
+    }
+
+
+    public String getLockToken() {
+        checkUsed();
+        return this.lockToken;
+    }
+
+
+
+    public boolean isRefresh() {
+        return !((this.refreshOpaqueToken == null ) ||
+                 (this.refreshOpaqueToken.equals("")));
+    }
+
+
+    public short getScope() {
+        return this.scope;
+    }
+
+
+    /**
+     * Sets the owner of the lock.  This method provides only "basic" owner
+     * information.  Thus, <code>setOwner("Jezebel Lipshitz")</code> will
+     * produce an <code>owner</code> element in the request document like this:
+     *
+     * <pre>
+     *   &lt;D:owner&gt;Jezebel Lipshitz&lt;/D:owner&gt;
+     * </pre>
+     *
+     * <p>  Examples in the Webdav specification suggest that one can use
+     * e-mail addresses, home page URLs, or other information; this
+     * implementation doesn't handle any of that.
+     */
+    public void setOwner(String owner) {
+        checkNotUsed();
+        this.owner = owner;
+    }
+
+    /** Return the owner of the lock as reported by the server. */
+    public String getOwner() {
+        return owner;
+    }
+
+
+    public void setScope(short scope) {
+        checkNotUsed();
+        if (scope != SCOPE_SHARED && scope != SCOPE_EXCLUSIVE) {
+            throw new IllegalArgumentException("invalid scope value");
+        }
+        this.scope = scope;
+    }
+
+
+    /**
+     * get the timeout value.
+     *
+     * @return timeout
+     */
+    public int getTimeout() {
+        return this.timeout;
+    }
+
+
+    /**
+     * Set the timeout value.
+     */
+    public void setTimeout(int timeout) {
+        checkNotUsed();
+        if (timeout < 0) {
+            throw new IllegalArgumentException("invalid timeout value: " +
+                                                   timeout);
+        }
+        this.timeout = timeout;
+    }
+
+    /**
+     * Set the timeout value.
+     * @deprecated The timeout value MUST NOT be greater than 2^32-1.
+     */
+    public void setTimeout(long timeout) {
+        setTimeout((int) timeout);
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+    public String getName() {
+        return "LOCK";
+    }
+
+    public void recycle() {
+        super.recycle();
+        this.refreshOpaqueToken = null;
+        this.depth = DEPTH_INFINITY;
+        this.scope = SCOPE_EXCLUSIVE;
+        this.timeout = TIMEOUT_INFINITY;
+        this.typeTransaction = false;
+    }
+
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state State token
+     * @param conn The connection being used for the request.
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        // set the default utf-8 encoding, if not already present
+        if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+        super.addRequestHeaders(state, conn);
+
+        switch (depth) {
+            case DEPTH_0:
+                super.setRequestHeader("Depth", "0");
+                break;
+            case DEPTH_INFINITY:
+                super.setRequestHeader("Depth", "infinity");
+                break;
+            default:
+        }
+
+        if (timeout == TIMEOUT_INFINITY) {
+            super.setRequestHeader("Timeout", "Infinite, Second-" + TIMEOUT_INFINITY);
+        } else {
+            super.setRequestHeader("Timeout", "Second-" + timeout);
+        }
+
+        if (isRefresh()) {
+            super.setRequestHeader("If", "(<" + refreshOpaqueToken + ">)");
+        }
+
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        String result = "";
+
+        if (!isRefresh()) {
+
+            if (this.owner == null || this.owner.equals("")) {
+                throw new IllegalStateException
+                    ("The owner property has not been set");
+            }
+
+            try {
+
+                DocumentBuilderFactory factory =
+                    DocumentBuilderFactory.newInstance();
+                DocumentBuilder builder = factory.newDocumentBuilder();
+                Document document = builder.newDocument();
+
+                Element lockinfo = document.createElement("DAV:lockinfo");
+                document.appendChild(lockinfo);
+                lockinfo.setAttribute("xmlns:DAV", "DAV:");
+
+                Element lockscope = document.createElement("DAV:lockscope");
+                lockinfo.appendChild(lockscope);
+
+                if (this.scope == SCOPE_EXCLUSIVE) {
+                    Element exclusive =
+                        document.createElement("DAV:exclusive");
+                    lockscope.appendChild(exclusive);
+                } else {
+                    Element shared = document.createElement("DAV:shared");
+                    lockscope.appendChild(shared);
+                }
+
+                Element locktype = document.createElement("DAV:locktype");
+                lockinfo.appendChild(locktype);
+
+                if (typeTransaction) {
+                    Element transaction = document.createElement("DAV:transaction");
+                    locktype.appendChild(transaction);
+                } else {
+                    Element write = document.createElement("DAV:write");
+                    locktype.appendChild(write);
+                }
+
+                Element owner = document.createElement("DAV:owner");
+                lockinfo.appendChild(owner);
+
+                Text text = document.createTextNode(this.owner);
+                owner.appendChild(text);
+
+                StringWriter stringWriter = new StringWriter();
+                DOMWriter domWriter = new DOMWriter(stringWriter, false);
+                domWriter.print(document);
+
+                result = stringWriter.getBuffer().toString();
+
+            } catch (DOMException e) {
+            } catch (ParserConfigurationException e) {
+            }
+
+        }
+
+        return result;
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        int status = getStatusLine().getStatusCode();
+        if (status == HttpStatus.SC_OK      ||
+            status == HttpStatus.SC_CREATED ||
+            status == HttpStatus.SC_MULTI_STATUS ) {
+
+            parseXMLResponse(input);
+
+            NodeList list = getResponseDocument().getDocumentElement()
+                  .getElementsByTagNameNS("DAV:", "locktoken");
+
+            if (list.getLength() == 1) {
+                Element locktoken = (Element) list.item(0);
+                NodeList list2 = locktoken.getElementsByTagNameNS("DAV:", "href");
+                if (list2.getLength() == 1) {
+                    this.lockToken = DOMUtils.getTextValue(list2.item(0));
+                    if (state instanceof WebdavState) {
+                       /* 
+                        * lockMethod/unlockMethod take unescaped URIs but LockMathod.getPath()
+                        * func returns an escaped URI so searching for the lock by path name in 
+                        * the state object doesn't work. Convert escaped back to unescaped.
+                        */
+                        ((WebdavState) state).addLock(URIUtil.decode(getPath()), 
+                                this.lockToken);
+                    }
+                }
+            }
+
+            list = getResponseDocument().getDocumentElement()
+                  .getElementsByTagNameNS("DAV:", "owner");
+
+            if (list.getLength() == 1) {
+                Element owner = (Element)list.item(0);
+
+                this.owner = DOMUtils.getTextValue(owner);
+            }
+        }
+    }
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MkWorkspaceMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MkWorkspaceMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MkWorkspaceMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,104 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/MkWorkspaceMethod.java,v 1.4 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+
+/**
+ * The MkWorkspace method is used to create a new workspace. New workspaces
+ * can only be created in the workspace collection of the server. A workspace
+ * can contain version controled resources and any other. Each resource
+ * must identify its workspace.
+ *
+ * It is not allowed to create a new workspace inside an exiting workspace.
+ *
+ *
+ * <h3>Example Request</h3>
+ * <pre>
+ * MKWORKSPACE /ws/myWs/ HTTP/1.1
+ * Host: www.server.org
+ * </pre>
+ *
+ * <h3>Example Response</h3>
+ * <pre>
+ * HTTP/1.1 201 Created
+ * </pre>
+ *
+ */
+public class MkWorkspaceMethod
+    extends XMLResponseMethodBase {
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public MkWorkspaceMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public MkWorkspaceMethod(String path) {
+        super(path);
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+
+    public String getName() {
+        return "MKWORKSPACE";
+    }
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            int code = getStatusLine().getStatusCode();
+            if (code == WebdavStatus.SC_CONFLICT     ||
+                code == WebdavStatus.SC_FORBIDDEN ) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MkcolMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MkcolMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MkcolMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,105 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/MkcolMethod.java,v 1.3 2004/07/28 09:30:40 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:30:40 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.httpclient.HttpMethodBase;
+
+/**
+ * The MKCOL method is used to create a new collection. All DAV compliant
+ * resources must support the MKCOL method.  Collections are merely
+ * the HTTP name for structures like directories or folders (and, in
+ * fact, often map directly to a folder or directory on the web server.
+ *
+ * <p>   This implementation of a MKCOL client method does not support a
+ * a request body, and the newly created web collection should therefore
+ * have no members.
+ *
+ * <p>   MKCOL creates a new collection resource at the location specified by
+ * the Request-URI. If the resource identified by the Request-URI already
+ * exists on the server then the MKCOL will fail.  During MKCOL processing,
+ * a server will make the Request-URI a member of the URI's parent collection
+ * (unless the Request-URI is "/").  If no parent collection exists, the method
+ * will fail.  Thus, for example, if a request to create collection
+ * <code>/a/b/c/d/</code> is made, and neither <code>/a/b/</code> nor
+ * <code>/a/b/c/</code> exists, the request will fail.
+ *
+ * <p>   MKCOL is not idempotent (that is to say, each MKCOL request should
+ * be handled by the web server, and the results of a MKCOL request should
+ * not be cached).
+ *
+ * <h3>Example Request</h3>
+ * <pre>
+ * MKCOL /webdisc/xfiles/ HTTP/1.1
+ * Host: www.server.org
+ * </pre>
+ *
+ * <h3>Example Response</h3>
+ * <pre>
+ * HTTP/1.1 201 Created
+ * </pre>
+ *
+ */
+public class MkcolMethod
+    extends HttpMethodBase {
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public MkcolMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public MkcolMethod(String path) {
+        super(path);
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+
+    /**
+     * Parse the response body.  The MKCOL method does not receive a response
+     * body.
+     *
+     * @param is Input stream
+     */
+    public void parseResponse(InputStream is)
+        throws IOException {
+    }
+
+    public String getName() {
+        return "MKCOL";
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MoveMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MoveMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/MoveMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,243 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/MoveMethod.java,v 1.6 2004/07/28 09:30:40 ib Exp $
+ * $Revision: 1.6 $
+ * $Date: 2004/07/28 09:30:40 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.protocol.Protocol;
+
+
+/**
+ * MOVE Method.
+ *
+ */
+public class MoveMethod
+    extends XMLResponseMethodBase {
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public MoveMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public MoveMethod(String source) {
+        super(source);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public MoveMethod(String source, String destination) {
+        this(source);
+        setDestination(destination);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public MoveMethod(String source, String destination, boolean overwrite) {
+        this(source, destination);
+        setOverwrite(overwrite);
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Destination.
+     */
+    private String destination;
+
+
+    /**
+     * Overwrite.
+     */
+    private boolean overwrite = true;
+
+
+    // ------------------------------------------------------------- Properties
+
+
+
+    /**
+     * Set a header value, redirecting the special case of the Overwrite and Destination
+     * headers to {@link #setOverwrite} and {@link #setDestination} as appropriate.
+     *
+     * @param headerName Header name
+     * @param headerValue Header value
+     */
+    public void setRequestHeader(String headerName, String headerValue) {
+        if (headerName.equalsIgnoreCase("Overwrite")){
+            setOverwrite(! (headerValue.equalsIgnoreCase("F") ||
+                           headerValue.equalsIgnoreCase("False") ) );
+        }
+        else if(headerName.equalsIgnoreCase("Destination")){
+            setDestination(headerValue);
+        }
+        else{
+            super.setRequestHeader(headerName, headerValue);
+        }
+    }
+
+
+
+    /**
+     * Destination setter.
+     *
+     * @param destination New destination value
+     */
+    public void setDestination(String destination) {
+        checkNotUsed();
+        this.destination = destination;
+    }
+
+
+    /**
+     * Destination getter.
+     *
+     * @return String destination value
+     */
+    public String getDestination() {
+        return destination;
+    }
+
+
+    /**
+     * Overwrite setter.
+     *
+     * @param overwrite New overwrite value
+     */
+    public void setOverwrite(boolean overwrite) {
+        checkNotUsed();
+        this.overwrite = overwrite;
+    }
+
+
+    /**
+     * Overwrite getter.
+     *
+     * @return boolean Overwrite value
+     */
+    public boolean isOverwrite() {
+        return overwrite;
+    }
+
+
+    /**
+     * Overwrite getter.
+     *
+     * @return boolean Overwrite value
+     */
+    public boolean getOverwrite() {
+        return overwrite;
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+
+    public String getName() {
+        return "MOVE";
+    }
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state State token
+     * @param conn The connection being used to make the request.
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        super.addRequestHeaders(state, conn);
+
+        String absoluteDestination = getAbsoluteDestination(conn, destination);
+        super.setRequestHeader("Destination", absoluteDestination);
+
+        if (!isOverwrite())
+            super.setRequestHeader("Overwrite", "F");
+
+    }
+
+    /**
+     * A client of the {@link MoveMethod} can specify a destination as either an
+     * absolute URL (possibly to a different server), or as a absolute path on
+     * the same server, but this function makes sure that the path sent to the
+     * server is always an absolute URL.
+     *
+     * <p>Note that this function will add server and port to the request -
+     * however, port is not added if it is the default port for the scheme
+     * in question. </p>
+     *
+     * <p>This function is static so that it can be reused by the {@link CopyMethod}.
+     * </p>
+     *
+     * @param conn  The connection for the current request, in case the caller
+     *  specifies an absolute path.
+     *
+     * @param absolutePathOrURL If an absolute URL, nothing done, but if an absolute
+     *  path, it is converted into an absolute URL.
+     *
+     * @return An absolute URL
+     */
+    static String getAbsoluteDestination(HttpConnection conn, String absolutePathOrURL) {
+
+        String absoluteDestination = absolutePathOrURL;
+
+        // is this an absolute path?
+        if (absolutePathOrURL.startsWith("/")) {
+
+            // yes - get the protocol to start the URL with the appropriate scheme.
+            Protocol protocol = conn.getProtocol();
+            StringBuffer bufDest = new StringBuffer(protocol.getScheme());
+            bufDest.append("://").append(conn.getHost());
+
+            // only add in the port if it is not the default port.
+            if (conn.getPort() != protocol.getDefaultPort()) {
+                bufDest.append(':').append(conn.getPort());
+            }
+
+            // append the path.
+            bufDest.append(absolutePathOrURL);
+            absoluteDestination = bufDest.toString();
+        }
+        return absoluteDestination;
+    }
+
+
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/OptionsMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/OptionsMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/OptionsMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,368 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/OptionsMethod.java,v 1.6 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.6 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+import org.apache.webdav.lib.util.XMLPrinter;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/**
+ * OPTIONS Method.
+ *
+ */
+public class OptionsMethod
+    extends XMLResponseMethodBase {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * DAV level 1. Mandatory.
+     */
+    public static final String DAV_LEVEL1 = "1";
+
+
+    /**
+     * DAV level 2.
+     */
+    public static final String DAV_LEVEL2 = "2";
+
+
+    /**
+     * Advanced collections.
+     */
+    public static final String ADVANCED_COLLECTIONS = "3";
+
+
+    /**
+     * Delta V.
+     */
+    public static final String DELTAV = "4";
+
+
+    /**
+     * ACL.
+     */
+    public static final String ACL = "5";
+
+
+    /**
+     * DASL.
+     */
+    public static final String DASL = "6";
+
+    /**
+     *
+     */
+    public static final int OPTIONS_WORKSPACE = 8;
+
+    /**
+     *
+     */
+    public static final int OPTIONS_VERSION_HISTORY = 9;
+
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public OptionsMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public OptionsMethod(String path) {
+        super(path);
+    }
+
+    /**
+     * Method constructor.
+     */
+    public OptionsMethod(String path, int type) {
+        super(path);
+        this.type = type;
+    }
+
+    // ----------------------------------------------------- Instance Variables
+    /**
+     * DAV Capabilities.
+     */
+    private Vector davCapabilities = new Vector();
+
+
+    /**
+     * Methods allowed.
+     */
+    private Vector methodsAllowed = new Vector();
+
+    private int type = 0;
+
+    private boolean hasXMLBody = false;
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Is the specified method allowed ?
+     */
+    public boolean isAllowed(String method) {
+        checkUsed();
+        return methodsAllowed.contains(method);
+    }
+
+
+    /**
+     * Get a list of allowed methods.
+     */
+    public Enumeration getAllowedMethods() {
+        checkUsed();
+        return methodsAllowed.elements();
+    }
+
+
+    /**
+     * Is DAV capability supported ?
+     */
+    public boolean isSupported(String capability) {
+        checkUsed();
+        return davCapabilities.contains(capability);
+    }
+
+
+    /**
+     * Get a list of supported DAV capabilities.
+     */
+    public Enumeration getDavCapabilities() {
+        checkUsed();
+        return davCapabilities.elements();
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            if (getStatusLine().getStatusCode() == WebdavStatus.SC_OK && hasXMLBody) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+
+
+
+
+    /**
+     * Process response headers. The contract of this method is that it only
+     * parses the response headers.
+     *
+     * @param state the state
+     * @param conn the connection
+     */
+    public void processResponseHeaders(HttpState state,
+        HttpConnection conn) {
+
+        Header davHeader = getResponseHeader("dav");
+        if (davHeader != null) {
+            String davHeaderValue = davHeader.getValue();
+            StringTokenizer tokenizer =
+                new StringTokenizer(davHeaderValue, ",");
+            while (tokenizer.hasMoreElements()) {
+                String davCapability = tokenizer.nextToken().trim();
+                davCapabilities.addElement(davCapability);
+            }
+        }
+
+        Header allowHeader = getResponseHeader("allow");
+        if (allowHeader != null) {
+            String allowHeaderValue = allowHeader.getValue();
+            StringTokenizer tokenizer =
+                new StringTokenizer(allowHeaderValue, ",");
+            while (tokenizer.hasMoreElements()) {
+                String methodAllowed =
+                    tokenizer.nextToken().trim().toUpperCase();
+                methodsAllowed.addElement(methodAllowed);
+            }
+        }
+
+        Header lengthHeader = getResponseHeader("content-length");
+        Header typeHeader = getResponseHeader("content-type");
+        if(
+                (lengthHeader != null &&
+                 Integer.parseInt(lengthHeader.getValue()) > 0) ||
+                (typeHeader != null &&
+                 typeHeader.getValue().startsWith("text/xml")))
+            hasXMLBody = true;
+
+        super.processResponseHeaders(state, conn);
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        if (type != 0){
+            XMLPrinter printer = new XMLPrinter();
+
+            printer.writeXMLHeader();
+            //System.out.println(printer.toString());
+            printer.writeElement("D", "DAV:", "options",
+                                 XMLPrinter.OPENING);
+
+            if (type == OPTIONS_VERSION_HISTORY)
+                printer.writeElement("D", "version-history-collection-set", XMLPrinter.NO_CONTENT);
+            if (type == OPTIONS_WORKSPACE)
+                printer.writeElement("D", "workspace-collection-set", XMLPrinter.NO_CONTENT);
+
+            printer.writeElement("D", "options", XMLPrinter.CLOSING);
+
+            return printer.toString();
+        }
+
+        return null;
+    }
+
+    public String getName() {
+        return "OPTIONS";
+    }
+
+        //get and set header
+     public void addRequestHeaders(HttpState state, HttpConnection conn)
+     throws IOException, HttpException {
+
+         if (type!= 0){
+            // set the default utf-8 encoding, if not already present
+            if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+         }
+
+         super.addRequestHeaders(state, conn);
+     }
+
+/**
+     * This method returns an enumeration of URL paths.  If the PropFindMethod
+     * was sent to the URL of a collection, then there will be multiple URLs.
+     * The URLs are picked out of the <code>&lt;D:href&gt;</code> elements
+     * of the response.
+     *
+     * @return an enumeration of URL paths as Strings
+     */
+    public Enumeration getAllResponseURLs() {
+        checkUsed();
+        return getResponseURLs().elements();
+    }
+
+    public Enumeration getResponseProperties(){
+        Vector result = new Vector();
+        return (Enumeration) result;
+    }
+
+
+    protected Document parseResponseContent(InputStream is)
+        throws ParserConfigurationException, SAXException, IOException {
+
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+
+        DocumentBuilder builder = factory.newDocumentBuilder();
+
+        byte[] chunk;
+        byte[] all;
+        int chunkLen;
+        int allLen;
+        List chunks;
+        int i;
+        int max;
+        int ofs;
+
+        allLen = 0;
+        chunk = new byte[1024*4];
+        chunkLen = is.read(chunk);
+        chunks = new ArrayList();
+        while (chunkLen != -1) {
+            chunks.add(new Integer(chunkLen));
+            chunks.add(chunk);
+            allLen += chunkLen;
+            chunk = new byte[1024*4];
+            chunkLen = is.read(chunk);
+        }
+
+        all = new byte[allLen];
+        ofs = 0;
+        max = chunks.size();
+        for (i = 0; i < max; i += 2) {
+            chunkLen = ((Integer) chunks.get(i)).intValue();
+            chunk = (byte[]) chunks.get(i + 1);
+            System.arraycopy(chunk, 0, all, ofs, chunkLen);
+            ofs += chunkLen;
+        }
+
+        if (all.length == 0) return null;
+        return builder.parse(new InputSource(new ByteArrayInputStream(all)));
+
+    }
+
+}
+
+
+
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PollMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PollMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PollMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,185 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/PollMethod.java,v 1.3 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.HttpStatus;
+
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * Implements the POLL WebDAV method.
+ * 
+ * @see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_webdav_poll.asp">Reference</a>
+ */
+public class PollMethod extends XMLResponseMethodBase
+{
+   private static final String HEADER_SUBSCRIPTION_ID = "Subscription-Id";
+   private static final String EXCHANGE_NS = "http://schemas.microsoft.com/Exchange/";
+   private List subscriptionIds = new ArrayList();
+   private List subscriptionsWithEvents = new ArrayList();
+   private List subscriptionsWithoutEvents = new ArrayList();
+   
+   
+   public PollMethod() {
+      
+   }
+   
+   public PollMethod(String path) {
+      super(path);
+   }
+   
+   /**
+    * Adds an ID for a subscription that is to be polled. All added subscription
+    * IDs should have the got same Content-Location uri from the SUBSCRIBE method. 
+    */
+   public void addSubscriptionId(int id) {
+      checkNotUsed();
+      this.subscriptionIds.add(new Integer(id));
+   }
+   
+   /**
+    * Returns a list of number objects containing the subscription IDs for
+    * subscriptions for which events are reported.
+    * @return Collection of {@link Integer}s
+    */
+   public Collection getSubscriptionsWithEvents() {
+      checkUsed();
+      return this.subscriptionsWithEvents;
+   }
+   /**
+    * Returns a list of number objects containing the subscription IDs for
+    * subscriptions for which <em>NO</em> events are reported.
+    * @return Collection of {@link Integer}s
+    */
+   public Collection getSubscriptionsWithoutEvents() {
+      checkUsed();
+      return this.subscriptionsWithoutEvents;
+   }
+   
+   // --------------------------------------------------- WebdavMethod Methods
+
+   public String getName()
+   {
+      return "POLL";
+   }
+   
+   public void recycle()
+   {
+      super.recycle();
+      this.subscriptionIds.clear();
+   }
+   
+   protected void addRequestHeaders(HttpState state, HttpConnection conn)
+      throws IOException, HttpException
+   {
+      super.addRequestHeaders(state, conn);
+      if (this.subscriptionIds.size() > 0) {
+         StringBuffer b = new StringBuffer();
+         boolean first = true;
+         for (Iterator i = this.subscriptionIds.iterator(); i.hasNext();) {
+            if (first) first = false; else b.append(", ");
+            b.append(i.next());
+         }
+         super.addRequestHeader(HEADER_SUBSCRIPTION_ID, b.toString());
+      }
+   }
+   
+   /**
+    * Adds special checking of header values of the POLL method to
+    * the super class implementation.
+    */
+   public void setRequestHeader(String headerName, String headerValue) 
+   {
+      if (headerName.equalsIgnoreCase(HEADER_SUBSCRIPTION_ID)){
+         StringTokenizer t = new StringTokenizer(headerValue, ", ");
+         try {
+            for(;t.hasMoreTokens();) {
+               addSubscriptionId(Integer.parseInt(t.nextToken()));
+            }
+         } catch (NumberFormatException e) {
+            throw new IllegalArgumentException("Invalid header value '" +
+                  headerValue + "' for header " + headerName + "!");
+         }
+      } else {
+         super.setRequestHeader(headerName, headerValue);
+      }
+   }
+   
+   public void parseResponse(InputStream input, HttpState state,
+         HttpConnection conn) throws IOException, HttpException
+   {
+      int status = getStatusLine().getStatusCode();
+      
+      if (status == HttpStatus.SC_MULTI_STATUS) {
+         parseXMLResponse(input);
+         NodeList list = getResponseDocument().getDocumentElement()
+            .getElementsByTagNameNS("DAV:", "response");
+         
+         for(int i = 0; i < list.getLength(); i++) {
+            Element e = (Element)list.item(i);
+            
+            NodeList s = e.getElementsByTagNameNS("DAV:", "status");
+            if (s.getLength() > 0) {
+               Element response = ((Element)(s.item(0)).getParentNode());
+               String statusText = DOMUtils.getTextValue((Element)s.item(0));
+               if (statusText.indexOf(" 200 ") != -1) {
+                  // polled subscriptions for which *AN* event is fired
+                  NodeList p = response.getElementsByTagNameNS(EXCHANGE_NS, "subscriptionID");
+                  if (p.getLength()>0) {
+                     NodeList li = ((Element)p.item(0)).getElementsByTagName("li");
+                     for(int l = 0; l < li.getLength();++l) {
+                        String id = DOMUtils.getTextValue(li.item(i));
+                        this.subscriptionsWithEvents.add(Integer.getInteger(id));
+                     }
+                  }
+               } else
+               if (statusText.indexOf(" 204 ") != -1) {
+                  // polled subscriptions for which *NO* event is fired
+                  NodeList p = response.getElementsByTagNameNS(EXCHANGE_NS, "subscriptionID");
+                  if (p.getLength()>0) {
+                     NodeList li = ((Element)p.item(0)).getElementsByTagName("li");
+                     for(int l = 0; l < li.getLength();++l) {
+                        String id = DOMUtils.getTextValue(li.item(i));
+                        this.subscriptionsWithoutEvents.add(Integer.getInteger(id));
+                     }
+                  }
+               }
+            }
+         }
+      }
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropFindMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropFindMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropFindMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,422 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/PropFindMethod.java,v 1.7 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.7 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+/**
+ * This class implements the WebDAV PROPFIND Method.
+ *
+ * <P>     The PROPFIND method retrieves properties defined on the resource
+ * identified by the Request-URI, if the resource does not have any internal
+ * members, or on the resource identified by the Request-URI and potentially
+ * its member resources, if the resource is a collection that has internal
+ * member URIs.
+ *
+ * <P>     A typical request looks like this:
+ *
+ * <PRE>
+ *
+ * PROPFIND /file HTTP/1.1
+ * Host: www.foo.bar
+ * Content-type: text/xml; charset="utf-8"
+ * Content-Length: xxxx
+ *
+ * &lt;?xml version="1.0" encoding="utf-8" ?&gt;
+ *   &lt;D:propfind xmlns:D="DAV:"&gt;
+ *   &lt;D:prop xmlns:R="http://www.foo.bar/boxschema/"&gt;
+ *     &lt;R:bigbox/&gt;
+ *     &lt;R:author/&gt;
+ *     &lt;R:DingALing/&gt;
+ *     &lt;R:Random/&gt;
+ *   &lt;/D:prop&gt;
+ * &lt;/D:propfind&gt;
+ * </PRE>
+ *
+ */
+public class PropFindMethod extends XMLResponseMethodBase
+    implements DepthSupport {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * Request of named properties.
+     */
+    public static final int BY_NAME = 0;
+
+
+    /**
+     * Request of all properties name and value.
+     */
+    public static final int ALL = 1;
+
+
+    /**
+     * Request of all properties name.
+     */
+    public static final int NAMES = 2;
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public PropFindMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public PropFindMethod(String path) {
+        super(path);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public PropFindMethod(String path, int depth) {
+        this(path);
+        setDepth(depth);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public PropFindMethod(String path, int depth, int type) {
+        this(path);
+        setDepth(depth);
+        setType(type);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public PropFindMethod(String path, Enumeration propertyNames) {
+        this(path);
+        setDepth(1);
+        setPropertyNames(propertyNames);
+        setType(BY_NAME);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public PropFindMethod(String path, int depth, Enumeration propertyNames) {
+        this(path);
+        setDepth(depth);
+        setPropertyNames(propertyNames);
+        setType(BY_NAME);
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Type of the Propfind.
+     */
+    protected int type = ALL;
+
+
+    /**
+     * Property name list.
+     */
+    protected PropertyName[] propertyNames;
+
+    /**
+     * Depth.
+     */
+    protected int depth = DEPTH_INFINITY;
+
+
+    /**
+     * The namespace abbreviation that prefixes DAV tags
+     */
+    protected String prefix = null;
+
+
+    // ------------------------------------------------------------- Properties
+
+
+
+
+    /**
+     * Set a request header value, redirecting the special case of the "Depth" header
+     * to invoke {@link #setDepth} instead.
+     *
+     * @param headerName Header name
+     * @param headerValue Header value
+     */
+    public void setRequestHeader(String headerName, String headerValue) {
+        if (headerName.equalsIgnoreCase("Depth")){
+            int depth = -1;
+            if (headerValue.equals("0")){
+                depth = DEPTH_0;
+            }
+            else if (headerValue.equals("1")){
+                depth = DEPTH_1;
+            }
+            else if (headerValue.equalsIgnoreCase("infinity")){
+                depth = DEPTH_INFINITY;
+            }
+            setDepth(depth);
+        }
+        else{
+            super.setRequestHeader(headerName, headerValue);
+        }
+    }
+
+
+    /**
+     * Type setter.
+     *
+     * @param type New type value
+     */
+    public void setType(int type) {
+        checkNotUsed();
+        this.type = type;
+    }
+
+
+    /**
+     * Type getter.
+     *
+     * @return int type value
+     */
+    public int getType() {
+        return type;
+    }
+
+
+    /**
+     * Depth setter.
+     *
+     * @param depth New depth value
+     */
+    public void setDepth(int depth) {
+        checkNotUsed();
+        this.depth = depth;
+    }
+
+
+    /**
+     * Depth getter.
+     *
+     * @return int depth value
+     */
+    public int getDepth() {
+        return depth;
+    }
+
+
+    /**
+     * Property names setter.
+     * The enumeration may contain strings with or without a namespace prefix
+     * but the preferred way is to provide PropertyName objects.
+     *
+     * @param propertyNames List of the property names
+     */
+    public void setPropertyNames(Enumeration propertyNames) {
+        checkNotUsed();
+
+        Vector list = new Vector();
+        while (propertyNames.hasMoreElements()) {
+
+            Object item = propertyNames.nextElement();
+
+            if (item instanceof PropertyName)
+            {
+                list.add(item);
+            }
+            else if (item instanceof String)
+            {
+                String propertyName = (String) item;
+
+                int length = propertyName.length();
+                boolean found = false;
+                int i = 1;
+                while (!found && (i <= length)) {
+                    char chr = propertyName.charAt(length - i);
+                    if (!Character.isUnicodeIdentifierPart(chr)
+                        && chr!='-' && chr!='_' && chr!='.') {
+                        found = true;
+                    } else {
+                        i++;
+                    }
+                }
+                if ((i == 1) || (i >= length)) {
+                    list.add(new PropertyName("DAV:",propertyName));
+                } else {
+                    String namespace = propertyName.substring(0, length + 1 - i);
+                    String localName = propertyName.substring(length + 1 - i);
+                    list.add(new PropertyName(namespace,localName));
+                }
+            }
+            else
+            {
+                // unknown type
+                // ignore
+            }
+        }
+
+        this.propertyNames = (PropertyName[])list.toArray(new PropertyName[list.size()]);
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+
+    public void recycle() {
+        super.recycle();
+        prefix = null;
+    }
+
+    public String getName() {
+        return "PROPFIND";
+
+    }
+
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state State token
+     * @param conn The connection being used to make the request.
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        // set the default utf-8 encoding, if not already present
+        if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+        super.addRequestHeaders(state, conn);
+
+        switch (depth) {
+        case DEPTH_0:
+            super.setRequestHeader("Depth", "0");
+            break;
+        case DEPTH_1:
+            super.setRequestHeader("Depth", "1");
+            break;
+        case DEPTH_INFINITY:
+            super.setRequestHeader("Depth", "infinity");
+            break;
+        }
+
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        XMLPrinter printer = new XMLPrinter();
+
+        printer.writeXMLHeader();
+        printer.writeElement("D", "DAV:", "propfind",
+                             XMLPrinter.OPENING);
+                             
+                             
+
+        switch (type) {
+        case ALL:
+            printer.writeElement("D", "allprop", XMLPrinter.NO_CONTENT);
+            break;
+        case NAMES:
+            printer.writeElement("D", "propname", XMLPrinter.NO_CONTENT);
+            break;
+        case BY_NAME:
+            printer.writeElement("D", "prop", XMLPrinter.OPENING);
+            for (int i=0 ; i<propertyNames.length ; i++)
+            {
+                String namespace = propertyNames[i].getNamespaceURI();
+                String localname = propertyNames[i].getLocalName();
+                if ("DAV:".equals(namespace)) {
+                    printer.writeElement("D", localname, XMLPrinter.NO_CONTENT);
+                } else {
+                    if (namespace.length() > 0) {
+                        printer.writeElement("ZZ", namespace, localname,
+                                XMLPrinter.NO_CONTENT);
+                    } else {
+                        printer.writeElement(null, null, localname,
+                                XMLPrinter.NO_CONTENT);
+                    }
+                }
+            }
+            printer.writeElement("D", "prop", XMLPrinter.CLOSING);
+            break;
+        }
+
+        printer.writeElement("D", "propfind", XMLPrinter.CLOSING);
+
+        return printer.toString();
+    }
+
+    /**
+     * This method returns an enumeration of URL paths.  If the PropFindMethod
+     * was sent to the URL of a collection, then there will be multiple URLs.
+     * The URLs are picked out of the <code>&lt;D:href&gt;</code> elements
+     * of the response.
+     *
+     * @return an enumeration of URL paths as Strings
+     */
+    public Enumeration getAllResponseURLs() {
+        checkUsed();
+        return getResponseURLs().elements();
+    }
+
+    /**
+     * Returns an enumeration of <code>Property</code> objects.
+     */
+    public Enumeration getResponseProperties(String urlPath) {
+        checkUsed();
+
+        Response response = (Response) getResponseHashtable().get(urlPath);
+        if (response != null) {
+            return response.getProperties();
+        } else {
+            return (new Vector()).elements();
+        }
+
+    }
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropPatchMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropPatchMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropPatchMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,276 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/PropPatchMethod.java,v 1.6 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.6 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+
+/**
+ * PROPPATCH Method.
+ *
+ */
+public class PropPatchMethod
+    extends XMLResponseMethodBase {
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public PropPatchMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public PropPatchMethod(String path) {
+        super(path);
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Hashtable of the properties to set.
+     */
+    protected Hashtable toSet = new Hashtable();
+
+
+    /**
+     * Hashtable of the properties to remove.
+     */
+    protected Hashtable toRemove = new Hashtable();
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Add a new property to set.
+     *
+     * @param name Property name
+     * @param value Property value
+     */
+    public void addPropertyToSet(String name, String value) {
+        checkNotUsed();
+        Property propertyToSet = new Property();
+        if (name != null) {
+            propertyToSet.name = name;
+            if (value != null)
+                propertyToSet.value = value;
+            else
+                propertyToSet.value = "";
+            toSet.put(name, propertyToSet);
+        }
+    }
+
+
+    /**
+     * Add a new property to set.
+     *
+     * @param name Property name
+     * @param value Property value
+     * @param namespace Namespace abbreviation
+     * @param namespaceInfo Namespace information
+     */
+    public void addPropertyToSet(String name, String value, String namespace,
+                                 String namespaceInfo) {
+        checkNotUsed();
+        Property propertyToSet = new Property();
+        if (name != null) {
+            propertyToSet.name = name;
+            if (value != null)
+                propertyToSet.value = value;
+            else
+                propertyToSet.value = "";
+            propertyToSet.namespace = namespace;
+            propertyToSet.namespaceInfo = namespaceInfo;
+            toSet.put(namespace + name, propertyToSet);
+        }
+    }
+
+
+    /**
+     * Add property to remove.
+     *
+     * @param name Property name
+     */
+    public void addPropertyToRemove(String name) {
+        checkNotUsed();
+        Property propertyToRemove = new Property();
+        if (name != null) {
+            propertyToRemove.name = name;
+            toRemove.put(name, propertyToRemove);
+        }
+    }
+
+
+    /**
+     * Add property to remove.
+     *
+     * @param name Property name
+     * @param namespace Namespace abbreviation
+     * @param namespaceInfo Namespace information
+     */
+    public void addPropertyToRemove(String name, String namespace,
+                                    String namespaceInfo) {
+        checkNotUsed();
+        Property propertyToRemove = new Property();
+        if (name != null) {
+            propertyToRemove.name = name;
+            propertyToRemove.namespace = namespace;
+            propertyToRemove.namespaceInfo = namespaceInfo;
+            toRemove.put(name, propertyToRemove);
+        }
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+
+    public String getName() {
+        return "PROPPATCH";
+    }
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state State token
+     * @param conn the connection
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        // set the default utf-8 encoding, if not already present
+        if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+        super.addRequestHeaders(state, conn);
+
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+        XMLPrinter printer = new XMLPrinter();
+
+
+        printer.writeXMLHeader();
+        printer.writeElement("D", "DAV:", "propertyupdate",
+                             XMLPrinter.OPENING);
+
+        if (toSet.size() > 0) {
+
+            printer.writeElement("D", null, "set", XMLPrinter.OPENING);
+
+            Enumeration toSetList = toSet.elements();
+            printer.writeElement("D", null, "prop", XMLPrinter.OPENING);
+            while (toSetList.hasMoreElements()) {
+                Property current = (Property) toSetList.nextElement();
+                if ("DAV:".equals(current.namespaceInfo)) {
+                    printer.writeProperty("D", null, current.name, current.value);
+                }
+                else {
+                    printer.writeProperty(current.namespace, current.namespaceInfo,
+                                      current.name, current.value);
+                }
+            }
+            printer.writeElement("D", null, "prop", XMLPrinter.CLOSING);
+
+            printer.writeElement("D", null, "set", XMLPrinter.CLOSING);
+
+        }
+
+        if (toRemove.size() > 0) {
+
+            printer.writeElement("D", null, "remove", XMLPrinter.OPENING);
+
+            Enumeration toRemoveList = toRemove.elements();
+            printer.writeElement("D", null, "prop", XMLPrinter.OPENING);
+            while (toRemoveList.hasMoreElements()) {
+                Property current = (Property) toRemoveList.nextElement();
+                printer.writeElement(current.namespace, current.namespaceInfo,
+                                     current.name, XMLPrinter.NO_CONTENT);
+            }
+            printer.writeElement("D", null, "prop", XMLPrinter.CLOSING);
+
+            printer.writeElement("D", null, "remove", XMLPrinter.CLOSING);
+
+        }
+
+        printer.writeElement("D", "propertyupdate", XMLPrinter.CLOSING);
+
+        return printer.toString();
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            int code = getStatusLine().getStatusCode();
+            if (code == WebdavStatus.SC_CONFLICT     ||
+                code == WebdavStatus.SC_MULTI_STATUS ||
+                code == WebdavStatus.SC_FORBIDDEN ) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+
+    // --------------------------------------------------- Property Inner Class
+
+
+    private class Property {
+
+        public String name = "";
+        public String namespace;
+        public String namespaceInfo;
+        public String value;
+
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropertyBodyHelper.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropertyBodyHelper.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/PropertyBodyHelper.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,115 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/PropertyBodyHelper.java,v 1.4 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+/**
+ * This class manages an array of PropertyNames.
+ * It is used to generate a <prop> tag section
+ * in the body of a WebDAV method.
+ *
+ */
+public class PropertyBodyHelper {
+
+    protected PropertyName[] propertyNames;
+
+    /**
+     * Property names setter.
+     * The enumeration may contain strings with or without a namespace prefix
+     * but the preferred way is to provide PropertyName objects.
+     *
+     * @param propertyNames List of the property names
+     */
+    protected void setPropertyNames(Collection propertyNames) {
+        Vector list = new Vector();
+        Iterator propertyIterator = propertyNames.iterator();
+        while (propertyIterator.hasNext()) {
+            Object item = propertyIterator.next();
+
+            if (item instanceof PropertyName) {
+                list.add(item);
+
+            } else if (item instanceof String) {
+                String propertyName = (String) item;
+                int length = propertyName.length();
+                boolean found = false;
+                int i = 1;
+                while (!found && (i <= length)) {
+                    char chr = propertyName.charAt(length - i);
+                    if (!Character.isUnicodeIdentifierPart(chr)
+                        && chr != '-'
+                        && chr != '_'
+                        && chr != '.') {
+                        found = true;
+                    } else {
+                        i++;
+                    }
+                }
+                if ((i == 1) || (i >= length)) {
+                    list.add(new PropertyName("DAV:", propertyName));
+                } else {
+                    String namespace = propertyName.substring(0, length + 1 - i);
+                    String localName = propertyName.substring(length + 1 - i);
+                    list.add(new PropertyName(namespace, localName));
+                }
+            } else {
+                // unknown type
+                // ignore
+            }
+        }
+        this.propertyNames =
+            (PropertyName[]) list.toArray(new PropertyName[list.size()]);
+    }
+
+    /**
+     * Writes the <D:prop> element to a XMLPrinter.
+     * The element contains all properties from the
+     * propertyNames array. Result is:
+     * <D:prop>
+     *   <D:displayname/>
+     *   <D:creationdate/>
+     *   ...
+     * </D:prop>
+     */
+    protected void wirtePropElement(XMLPrinter printer) {
+        if (propertyNames != null) {
+            printer.writeElement("D", "prop", XMLPrinter.OPENING);
+            for (int i = 0; i < propertyNames.length; i++) {
+                String namespace = propertyNames[i].getNamespaceURI();
+                String localname = propertyNames[i].getLocalName();
+                if ("DAV:".equals(namespace)) {
+                    printer.writeElement("D", localname, XMLPrinter.NO_CONTENT);
+                } else {
+                    printer.writeElement("ZZ", namespace, localname, XMLPrinter.NO_CONTENT);
+                }
+            }
+            printer.writeElement("D", "prop", XMLPrinter.CLOSING);
+        }
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/RebindMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/RebindMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/RebindMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,191 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/RebindMethod.java,v 1.5 2004/08/02 15:45:47 unico Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/08/02 15:45:47 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+/**
+ * The REBIND method removes a binding to a resource from one collection,
+ * and adds a binding to that resource into another collection. It is
+ * effectively an atomic form of a MOVE request.
+ *
+ * REBIND Method Example:
+ * >> Request:
+ *  REBIND /CollX HTTP/1.1
+ *  Host: www.example.com
+ *  Content-Type: text/xml; charset="utf-8"
+ *  Content-Length: xxx
+ *  <?xml version="1.0" encoding="utf-8" ?>
+ *  <D:rebind xmlns:D="DAV:">
+ *      <D:segment>foo.html</D:segment>
+ *      <D:href>http://www.example.com/CollY/bar.html</D:href>
+ *  </D:rebind>
+ *
+ * >> Response:
+ *  HTTP/1.1 200 OK
+ * The server added a new binding to the collection,
+ * "http://www.example.com/CollX", associating "foo.html" with the resource
+ * identified by the URI "http://www.example.com/CollY/bar.html",
+ * and removes the binding named "bar.html" from the collection identified
+ * by the URI "http://www.example.com/CollY".
+ * Clients can now use the URI "http://www.example.com/CollX/foo.html" to
+ * submit requests to that resource, and requests on the URI
+ * "http://www.example.com/CollY/bar.html" will fail with a 404 (Not Found)
+ * response.
+ *
+ */
+public class RebindMethod
+    extends XMLResponseMethodBase {
+
+
+    public static final String NAME = "REBIND";
+
+    private boolean overwrite = true;
+    private String segment = null;
+    private String href = null;
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public RebindMethod() {
+    }
+
+    public RebindMethod(String existingBinding, String newBinding) {
+        super(newBinding.substring(0, newBinding.lastIndexOf('/')));
+        this.href = existingBinding;
+        this.segment = newBinding.substring(newBinding.lastIndexOf('/') + 1);
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    /**
+     * By default, if there already is a binding for the specified segment
+     * in the collection, the new binding replaces the existing binding.
+     * This default binding replacement behavior can be overridden using
+     * the Overwrite header.
+     *
+     * @return the current value of the overwrite flag
+     */
+    public boolean isOverwrite() {
+        return overwrite;
+    }
+
+
+    /**
+     * By default, if there already is a binding for the specified segment
+     * in the collection, the new binding replaces the existing binding.
+     * This default binding replacement behavior can be overridden using
+     * the Overwrite header.
+     *
+     * @param overwrite New overwrite value
+     */
+    public void setOverwrite(boolean overwrite) {
+        checkNotUsed();
+        this.overwrite = overwrite;
+    }
+
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state HttpState token
+     * @param conn The connection being used for the request.
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+
+        super.addRequestHeaders(state, conn);
+
+        if (!isOverwrite())
+            super.setRequestHeader("Overwrite", "F");
+
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        if (segment == null || href == null)
+            throw new IllegalStateException
+                ("Segment and Href must be set before " +
+                 "calling this function.");
+
+        XMLPrinter printer = new XMLPrinter();
+
+        printer.writeXMLHeader();
+        printer.writeElement("D", "DAV:", "rebind", XMLPrinter.OPENING);
+        printer.writeElement("D", "segment", XMLPrinter.OPENING);
+        printer.writeText(segment);
+        printer.writeElement("D", "segment", XMLPrinter.CLOSING);
+        printer.writeElement("D", "href", XMLPrinter.OPENING);
+        printer.writeText(href);
+        printer.writeElement("D", "href", XMLPrinter.CLOSING);
+        printer.writeElement("D", "rebind", XMLPrinter.CLOSING);
+
+        return printer.toString();
+    }
+
+    /**
+     * @return path of the resource to be rebound
+     */
+    public String getHref() {
+        return href;
+    }
+
+    /**
+     * @return new resource name
+     */
+    public String getSegment() {
+        return segment;
+    }
+
+    /**
+     * @param href path of the resource to be rebound
+     */
+    public void setHref(String href) {
+        this.href = href;
+    }
+
+    /**
+     * @param segment new resource name
+     */
+    public void setSegment(String segment) {
+        this.segment = segment;
+    }
+
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/ReportMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/ReportMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/ReportMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,442 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/ReportMethod.java,v 1.6 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.6 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+/**
+ * This class implements the WebDAV REPORT Method.
+ *
+ * <P>     The REPORT method retrieves properties defined on the resource
+ * identified by the Request-URI, if the resource does not have any internal
+ * members, or on the resource identified by the Request-URI and potentially
+ * its member resources, if the resource is a collection that has internal
+ * member URIs.
+ *
+ * <P>     A typical request looks like this:
+ *
+ */
+public class ReportMethod extends XMLResponseMethodBase
+    implements DepthSupport {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * Request specified properties.
+     */
+    public static final int SUB_SET = 0;
+
+
+    /**
+     * Request of all properties name and value.
+     */
+    public static final int ALL = 1;
+
+    public static final int LOCATE_HISTORY = 2;
+
+    public String sVersionHistory ="";
+
+    private String preloadedQuery = null;
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public ReportMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public ReportMethod(String path) {
+        super(path);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public ReportMethod(String path, int depth) {
+        this(path);
+        setDepth(depth);
+    }
+
+    /**
+     * Method constructor.
+     */
+    public ReportMethod(String path, Enumeration propertyNames) {
+        this(path);
+        setDepth(1);
+        setPropertyNames(propertyNames);
+        setType(SUB_SET);
+    }
+
+/**
+     * Method constructor.
+     */
+    public ReportMethod(String path, int depth, Enumeration propertyNames, Enumeration histUrl) {
+        this(path);
+        setDepth(depth);
+        setPropertyNames(propertyNames);
+        setHistoryURLs(histUrl);
+        setType(LOCATE_HISTORY);
+    }
+
+    /**
+     * Method constructor.
+     */
+    public ReportMethod(String path, int depth, Enumeration propertyNames) {
+        this(path);
+        setDepth(depth);
+        setPropertyNames(propertyNames);
+        setType(SUB_SET);
+    }
+
+
+
+    public ReportMethod(String path, int depth, String sBody) {
+        this(path);
+        setDepth(depth);
+        setType(SUB_SET);
+        preloadedQuery = sBody;
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * Type of the Propfind.
+     */
+    protected int type = ALL;
+
+
+    /**
+     * Property name list.
+     */
+    protected PropertyName[] propertyNames;
+
+    /**
+     * Depth.
+     */
+    protected int depth = DEPTH_INFINITY;
+
+
+    /**
+     * The namespace abbreviation that prefixes DAV tags
+     */
+    protected String prefix = null;
+
+
+    // ------------------------------------------------------------- Properties
+
+
+
+
+    /**
+     * Set a header value, redirecting attempts to set the "Depth" header to
+     * a {@link #setDepth} call.
+     *
+     * @param headerName Header name
+     * @param headerValue Header value
+     */
+    public void setRequestHeader(String headerName, String headerValue) {
+        if (headerName.equalsIgnoreCase("Depth")){
+            int depth = -1;
+            if (headerValue.equals("0")){
+                depth = DEPTH_0;
+            }
+            if (headerValue.equals("1")){
+                depth = DEPTH_1;
+            }
+            else if (headerValue.equalsIgnoreCase("infinity")){
+                depth = DEPTH_INFINITY;
+            }
+            setDepth(depth);
+        }
+        else{
+            super.setRequestHeader(headerName, headerValue);
+        }
+    }
+
+
+    /**
+     * Type setter.
+     *
+     * @param type New type value
+     */
+    public void setType(int type) {
+        checkNotUsed();
+        this.type = type;
+    }
+
+
+    /**
+     * Type getter.
+     *
+     * @return int type value
+     */
+    public int getType() {
+        return type;
+    }
+
+
+    /**
+     * Depth setter.
+     *
+     * @param depth New depth value
+     */
+    public void setDepth(int depth) {
+        checkNotUsed();
+        this.depth = depth;
+    }
+
+
+    /**
+     * Depth getter.
+     *
+     * @return int depth value
+     */
+    public int getDepth() {
+        return depth;
+    }
+
+
+    /**
+     * Property names setter.
+     * The enumeration may contain strings with or without a namespace prefix
+     * but the preferred way is to provide PropertyName objects.
+     *
+     * @param propertyNames List of the property names
+     */
+    public void setPropertyNames(Enumeration propertyNames) {
+        checkNotUsed();
+
+        Vector list = new Vector();
+        while (propertyNames.hasMoreElements()) {
+
+            Object item = propertyNames.nextElement();
+
+            if (item instanceof PropertyName)
+            {
+                list.add(item);
+            }
+            else if (item instanceof String)
+            {
+                String propertyName = (String) item;
+
+                int length = propertyName.length();
+                boolean found = false;
+                int i = 1;
+                while (!found && (i <= length)) {
+                    char chr = propertyName.charAt(length - i);
+                    if (!Character.isUnicodeIdentifierPart(chr)
+                        && chr!='-' && chr!='_' && chr!='.') {
+                        found = true;
+                    } else {
+                        i++;
+                    }
+                }
+                if ((i == 1) || (i >= length)) {
+                    list.add(new PropertyName("DAV:",propertyName));
+                } else {
+                    String namespace = propertyName.substring(0, length + 1 - i);
+                    String localName = propertyName.substring(length + 1 - i);
+                    list.add(new PropertyName(namespace,localName));
+                }
+            }
+            else
+            {
+                // unknown type
+                // ignore
+            }
+        }
+
+        this.propertyNames = (PropertyName[])list.toArray(new PropertyName[list.size()]);
+    }
+
+    /**
+     * sets History URL for locate by history Report
+     */
+    public void setHistoryURLs(Enumeration historyURLs) {
+
+        sVersionHistory = "<D:version-history-set>";
+
+        while (historyURLs.hasMoreElements())
+        {
+            sVersionHistory += "<D:href>"+ historyURLs.nextElement().toString() + "</D:href>";
+        }
+
+        sVersionHistory += "</D:version-history-set>";
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+    public String getName() {
+        return "REPORT";
+    }
+
+    public void recycle() {
+        super.recycle();
+        prefix = null;
+    }
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state State token
+     * @param conn The connection being used to make the request.
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        // set the default utf-8 encoding, if not already present
+        if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+        super.addRequestHeaders(state, conn);
+
+        switch (depth) {
+        case DEPTH_0:
+            super.setRequestHeader("Depth", "0");
+            break;
+        case DEPTH_1:
+            super.setRequestHeader("Depth", "1");
+            break;
+        case DEPTH_INFINITY:
+            super.setRequestHeader("Depth", "infinity");
+            break;
+        }
+
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        if (preloadedQuery != null)
+            return preloadedQuery;
+
+        XMLPrinter printer = new XMLPrinter();
+
+
+        printer.writeXMLHeader();
+        if (type!= LOCATE_HISTORY)
+            printer.writeElement("D", "DAV:", "version-tree",
+                             XMLPrinter.OPENING);
+
+        switch (type) {
+        case ALL:
+            printer.writeElement("D", "allprop", XMLPrinter.NO_CONTENT);
+            printer.writeElement("D", "version-tree", XMLPrinter.CLOSING);
+            break;
+
+        case SUB_SET:
+            printer.writeElement("D", "prop", XMLPrinter.OPENING);
+            for (int i=0 ; i<propertyNames.length ; i++)
+            {
+                String namespace = propertyNames[i].getNamespaceURI();
+                String localname = propertyNames[i].getLocalName();
+                if ("DAV:".equals(namespace)) {
+                    printer.writeElement("D", localname, XMLPrinter.NO_CONTENT);
+                } else {
+                    printer.writeElement("ZZ", namespace,localname , XMLPrinter.NO_CONTENT);
+                }
+            }
+            printer.writeElement("D", "prop", XMLPrinter.CLOSING);
+            printer.writeElement("D", "version-tree", XMLPrinter.CLOSING);
+            break;
+
+        case LOCATE_HISTORY:
+            printer.writeElement("D", "DAV:", "locate-by-history", XMLPrinter.OPENING);
+
+            printer.writeText(sVersionHistory);
+
+            printer.writeElement("D", "prop", XMLPrinter.OPENING);
+            for (int i=0 ; i<propertyNames.length ; i++)
+            {
+                String namespace = propertyNames[i].getNamespaceURI();
+                String localname = propertyNames[i].getLocalName();
+                if ("DAV:".equals(namespace)) {
+                    printer.writeElement("D", localname, XMLPrinter.NO_CONTENT);
+                } else {
+                    printer.writeElement("ZZ", namespace,localname , XMLPrinter.NO_CONTENT);
+                }
+            }
+            printer.writeElement("D", "prop", XMLPrinter.CLOSING);
+            printer.writeElement("D", "locate-by-history", XMLPrinter.CLOSING);
+            break;
+
+        }
+
+        //System.out.println(query);
+        return printer.toString();
+
+    }
+
+    /**
+     * This method returns an enumeration of URL paths.  If the ReportMethod
+     * was sent to the URL of a collection, then there will be multiple URLs.
+     * The URLs are picked out of the <code>&lt;D:href&gt;</code> elements
+     * of the response.
+     *
+     * @return an enumeration of URL paths as Strings
+     */
+    public Enumeration getAllResponseURLs() {
+        checkUsed();
+        return getResponseURLs().elements();
+    }
+
+
+    /**
+     * Returns an enumeration of <code>Property</code> objects.
+     */
+            public Enumeration getResponseProperties(String urlPath) {
+        checkUsed();
+
+        Response response = (Response) getResponseHashtable().get(urlPath);
+        if (response != null) {
+            return response.getProperties();
+        } else {
+            return (new Vector()).elements();
+        }
+
+         }
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/SearchMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/SearchMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/SearchMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,251 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/SearchMethod.java,v 1.5 2004/08/02 15:45:47 unico Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/08/02 15:45:47 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+/**
+ * This class implements the WebDAV SEARCH Method.
+ *
+ * <P>     The SEARCH method initiates a server-side search. The body of the
+ * request defines the query. The server responds with a text/xml entity
+ * matching the WebDAV PROPFIND response.
+ *
+ * <P>     According to
+ * <ahref="http://www.webdav.org/dasl/protocol/draft-dasl-protocol-00.html">
+ * the DASL draft</a> a typical request looks like this:
+ *
+ * <PRE>
+ * SEARCH /folder/ HTTP/1.1
+ * Host: www.foo.bar
+ * Content-type: text/xml; charset="utf-8"
+ * Content-Length: xxxx
+ *
+ * &lt;?xml version="1.0"?>
+ * &lt;D:searchrequest xmlns:D = "DAV:" >
+ * &lt;D:basicsearch>
+ *   &lt;D:select>
+ *     &lt;D:prop>&lt;D:getcontentlength/>&lt;/D:prop>
+ *   &lt;/D:select>
+ *   &lt;D:from>
+ *     &lt;D:scope>
+ *       &lt;D:href>/folder/&lt;/D:href>
+ *       &lt;D:depth>infinity&lt;/D:depth>
+ *     &lt;/D:scope>
+ *   &lt;/D:from>
+ * &lt;/D:basicsearch>
+ * &lt;/D:searchrequest>
+ * </PRE>
+ *
+ * <P>     However, other query grammars may be used. A typical request using
+ * the
+ * <ahref="http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/exchsv2k/_exch2k_sql_web_storage_system_sql.htm">
+ * SQL-based grammar</a> implemented in Microsoft's Web Storage System
+ * (currently shipping with Exchange 2000 and SharePoint Portal Server)
+ * looks like this:
+ *
+ * <PRE>
+ * SEARCH /folder/ HTTP/1.1
+ * Host: www.foo.bar
+ * Content-type: text/xml; charset="utf-8"
+ * Content-Length: xxxx
+ *
+ * &lt;?xml version="1.0"?>
+ * &lt;D:searchrequest xmlns:D = "DAV:" >
+ *   &lt;D:sql>
+ *   SELECT "DAV:contentclass", "DAV:displayname"
+ *     FROM "/folder/"
+ *    WHERE "DAV:ishidden" = false
+ *      AND "DAV:isfolder" = false
+ *   &lt;/D:sql>
+ * &lt;/D:searchrequest>
+ * </PRE>
+ *
+ */
+
+public class SearchMethod extends XMLResponseMethodBase {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public SearchMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public SearchMethod(String path) {
+        super(path);
+    }
+
+
+    /**
+     * Construct a SearchMethod using the given XML request body.
+     *
+     * @param path  Relative path to the WebDAV resource
+     * (presumably a collection).
+     * @param query Complete request body in XML including a search query in
+     * your favorite grammar.
+     */
+    public SearchMethod(String path, String query) {
+        this(path);
+        preloadedQuery = query;
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    /**
+     * The namespace abbreviation that prefixes DAV tags
+     */
+    protected String prefix = null;
+
+    private String preloadedQuery = null;
+
+    // ------------------------------------------------------------- Properties
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+    public String getName() {
+        return "SEARCH";
+    }
+
+    public void recycle() {
+        super.recycle();
+        prefix = null;
+    }
+
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state State token
+     * @param conn the connection
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        // set the default utf-8 encoding, if not already present
+        if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+        super.addRequestHeaders(state, conn);
+
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        if (preloadedQuery == null || preloadedQuery.trim().length() < 1) {
+            // TODO  Must support some mechanism for delegating the
+            // generation of the query to a pluggable query grammar
+            // support class or package. Right now, executing this
+            // method object without first explicitly setting the
+            // query is an error.
+            return "";
+        } else {
+            return preloadedQuery;
+        }
+
+    }
+
+    /**
+     * This method returns an enumeration of URL paths.  If the PropFindMethod
+     * was sent to the URL of a collection, then there will be multiple URLs.
+     * The URLs are picked out of the <code>&lt;D:href&gt;</code> elements
+     * of the response.
+     *
+     * @return an enumeration of URL paths as Strings
+     */
+    public Enumeration getAllResponseURLs() {
+        checkUsed();
+        return getResponseURLs().elements();
+    }
+
+
+    /**
+     * Returns an enumeration of <code>Property</code> objects.
+     */
+    public Enumeration getResponseProperties(String urlPath) {
+        checkUsed();
+
+        Response response = (Response) getResponseHashtable().get(urlPath);
+        if (response != null) {
+            return response.getProperties();
+        } else {
+            return (new Vector()).elements();
+        }
+
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            int code = getStatusLine().getStatusCode();
+            if (code == WebdavStatus.SC_BAD_REQUEST ||
+                code == WebdavStatus.SC_MULTI_STATUS ||
+                code == WebdavStatus.SC_FORBIDDEN ||
+                code == WebdavStatus.SC_CONFLICT ) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+
+
+}
+
+
+
+
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/SubscribeMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/SubscribeMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/SubscribeMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,283 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/SubscribeMethod.java,v 1.3 2004/07/28 09:30:37 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:30:37 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+
+/**
+ * Implements the SUBSCRIBE method.
+ * 
+ * @see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_webdav_subscribe.asp">Reference</a>
+ */
+public class SubscribeMethod extends XMLResponseMethodBase 
+   implements DepthSupport
+{
+
+   private static final String HEADER_SUBSCRIPTION_ID = "Subscription-Id";
+   private static final String HEADER_SUBSCRIPTION_LIFETIME = "Subscription-Lifetime";
+   private static final String HEADER_NOTIFICATION_TYPE = "Notification-Type";
+   private static final String HEADER_NOTIFICATION_DELAY = "Notification-Delay";
+   private static final String HEADER_DEPTH = "Depth";
+   private static final String HEADER_CALL_BACK = "Call-Back";
+   private static final String HEADER_CONTENT_LOCATION = "Content-Location";
+   
+   public static final String TYPE_UPDATE = "update";
+   public static final String TYPE_UPDATE_NEW_MEMBER = "update/newmember";
+   public static final String TYPE_DELETE = "delete";
+   public static final String TYPE_MOVE = "move";
+   
+   private String callback = null;
+   private String notificationType = null;
+   private int depth = -1;
+   private long subsciptionLifetime = -1;
+   private int subscriptionId = -1;
+   private long notificationDelay = -1;
+   
+   private long responsedSubscriptionLifetime = -1;
+   private int responsedSubscriptionId = -1;
+   private String responsedContentLocation = null;
+   
+   public SubscribeMethod() {
+      
+   }
+   
+   public SubscribeMethod(String path) {
+      super(path);
+   }
+
+   public String getCallback()
+   {
+      return callback;
+   }
+   /**
+    * Sets the URI that's to be notified if the subscribed event does occur.  
+    */
+   public void setCallback(String callback)
+   {
+      if (callback != null && callback.length() > 0) {
+         this.callback = callback;
+      }
+   }
+   public String getNotificationType()
+   {
+      return notificationType;
+   }
+   /**
+    * Sets the notification type, i.e. determines the events that are 
+    * subscribed.
+    * @see #TYPE_DELETE 
+    * @see #TYPE_MOVE
+    * @see #TYPE_UPDATE
+    * @see #TYPE_UPDATE_NEW_MEMBER
+    */
+   public void setNotificationType(String notificationType)
+   {
+      this.notificationType = notificationType;
+   }
+   public long getSubsciptionLifetime()
+   {
+      return subsciptionLifetime;
+   }
+   /**
+    * Sets the duration of the subscription in seconds.
+    */
+   public void setSubsciptionLifetime(long subsciptionLifetime)
+   {
+      this.subsciptionLifetime = subsciptionLifetime;
+   }
+   public long getSubscriptionId()
+   {
+      return subscriptionId;
+   }
+   /**
+    * Sets the ID of a subscription to be refreshed.
+    * @param subscriptionId
+    */
+   public void setSubscriptionId(int subscriptionId)
+   {
+      this.subscriptionId = subscriptionId;
+   }
+   /**
+    * Sets the notification delay in seconds.
+    */
+   public void setNotificationDelay(long delay) {
+      this.notificationDelay = delay;
+   }
+   public long getNotificationDelay() {
+      return this.notificationDelay;
+   }
+   public int getDepth()
+   {
+      return this.depth;
+   }
+   /**
+    * Sets the depth.
+    */
+   public void setDepth(int depth)
+   {
+      switch(depth) {
+         case DEPTH_0:
+         case DEPTH_1:
+         case DEPTH_INFINITY:
+            this.depth = depth;
+            break;
+         default:
+            throw new IllegalArgumentException(
+                  "Depth must be 0, 1 or "+DEPTH_INFINITY+".");
+      }
+   }
+   
+   /**
+    * Returns the subscription ID responsed from the server.
+    * @return -1 if no subscription id was in the response 
+    */
+   public int getResponsedSubscriptionId() {
+      checkUsed();
+      return this.responsedSubscriptionId;
+   }
+   /**
+    * Returns the subscription lifetime responsed from the server.
+    * @return -1 if no subscription lifetime was given in the response
+    */
+   public long getResponsedSubscriptionLifetime() {
+      checkUsed();
+      return this.responsedSubscriptionLifetime;
+   }
+   /**
+    * Returns the value of the content-location header of the response. 
+    * This shall be used to the request uri for a POLL method querying this
+    * subscription.
+    */
+   public String getResponsedContentLocation() {
+      checkUsed();
+      return this.responsedContentLocation;
+   }
+   // --------------------------------------------------- WebdavMethod Methods
+
+   public String getName()
+   {
+      return "SUBSCRIBE";
+   }
+   
+   public void recycle()
+   {
+      super.recycle();
+      this.callback = null;
+      this.depth = -1;
+      this.notificationDelay = -1;
+      this.notificationType = null;
+      this.responsedSubscriptionId = -1;
+      this.responsedSubscriptionLifetime = -1;
+      this.subsciptionLifetime = -1;
+      this.subscriptionId = -1;
+   }
+   protected void addRequestHeaders(HttpState state, HttpConnection conn)
+         throws IOException, HttpException
+   {
+      super.addRequestHeaders(state, conn);
+      
+      if (this.callback != null) {
+         super.setRequestHeader(HEADER_CALL_BACK, this.callback);
+      }
+      if (this.depth > -1) {
+         super.setRequestHeader(HEADER_DEPTH, 
+               this.depth == DEPTH_INFINITY ? "infinity" 
+                     : String.valueOf(this.depth));
+      }
+      if (this.notificationType != null) {
+         super.setRequestHeader(HEADER_NOTIFICATION_TYPE, this.notificationType);
+      }
+      if (this.subsciptionLifetime > 0) {
+         super.setRequestHeader(HEADER_SUBSCRIPTION_LIFETIME, 
+               Long.toString(this.subsciptionLifetime));
+      }
+      if (this.subscriptionId > 0) {
+         super.setRequestHeader(HEADER_SUBSCRIPTION_ID, Long.toString(
+               this.subscriptionId));
+      }
+      if (this.notificationDelay > 0) {
+         super.setRequestHeader(HEADER_NOTIFICATION_DELAY, Long.toString(
+               this.notificationDelay));
+      }
+   }
+   
+   /**
+    * Adds special checking of header values of the SUBSCRIBE method to
+    * the super class implementation.
+    */
+   public void setRequestHeader(String headerName, String headerValue) 
+   {
+       try {
+         if (headerName.equalsIgnoreCase(HEADER_DEPTH)){
+            if ("infinity".equalsIgnoreCase(headerValue)) {
+               setDepth(DEPTH_INFINITY);
+            } else {
+               setDepth(Integer.parseInt(headerValue));
+            }
+          } 
+          else if(headerName.equals(HEADER_SUBSCRIPTION_ID)) {
+             setSubscriptionId(Integer.parseInt(headerValue));
+          }
+          else if(headerName.equals(HEADER_SUBSCRIPTION_LIFETIME)) {
+             setSubscriptionId(Integer.parseInt(headerValue));
+          }
+          else if(headerName.equals(HEADER_NOTIFICATION_DELAY)) {
+             setNotificationDelay(Long.parseLong(headerValue));
+          }
+          else {
+             super.setRequestHeader(headerName, headerValue);
+          }
+      } catch (NumberFormatException e) {
+         throw new IllegalArgumentException("Invalid header value '" +
+               headerValue + "' for header " + headerName + "!");
+      }
+   }
+   
+   protected void processResponseHeaders(HttpState state, HttpConnection conn)
+   {
+      super.processResponseHeaders(state, conn);
+      
+      Header header; 
+      
+      header = getResponseHeader(HEADER_SUBSCRIPTION_ID);
+      if (header != null) {
+         this.responsedSubscriptionId = Integer.parseInt(header.getValue());
+      }
+      
+      header = getResponseHeader(HEADER_SUBSCRIPTION_LIFETIME);
+      if (header != null) {
+         this.responsedSubscriptionLifetime = Long.parseLong(header.getValue());
+      }
+      
+      header = getResponseHeader(HEADER_CONTENT_LOCATION);
+      if (header != null) {
+         this.responsedContentLocation = header.getValue();
+      }
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnbindMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnbindMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnbindMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,117 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/UnbindMethod.java,v 1.5 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import org.apache.webdav.lib.util.XMLPrinter;
+
+/**
+ * The UNBIND method modifies the collection identified by the Request-URI,
+ * by removing the binding identified by the segment specified in the UNBIND
+ * body.
+ *
+ * UNBIND Method Example:
+ * >> Request:
+ *  UNBIND /CollX HTTP/1.1
+ *  Host: www.example.com
+ *  Content-Type: text/xml; charset="utf-8"
+ *  Content-Length: xxx
+ *  <?xml version="1.0" encoding="utf-8" ?>
+ *  <D:unbind xmlns:D="DAV:">
+ *      <D:segment>foo.html</D:segment>
+ *  </D:unbind>
+ *
+ * >> Response:
+ *  HTTP/1.1 200 OK
+ * The server removed the binding named "foo.html" from the collection,
+ * "http://www.example.com/CollX". A request to the resource named
+ * "http://www.example.com/CollX/foo.html" will return a 404 (Not Found)
+ * response.
+ *
+ */
+public class UnbindMethod
+    extends XMLResponseMethodBase {
+
+
+    public static final String NAME = "UNBIND";
+
+    private String segment = null;
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public UnbindMethod() {
+    }
+
+    public UnbindMethod(String binding) {
+        super(binding.substring(0, binding.lastIndexOf('/')));
+        this.segment = binding.substring(binding.lastIndexOf('/') + 1);
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        if (segment == null)
+            throw new IllegalStateException
+                ("Segment must be set before calling this function.");
+
+        XMLPrinter printer = new XMLPrinter();
+
+        printer.writeXMLHeader();
+        printer.writeElement("D", "DAV:", "unbind", XMLPrinter.OPENING);
+        printer.writeElement("D", "segment", XMLPrinter.OPENING);
+        printer.writeText(segment);
+        printer.writeElement("D", "segment", XMLPrinter.CLOSING);
+        printer.writeElement("D", "unbind", XMLPrinter.CLOSING);
+
+        return printer.toString();
+    }
+
+    /**
+     * @return resource name to be unbound
+     */
+    public String getSegment() {
+        return segment;
+    }
+
+    /**
+     * @param segment resource name to be unbound
+     */
+    public void setSegment(String segment) {
+        this.segment = segment;
+    }
+
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UncheckoutMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UncheckoutMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UncheckoutMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,112 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/UncheckoutMethod.java,v 1.4 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+
+
+/**
+ * The Checkout method can be applied to a checked-in version-controlled
+ * resource.
+ *
+ *
+ *
+ * <h3>Example Request</h3>
+ * <pre>
+ * Uncheckout /foo.html HTTP/1.1
+ * Host: www.server.org
+ * Content-Length: xx
+ * </pre>
+ *
+ * <h3>Example Response</h3>
+ * <pre>
+ * HTTP/1.1 200 OK
+ * </pre>
+ *
+ */
+public class UncheckoutMethod
+    extends XMLResponseMethodBase {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+
+    // ----------------------------------------------------- Instance Variables
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public UncheckoutMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public UncheckoutMethod(String path) {
+        super(path);
+    }
+
+
+
+
+
+    // ------------------------------------------------------------- Properties
+
+    public String getName() {
+        return "UNCHECKOUT";
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            int code = getStatusLine().getStatusCode();
+            if (code == WebdavStatus.SC_CONFLICT     ||
+                code == WebdavStatus.SC_FORBIDDEN ) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnlockMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnlockMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnlockMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,186 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/UnlockMethod.java,v 1.6 2004/07/28 09:30:37 ib Exp $
+ * $Revision: 1.6 $
+ * $Date: 2004/07/28 09:30:37 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.webdav.lib.WebdavState;
+
+/**
+ * UNLOCK Method.
+ *
+ */
+public class UnlockMethod
+    extends XMLResponseMethodBase {
+
+    public final static int NO_TRANSACTION = -1;
+    public final static int ABORT_TRANSACTION = 0;
+    public final static int COMMIT_TRANSACTION = 1;
+    
+    // ----------------------------------------------------- Instance Variables
+
+
+    private String lockToken = null;
+
+    private int transactionStatus = NO_TRANSACTION;
+
+    // ----------------------------------------------------------- Constructors
+
+    /**
+     * Creates an unlock method that <em>ends a transaction</em> when server supports
+     * them in a 
+     * <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_webdav_lock.asp">MS like style</a>.
+     * The transacion handle of transaction is stored as the lock token.   
+     * <br><br>
+     * To start a transaction
+     * use {@link LockMethod}. 
+
+     * @param path any path inside Slide's scope
+     * @param txHandle lock token specifying transaction handle
+     * @param transactionStatus status of transaction as described in {@link #setTransactionStatus(int)}
+     * 
+     */
+    public UnlockMethod(String path, String txHandle, int transactionStatus) {
+        this(path);
+        setLockToken(txHandle);
+        setTransactionStatus(transactionStatus);
+    }
+    
+    /**
+     * Method constructor.
+     */
+    public UnlockMethod() {
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public UnlockMethod(String path) {
+        super(path);
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public UnlockMethod(String path, String lockToken) {
+        this(path);
+        setLockToken(lockToken);
+    }
+
+
+    // ------------------------------------------------------------- Properties
+
+
+    public void setLockToken(String lockToken) {
+        checkNotUsed();
+        this.lockToken = lockToken;
+    }
+
+    /**
+     * Gets the parameter described in {@link #setTransactionStatus(int)}.
+     * 
+     * @return either {@link UnlockMethod#COMMIT_TRANSACTION} or {@link UnlockMethod#ABORT_TRANSACTION} as the real
+     * transaction status or {@link UnlockMethod#NO_TRANSACTION} to indicate this method is not used for
+     * transaction control 
+     */
+    public int getTransactionStatus() {
+        return transactionStatus;
+    }
+
+    /**
+     * Sets the transaction status of this method when it is used to end a externally controlled
+     * transaction.
+     * 
+     * @param transactionStatus {@link UnlockMethod#COMMIT_TRANSACTION} to set the status to successful commit or
+     * {@link UnlockMethod#ABORT_TRANSACTION} to let the transaction abort discarding all changes associated to it. 
+     * 
+     */
+    public void setTransactionStatus(int transactionStatus) {
+        this.transactionStatus = transactionStatus;
+    }
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+    public String getName() {
+        return "UNLOCK";
+    }
+
+    public void recycle() {
+        this.transactionStatus = NO_TRANSACTION;
+    }
+
+    /**
+     * Set header, handling the special case of the lock-token header so
+     * that it calls {@link #setLockToken} instead.
+     *
+     * @param headerName Header name
+     * @param headerValue Header value
+     */
+    public void setRequestHeader(String headerName, String headerValue) {
+        if (headerName.equalsIgnoreCase("Lock-Token")){
+            setLockToken(headerValue);
+        }
+        else{
+            super.setRequestHeader(headerName, headerValue);
+        }
+    }
+
+    /**
+     * Generate additional headers needed by the request.
+     *
+     * @param state HttpState token
+     * @param conn The connection being used to send the request.
+     */
+    public void addRequestHeaders(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        super.addRequestHeaders(state, conn);
+
+        super.setRequestHeader("Lock-Token", "<" + lockToken + ">");
+
+    }
+
+    protected String generateRequestBody() {
+        if (getTransactionStatus() == NO_TRANSACTION) {
+            return "";
+        } else {
+            return "<D:transactioninfo xmlns:D='DAV:'>\n  <D:transactionstatus>"
+                    + (getTransactionStatus() == ABORT_TRANSACTION ? "<D:abort/>" : "<D:commit/>")
+                    + "</D:transactionstatus>\n</D:transactioninfo>";
+        }
+    }
+    
+    protected void processResponseBody(HttpState state, HttpConnection conn) {
+        if ((getStatusLine().getStatusCode() == HttpStatus.SC_NO_CONTENT) &&
+            (state instanceof WebdavState)) {
+            ((WebdavState) state).removeLock(getPath(), lockToken);
+        }
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnsubscribeMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnsubscribeMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UnsubscribeMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,109 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/UnsubscribeMethod.java,v 1.3 2004/07/28 09:30:37 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:30:37 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+
+
+/**
+ * Implements the UNSUBSCRIBE method.
+ * 
+ * @see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_webdav_unsubscribe.asp">Reference</a>
+ */
+public class UnsubscribeMethod  extends XMLResponseMethodBase 
+{
+   private static final String HEADER_SUBSCRIPTION_ID = "Subscription-Id";
+   
+   private List subscriptionIds = new ArrayList();
+   
+   public UnsubscribeMethod() {
+   }
+   
+   public UnsubscribeMethod(String path) {
+      super(path);
+   }
+   
+   /**
+    * Adds an ID for a subscription that is to be withdrawn.
+    */
+   public void addSubscriptionId(int id) {
+      this.subscriptionIds.add(new Integer(id));
+   }
+
+   // --------------------------------------------------- WebdavMethod Methods
+
+   public String getName()
+   {
+      return "UNSUBSCRIBE";
+   }
+   
+   public void recycle()
+   {
+      super.recycle();
+      this.subscriptionIds.clear();
+   }
+   
+   protected void addRequestHeaders(HttpState state, HttpConnection conn)
+      throws IOException, HttpException
+   {
+      super.addRequestHeaders(state, conn);
+      if (this.subscriptionIds.size() > 0) {
+         StringBuffer b = new StringBuffer();
+         boolean first = true;
+         for (Iterator i = this.subscriptionIds.iterator(); i.hasNext();) {
+            if (first) first = false; else b.append(", ");
+            b.append(i.next());
+         }
+         super.addRequestHeader(HEADER_SUBSCRIPTION_ID, b.toString());
+      }
+   }
+
+   /**
+    * Adds special checking of header values of the UNSUBSCRIBE method to
+    * the super class implementation.
+    */
+   public void setRequestHeader(String headerName, String headerValue) 
+   {
+      if (headerName.equalsIgnoreCase(HEADER_SUBSCRIPTION_ID)){
+         StringTokenizer t = new StringTokenizer(headerValue, ", ");
+         try {
+            for(;t.hasMoreTokens();) {
+               addSubscriptionId(Integer.parseInt(t.nextToken()));
+            }
+         } catch (NumberFormatException e) {
+            throw new IllegalArgumentException("Invalid header value '" +
+                  headerValue + "' for header " + headerName + "!");
+         }
+      } else {
+         super.setRequestHeader(headerName, headerValue);
+      }
+   }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UpdateMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UpdateMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/UpdateMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,136 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/UpdateMethod.java,v 1.6 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.6 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+
+/**
+ * The Update method updates a version-controlled resource to a new version.
+ * Two parameters are required, the path of the resource, and a URI identifying
+ * the version from the history to which to update.
+ *
+ */
+public class UpdateMethod extends XMLResponseMethodBase {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+
+    // ----------------------------------------------------- Instance Variables
+
+    private String target = null;
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public UpdateMethod() {
+    }
+
+
+   /**
+     * Method constructor.
+     */
+    public UpdateMethod(String path) {
+        super(path);
+    }
+
+
+
+    /**
+     * Method constructor.
+     *
+     * @param path
+     * @param target
+     */
+    public UpdateMethod(String path, String target) {
+        super(path);
+        this.target = target;
+    }
+
+
+    public String getName() {
+        return "UPDATE";
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+        if (target != null) {
+            XMLPrinter printer = new XMLPrinter();
+
+
+            printer.writeXMLHeader();
+            printer.writeElement("D", "DAV:", "update", XMLPrinter.OPENING);
+            printer.writeElement("D", "version", XMLPrinter.OPENING);
+            printer.writeElement("D", "href", XMLPrinter.OPENING);
+            printer.writeText(target);
+            printer.writeElement("D", "href", XMLPrinter.CLOSING);
+            printer.writeElement("D", "version", XMLPrinter.CLOSING);
+            printer.writeElement("D", "update", XMLPrinter.CLOSING);
+
+            return printer.toString();
+        }
+        else
+            return "";
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            int code = getStatusLine().getStatusCode();
+            if (code == WebdavStatus.SC_CONFLICT     ||
+                code == WebdavStatus.SC_MULTI_STATUS ||
+                code == WebdavStatus.SC_FORBIDDEN ) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/VersionControlMethod.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/VersionControlMethod.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/VersionControlMethod.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,161 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/VersionControlMethod.java,v 1.5 2004/08/02 15:45:48 unico Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/08/02 15:45:48 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.webdav.lib.util.WebdavStatus;
+import org.apache.webdav.lib.util.XMLPrinter;
+
+
+/**
+
+ */
+public class VersionControlMethod
+    extends XMLResponseMethodBase implements DepthSupport {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+
+    // ----------------------------------------------------- Instance Variables
+        private String sComment, sCreatorDisplayName;
+
+        private String sTarget = null;
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public VersionControlMethod() {
+        sComment ="none";
+        sCreatorDisplayName ="unknown";
+    }
+
+
+    /**
+     * Method constructor.
+     */
+    public VersionControlMethod(String path) {
+        super(path);
+    }
+
+    public VersionControlMethod(String path, String sTarget) {
+        super(path);
+        this.sTarget = sTarget;
+
+    }
+
+
+
+
+
+    // ------------------------------------------------------------- Properties
+
+
+    public int getDepth(){
+        return 0;
+    }
+
+    public void setDepth(int depth){
+    /*azblm: don't know if needed and / or allowed */
+    }
+
+
+    public void setRequestHeader(String headerName, String headerValue) {
+        super.setRequestHeader(headerName, headerValue);
+        if (sTarget != null) {
+            // set the default utf-8 encoding, if not already present
+            if (getRequestHeader("Content-Type") == null ) super.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
+        }
+    }
+
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+
+    public String getName() {
+        return "VERSION-CONTROL";
+    }
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+
+        if (sTarget != null){
+            XMLPrinter printer = new XMLPrinter();
+
+
+            printer.writeXMLHeader();
+
+            printer.writeElement("D", "DAV:", "version-control", XMLPrinter.OPENING);
+            printer.writeElement("D", "version", XMLPrinter.OPENING);
+
+            printer.writeElement("D", "href", XMLPrinter.OPENING);
+            printer.writeText(sTarget);
+            printer.writeElement("D", "href", XMLPrinter.CLOSING);
+            printer.writeElement("D", "version", XMLPrinter.CLOSING);
+            printer.writeElement("D", "version-control", XMLPrinter.CLOSING);
+
+            return printer.toString();
+        }
+        else
+            return "";
+
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        try
+        {
+            int code = getStatusLine().getStatusCode();
+            if (code == WebdavStatus.SC_CONFLICT     ||
+                code == WebdavStatus.SC_FORBIDDEN ) {
+                parseXMLResponse(input);
+            }
+        }
+        catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+        }
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/XMLResponseMethodBase.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/XMLResponseMethodBase.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/methods/XMLResponseMethodBase.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,764 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/XMLResponseMethodBase.java,v 1.14.2.2 2004/11/17 14:00:44 luetzkendorf Exp $
+ * $Revision: 1.14.2.2 $
+ * $Date: 2004/11/17 14:00:44 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+package org.apache.webdav.lib.methods;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.util.URIUtil;
+
+import org.apache.webdav.lib.Property;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.properties.PropertyFactory;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.apache.webdav.lib.util.DOMWriter;
+import org.apache.webdav.lib.util.WebdavStatus;
+import org.apache.webdav.lib.util.XMLDebugOutputer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * Utility class for XML response parsing.
+ *
+ */
+public abstract class XMLResponseMethodBase
+    extends HttpRequestBodyMethodBase {
+
+    //static private final Log log = LogSource.getInstance(XMLResponseMethodBase.class.getName());
+    
+    
+    // debug level 
+    private int debug = 0;
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Method constructor.
+     */
+    public XMLResponseMethodBase() {
+        super();
+    }
+
+
+    /**
+     * Method constructor.
+     *
+     * @param uri the URI to request
+     */
+    public XMLResponseMethodBase(String uri) {
+        super(uri);
+        
+    }
+
+
+    // ----------------------------------------------------- Instance Variables
+    
+    /**
+     * XML Debug Outputer
+     */
+    private XMLDebugOutputer xo = new XMLDebugOutputer();
+
+
+    /**
+     * Response document.
+     */
+    private Document responseDocument = null;
+
+
+    /**
+     * Document builder.
+     */
+    protected DocumentBuilder builder = null;
+
+
+    /**
+     * Hashtable of response nodes
+     */
+    private Hashtable responseHashtable = null;
+
+    /**
+     * Vector of response nodes, to keep track of insertion order
+     * FIXME: the above Hashtable and this Vector should be ported
+     * to plain Collections
+     */
+    protected Vector responseURLs = null;
+
+    protected String decodeResponseHrefs = null;
+
+    // ------------------------------------------------------------- Properties
+
+
+    /**
+     * Response document getter.
+     *
+     * @return Document response document
+     */
+    public Document getResponseDocument() {
+        return this.responseDocument;
+    }
+
+
+    /**
+     * Return an enumeration containing the responses.
+     *
+     * @return An enumeration containing objects implementing the
+     * ResponseEntity interface
+     */
+    public Enumeration getResponses() {
+        return getResponseHashtable().elements();
+    }
+
+
+    // --------------------------------------------------- WebdavMethod Methods
+
+    /**
+     * Debug property setter.
+     *
+     * @param int Debug
+     */ 
+    public void setDebug(int debug) {
+        this.debug = debug;
+        
+        xo.setDebug((debug > 0));
+    }
+    
+	/**
+	 * Debug property getter.
+	 *
+	 */ 
+	public int getDebug() {
+		return this.debug;
+	}
+
+	/**
+	 * Sets whether the href in responses are decoded, as early as possible.
+	 * The <code>href</code> data in responses is often url-encoded, but not 
+	 * alwyas in a comparable way. Set this to a non-null value to decode the 
+	 * hrefs as early as possible.
+	 * @param encoding The encoding used in while decoding (UTF-8 is recommended)
+	 */
+	public void setDecodeResponseHrefs(String encoding) {
+	    this.decodeResponseHrefs = encoding;
+	}
+
+    /**
+     * Reset the State of the class to its initial state, so that it can be
+     * used again.
+     */
+    public void recycle() {
+        super.recycle();
+        responseHashtable = null;
+        responseURLs = null;
+    }
+
+    protected void readResponseBody(HttpState state, HttpConnection conn)
+    throws IOException, HttpException {
+
+        super.readResponseBody(state, conn);
+        InputStream inStream = getResponseBodyAsStream();
+        if (inStream != null) {
+            parseResponse(inStream, state, conn);
+            inStream.close();
+        }
+    }
+
+    /**
+     * Return the length (in bytes) of my request body, suitable for use in a
+     * <tt>Content-Length</tt> header.
+     *
+     * <p>
+     * Return <tt>-1</tt> when the content-length is unknown.
+     * </p>
+     *
+     * <p>
+     * This implementation returns <tt>0</tt>, indicating that the request has
+     * no body.
+     * </p>
+     *
+     * @return <tt>0</tt>, indicating that the request has no body.
+     */
+    protected int getRequestContentLength() {
+        if (!isRequestContentAlreadySet()) {
+            String contents = generateRequestBody();
+            // be nice - allow overriding functions to return null or empty
+            // strings for no content.
+            if (contents == null)
+                contents = "";
+
+            setRequestBody(contents);
+            
+
+            if (debug > 0) {
+                System.out.println("\n>>>>>>>  to  server  ---------------------------------------------------");
+				System.out.println(getName() + " " +
+				   getPath() + (getQueryString() != null ? "?" + getQueryString() : "") + " " + "HTTP/1.1");
+        
+				   Header[] headers = getRequestHeaders();
+				   for (int i = 0; i < headers.length; i++) {
+					   Header header = headers[i];
+					   System.out.print(header.toString());
+				   }
+				System.out.println("Content-Length: "+super.getRequestContentLength());
+				   
+				if (this instanceof DepthSupport) {
+					System.out.println("Depth: "+((DepthSupport)this).getDepth());
+				}
+
+                System.out.println();
+                xo.print(contents);
+                System.out.println("------------------------------------------------------------------------");
+            }
+
+        }
+
+        return super.getRequestContentLength();
+    }
+
+
+
+
+    /**
+     * DAV requests that contain a body must override this function to
+     * generate that body.
+     *
+     * <p>The default behavior simply returns an empty body.</p>
+     */
+    protected String generateRequestBody() {
+        return "";
+    }
+
+    /**
+     * Write the request body to the given {@link HttpConnection}.
+     *
+     * <p>
+     * This implementation writes any computed body and returns <tt>true</tt>.
+     * </p>
+     *
+     * @param state the client state
+     * @param conn the connection to write to
+     *
+     * @return <tt>true</tt>
+     * @throws IOException when i/o errors occur reading the response
+     * @throws HttpException when a protocol error occurs or state is invalid
+     */
+    protected boolean writeRequestBody(HttpState state, HttpConnection conn)
+            throws IOException, HttpException {
+
+        if (getRequestContentLength() > 0) {
+            return super.writeRequestBody(state, conn);
+        }
+        return true;
+    }
+
+    /**
+     * Parse response.
+     *
+     * @param input Input stream
+     */
+    public void parseResponse(InputStream input, HttpState state, HttpConnection conn)
+        throws IOException, HttpException {
+        // Also accept OK sent by buggy servers in reply to a PROPFIND or
+        // REPORT (Xythos, Catacomb, ...?).
+        if (getStatusCode() == WebdavStatus.SC_MULTI_STATUS
+            || (this instanceof PropFindMethod || this instanceof ReportMethod)
+                && getStatusCode() == HttpStatus.SC_OK) {
+            try {
+                parseXMLResponse(input);
+            } catch (IOException e) {
+                // FIX ME:  provide a way to deliver non xml data
+            }
+        }
+    }
+
+
+    protected void parseXMLResponse(InputStream input)
+        throws IOException, HttpException {
+
+        if (builder == null) {
+            try {
+                // TODO: avoid the newInstance call for each method instance for performance reasons.
+                DocumentBuilderFactory factory =
+                    DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+                builder = factory.newDocumentBuilder();
+            } catch (ParserConfigurationException e) {
+                throw new HttpException
+                    ("XML Parser Configuration error: " + e.getMessage());
+            }
+        }
+
+        try {
+
+            // avoid ugly printlns from the default error handler.
+            builder.setErrorHandler(new DummyErrorHandler());
+            responseDocument = builder.parse(new InputSource(input));
+            
+            if (debug > 0) {
+               System.out.println("\n<<<<<<< from server  ---------------------------------------------------");
+               System.out.println(getStatusLine());
+               
+               Header[] headers = getResponseHeaders();
+               for (int i = 0; i < headers.length; i++) {
+                  Header header = headers[i];
+                  System.out.print(header.toString());
+               }
+               
+               System.out.println();
+               
+               xo.print(responseDocument);
+               System.out.println("------------------------------------------------------------------------");
+            }
+
+
+        } catch (Exception e) {
+            throw new IOException
+                ("XML parsing error; response stream is not valid XML: "
+                 + e.getMessage());
+        }
+
+
+        // init the response table to display the responses during debugging
+        /*if (debug > 10) {
+            //if (log.isDebugEnabled()) {
+            initResponseHashtable();
+        }*/
+
+    }
+
+
+    protected Hashtable getResponseHashtable() {
+        checkUsed();
+        if (responseHashtable == null) {
+            initResponseHashtable();
+        }
+        return responseHashtable;
+    }
+
+    protected Vector getResponseURLs() {
+        checkUsed();
+        if (responseHashtable == null) {
+            initResponseHashtable();
+        }
+        return responseURLs;
+    }
+
+    private synchronized void initResponseHashtable() {
+        if (responseHashtable == null) {
+
+            responseHashtable = new Hashtable();
+            responseURLs = new Vector();
+            int status = getStatusLine().getStatusCode();
+           
+            // Also accept OK sent by buggy servers in reply to a PROPFIND
+            // or REPORT (Xythos, Catacomb, ...?).
+            if (status == WebdavStatus.SC_MULTI_STATUS
+                || (this instanceof PropFindMethod
+                    || this instanceof ReportMethod)
+                    && status == HttpStatus.SC_OK) {
+
+
+                Document rdoc = getResponseDocument();
+
+                NodeList list = null;
+                if (rdoc != null) {
+                    Element multistatus = getResponseDocument().getDocumentElement();
+                    list = multistatus.getChildNodes();
+                }
+
+                if (list != null) {
+                    for (int i = 0; i < list.getLength(); i++) {
+                        try {
+                            Element child = (Element) list.item(i);
+                            String name = DOMUtils.getElementLocalName(child);
+                            String namespace = DOMUtils.getElementNamespaceURI
+                                (child);
+                            if (Response.TAG_NAME.equals(name) &&
+                                "DAV:".equals(namespace)) {
+                                Response response =
+                                    new ResponseWithinMultistatus(child);
+                                String href = getHref(response);
+                                responseHashtable.put(href,response);
+                                responseURLs.add(href);
+                            }
+                        } catch (ClassCastException e) {
+                        }
+                    }
+                }
+            } else if (responseDocument != null) {
+                Response response = new SingleResponse(responseDocument,
+                    getPath(), status);
+                String href = getHref(response);
+                responseHashtable.put(href, response);
+                responseURLs.add(href);
+            }
+        }
+    }
+
+
+    private String getHref(Response response) {
+        String href = response.getHref();
+        if (this.decodeResponseHrefs != null) {
+            try {
+                href = URIUtil.decode(href, this.decodeResponseHrefs);
+            }
+            catch (URIException e1) {
+                // TODO Auto-generated catch block
+                e1.printStackTrace();
+            }
+        }
+        return href;
+    }
+
+
+    /**
+     * This method creates a property implementation from an element.
+     * It treats known properties (i.e., the DAV properties) specially.
+     * These properties are instantiated as an implementation from the
+     * <code>org.apache.webdav.lib.properties</code> package.
+     */
+    protected static Property convertElementToProperty(
+        Response response, Element element) {
+
+        return PropertyFactory.create(response, element);
+        
+    }
+
+
+    // ---------------------------------------------------------- Inner Classes
+
+
+    /**
+     * An abstract class that models a DAV:response.
+     */
+    public abstract class Response implements ResponseEntity {
+
+        protected Node node = null;
+
+        Response(Node node) {
+            this.node = node;
+        }
+
+        public static final String TAG_NAME = "response";
+        public abstract int getStatusCode();
+        public abstract String getHref();
+
+        public Enumeration getHistories(){
+            Vector result = new Vector();
+            return result.elements();
+        }
+        public Enumeration getWorkspaces(){
+            Vector result = new Vector();
+            return result.elements();
+        }
+        public Enumeration getProperties() {
+            NodeList list =
+                DOMUtils.getElementsByTagNameNS(node, "prop", "DAV:");
+            Vector vector = new Vector();
+            for (int i = 0; list != null && i < list.getLength(); i++ ) {
+                Element element = (Element) list.item(i);
+                NodeList children = element.getChildNodes();
+                for (int j = 0; children != null && j < children.getLength();
+                     j++) {
+                    try {
+                        Element child = (Element) children.item(j);
+                        vector.addElement(XMLResponseMethodBase.
+                            convertElementToProperty(this, child));
+                    } catch (ClassCastException e) {
+                    }
+                }
+            }
+            return vector.elements();
+        }
+
+        public String toString () {
+            StringWriter tmp = new StringWriter();
+            DOMWriter domWriter = new DOMWriter(tmp, true);
+            domWriter.print(node);
+            return tmp.getBuffer().toString();
+        }
+    }
+
+
+    /**
+     * A class that models the DAV:response element within a multistatus.
+     */
+    class ResponseWithinMultistatus extends Response {
+
+        public ResponseWithinMultistatus(Element element) {
+            super(element);
+        }
+
+        public int getStatusCode() {
+            // The status element for the response can be inside the propstat element
+            // or directly inside the response element.
+
+            //  <multistatus xmlns=\DAV:\>
+            //    <response>
+            //      <href>/slide/files/</href>
+            //      <propstat>
+            //        <prop><displayname>files</displayname></prop>
+            //        <status>HTTP/1.1 200 OK</status>
+            //      </propstat>
+            //    </response>
+            //  </multistatus>
+            Element propstat = getFirstElement("DAV:", "propstat");
+            if (propstat != null ) {
+                Element status = DOMUtils.getFirstElement(propstat,"DAV:", "status");
+                if (status != null) {
+                    return DOMUtils.parseStatus(DOMUtils.getTextValue(status));
+                }
+            }
+
+            //  <multistatus xmlns=\DAV:\>
+            //    <response>
+            //      <href>/slide/files/</href>
+            //      <href>/slide/files/a</href>
+            //      <status>HTTP/1.1 200 OK</status>
+            //    </response>
+            //  </multistatus>
+            Element status = getFirstElement("DAV:", "status");
+            if (status != null) {
+                return DOMUtils.parseStatus(DOMUtils.getTextValue(status));
+            }
+
+            return -1;
+        }
+
+        public String getHref() {
+            Element href = getFirstElement("DAV:", "href");
+            if (href != null) {
+                return DOMUtils.getTextValue(href);
+            } else {
+                return "";
+            }
+
+        }
+
+        protected Element getFirstElement(String namespace, String name) {
+            return DOMUtils.getFirstElement(this.node, namespace, name);
+        }
+    }
+
+    class SingleResponse extends Response {
+
+        private int statusCode = -1;
+        private String href = null;
+
+        SingleResponse(Document document, String href, int statusCode) {
+            super(document);
+            this.statusCode = statusCode;
+            this.href = href;
+        }
+
+        public int getStatusCode() {
+            return this.statusCode;
+        }
+
+        public String getHref() {
+            return this.href;
+        }
+    }
+
+        class OptionsResponse extends SingleResponse{
+
+            OptionsResponse(Document document, String href, int statusCode) {
+                super(document, href, statusCode);
+
+            }
+
+
+            public Enumeration getWorkspaces(){
+
+
+                Node root = responseDocument.cloneNode(true).getFirstChild();
+                //System.out.println("Rootnode ws: "+ root.getNodeName());
+
+                String sPrefix = root.getPrefix();
+                Vector result = new Vector();
+
+                Node child = root.getFirstChild();
+                while (child!=null && !child.getNodeName().equalsIgnoreCase(sPrefix+":workspace-collection-set")){
+                    child = child.getNextSibling();
+                }
+
+                if (child!=null && child.getNodeName().equalsIgnoreCase(sPrefix+":workspace-collection-set")){
+                    child = child.getFirstChild();
+                    while (child!=null){
+                        result.add(child.getFirstChild().getNodeValue());
+                        child = child.getNextSibling();
+                    }
+                }
+
+                return result.elements();
+            }
+
+            public Enumeration getHistories(){
+                Node root = responseDocument.cloneNode(true).getFirstChild();
+                //System.out.println("Rootnode vh : " + root.getNodeName());
+
+                String sPrefix = root.getPrefix();
+                Vector result = new Vector();
+
+                //System.out.println("Prefix : " + sPrefix);
+
+                Node child = root.getFirstChild();
+                while (child!=null && !child.getNodeName().equalsIgnoreCase(sPrefix+":version-history-collection-set")){
+                    child = child.getNextSibling();
+                }
+
+                if (child!=null && child.getNodeName().equalsIgnoreCase(sPrefix+":version-history-collection-set")){
+                    child = child.getFirstChild();
+                    while (child!=null){
+                        result.add(child.getFirstChild().getNodeValue());
+                        child = child.getNextSibling();
+                    }
+                }
+
+                return result.elements();
+            }
+
+        }
+        protected void setDocument(Document doc){
+            responseDocument = doc;
+        }
+        protected void setResponseHashtable(Hashtable h){
+            responseHashtable = h;
+        }
+
+
+
+
+private static class DummyErrorHandler implements ErrorHandler {
+
+
+    /**
+     * Receive notification of a warning.
+     *
+     * <p>SAX parsers will use this method to report conditions that
+     * are not errors or fatal errors as defined by the XML 1.0
+     * recommendation.  The default behaviour is to take no action.</p>
+     *
+     * <p>The SAX parser must continue to provide normal parsing events
+     * after invoking this method: it should still be possible for the
+     * application to process the document through to the end.</p>
+     *
+     * <p>Filters may use this method to report other, non-XML warnings
+     * as well.</p>
+     *
+     * @param exception The warning information encapsulated in a
+     *                  SAX parse exception.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     * @see org.xml.sax.SAXParseException
+     */
+    public void warning(SAXParseException exception) throws SAXException
+    {
+        // System.out.println("warning: " + exception.getMessage());
+    }
+
+    /**
+     * Receive notification of a recoverable error.
+     *
+     * <p>This corresponds to the definition of "error" in section 1.2
+     * of the W3C XML 1.0 Recommendation.  For example, a validating
+     * parser would use this callback to report the violation of a
+     * validity constraint.  The default behaviour is to take no
+     * action.</p>
+     *
+     * <p>The SAX parser must continue to provide normal parsing events
+     * after invoking this method: it should still be possible for the
+     * application to process the document through to the end.  If the
+     * application cannot do so, then the parser should report a fatal
+     * error even if the XML 1.0 recommendation does not require it to
+     * do so.</p>
+     *
+     * <p>Filters may use this method to report other, non-XML errors
+     * as well.</p>
+     *
+     * @param exception The error information encapsulated in a
+     *                  SAX parse exception.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     * @see org.xml.sax.SAXParseException
+     */
+    public void error(SAXParseException exception) throws SAXException
+    {
+        // System.out.println("error: " + exception.getMessage());
+    }
+
+    /**
+     * Receive notification of a non-recoverable error.
+     *
+     * <p>This corresponds to the definition of "fatal error" in
+     * section 1.2 of the W3C XML 1.0 Recommendation.  For example, a
+     * parser would use this callback to report the violation of a
+     * well-formedness constraint.</p>
+     *
+     * <p>The application must assume that the document is unusable
+     * after the parser has invoked this method, and should continue
+     * (if at all) only for the sake of collecting addition error
+     * messages: in fact, SAX parsers are free to stop reporting any
+     * other events once this method has been invoked.</p>
+     *
+     * @param exception The error information encapsulated in a
+     *                  SAX parse exception.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     * @see org.xml.sax.SAXParseException
+     */
+    public void fatalError(SAXParseException exception) throws SAXException
+    {
+         // System.out.println("fatal: " + exception.getMessage());
+    }
+
+}
+
+
+
+
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/AclProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/AclProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/AclProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,212 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/AclProperty.java,v 1.5 2004/08/02 15:45:50 unico Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/08/02 15:45:50 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.properties;
+
+import java.util.ArrayList;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.util.URIUtil;
+import org.apache.webdav.lib.Ace;
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.Privilege;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * This interface models the <code>&lt;D:acl&gt;</code> property, which is
+ * defined in the WebDAV Access Control Protocol specification.
+ *
+ * @version $Revision: 1.5 $
+ */
+public class AclProperty extends BaseProperty {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "acl";
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the property.
+     */
+    public AclProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Returns the Aces present in this acl property.
+     *
+     * @return Ace[] An ace array or null when there is no ace.
+     */
+    public Ace[] getAces() {
+        NodeList children = element.getChildNodes();
+        if (children == null || children.getLength() == 0)
+            return null;
+        ArrayList aces = new ArrayList();
+        for (int i = 0; i < children.getLength(); i++) {
+            try {
+                Element child = (Element) children.item(i);
+                String namespace = DOMUtils.getElementNamespaceURI(child);
+                if (namespace != null && namespace.equals("DAV:")) {
+                    String localName = DOMUtils.getElementLocalName(child);
+                    if ("ace".equals(localName)) {
+                        aces.add(parseAce(child));
+                    }
+                }
+            } catch (ClassCastException e) {
+            }
+        }
+        return (Ace[]) aces.toArray(new Ace[aces.size()]);
+    }
+
+
+    // ------------------------------------------------------ Protected Methods
+
+
+    /**
+     * Parse an ace.
+     */
+    protected Ace parseAce(Element element) {
+
+        String principal = null;
+        Element child = DOMUtils.getFirstElement(element, "DAV:", "principal");
+        if (child == null) {
+            System.err.println("Error: mandatory element <principal> is missing !");
+            System.err.println("element: " + element);
+            return null;
+        }
+
+        Element href = DOMUtils.getFirstElement(child, "DAV:", "href");
+        if (href != null) {
+            principal = DOMUtils.getTextValue(href);
+            try {
+                principal = URIUtil.decode(principal);
+            } catch (URIException e) {
+                System.err.println("Warning: decoding href element failed!");
+                System.err.println("reason: " + e.getReason());
+            }
+        }
+
+        String[] types={"all","authenticated","unauthenticated","property","self"};
+        for (int i=0 ; i<types.length && principal==null ; i++)
+        {
+            Element type = DOMUtils.getFirstElement(child, "DAV:", types[i]);
+            if (type!=null)
+            {
+                principal=types[i];
+            }
+        }
+
+        if (principal==null)
+        {
+            System.err.println("Error: unknown type of principal");
+            System.err.println("element: " + element);
+            return null;
+        }
+
+        Ace ace = new Ace(principal);
+
+        child = DOMUtils.getFirstElement(element, "DAV:", "grant");
+        if (child == null) {
+            child = DOMUtils.getFirstElement(element, "DAV:", "deny");
+            ace.setNegative(true);
+         }
+        if (child != null) {
+            NodeList privilegeElements = child.getElementsByTagNameNS("DAV:", "privilege");
+            for (int i = 0; i < privilegeElements.getLength(); i++) {
+                Element privilegeElement = (Element) privilegeElements.item(i);
+                NodeList privileges = privilegeElement.getElementsByTagName("*");
+                for (int j=0 ; j<privileges.getLength() ; j++)
+                {
+                    Element privilege = (Element) privileges.item(j);
+                    ace.addPrivilege(parsePrivilege(privilege));
+                }
+            }
+        }
+
+        child = DOMUtils.getFirstElement(element, "DAV:", "inherited");
+        if (child != null) {
+            href = DOMUtils.getFirstElement(child, "DAV:", "href");
+            String shref = null;
+            if (href != null)
+            {
+                shref = DOMUtils.getTextValue(href);
+                if (!shref.equals(response.getHref())) {
+                    ace.setInherited(true);
+                    ace.setInheritedFrom(shref);
+                }
+            }
+            else
+            {
+                System.err.println("Error: mandatory element <href> is missing !");
+                return null;
+            }
+        }
+
+        child = DOMUtils.getFirstElement(element, "DAV:", "protected");
+        if (child != null) {
+            ace.setProtected(true);
+        }
+
+        return ace;
+
+    }
+
+
+    /**
+     * Parse a privilege element.
+     */
+    protected Privilege parsePrivilege(Element privilegeElement) {
+        return new Privilege(privilegeElement.getNamespaceURI(),
+                             privilegeElement.getLocalName(), null);
+    }
+
+    public String getPropertyAsString() {
+        Ace[] aces = getAces();
+
+        if ((aces==null) || (aces.length==0))
+            return "";
+
+        StringBuffer tmp = new StringBuffer(aces[0].toString());
+        for (int i=1; i<aces.length ; i++) {
+            tmp.append(", ");
+            tmp.append(aces[i].toString());
+        }
+
+        return tmp.toString();
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CheckedinProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CheckedinProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CheckedinProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,56 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/CheckedinProperty.java,v 1.1.2.1 2004/09/26 14:19:20 luetzkendorf Exp $
+ * $Revision: 1.1.2.1 $
+ * $Date: 2004/09/26 14:19:20 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.ResponseEntity;
+import org.w3c.dom.Element;
+
+/**
+ * This interface models the <code>&lt;D:checked-in&gt;</code> property, which is
+ * defined in the WebDAV Access Control Protocol specification.
+ *
+ */
+public class CheckedinProperty extends HrefValuedProperty {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "checked-in";
+
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the property.
+     */
+    public CheckedinProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CheckedoutProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CheckedoutProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CheckedoutProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,56 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/CheckedoutProperty.java,v 1.1.2.1 2004/10/08 15:04:36 luetzkendorf Exp $
+ * $Revision: 1.1.2.1 $
+ * $Date: 2004/10/08 15:04:36 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.ResponseEntity;
+import org.w3c.dom.Element;
+
+/**
+ * This interface models the <code>&lt;D:checked-in&gt;</code> property, which is
+ * defined in the WebDAV Access Control Protocol specification.
+ *
+ */
+public class CheckedoutProperty extends HrefValuedProperty {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "checked-out";
+
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the property.
+     */
+    public CheckedoutProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CreationDateProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CreationDateProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CreationDateProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,40 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/CreationDateProperty.java,v 1.1.2.1 2004/09/26 14:19:20 luetzkendorf Exp $
+ * $Revision: 1.1.2.1 $
+ * $Date: 2004/09/26 14:19:20 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.ResponseEntity;
+import org.w3c.dom.Element;
+
+
+/**
+ * <code>DAV:creationdate</code> property
+ */
+public class CreationDateProperty extends DateProperty
+{
+    public static final String TAG_NAME = "creationdate";
+
+    public CreationDateProperty(ResponseEntity response, Element element)
+    {
+        super(response, element);
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CurrentUserPrivilegeSetProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CurrentUserPrivilegeSetProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/CurrentUserPrivilegeSetProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,92 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/CurrentUserPrivilegeSetProperty.java,v 1.4 2004/08/02 15:45:50 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:50 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * Title:        CurrentUserPrivilegeSetProperty.java
+ * Description:
+ * Company:      SpeedLegal Holdings Inc.
+ * @version 1.0
+ */
+
+
+public class CurrentUserPrivilegeSetProperty extends BaseProperty {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "current-user-privilege-set";
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the property.
+     */
+    public CurrentUserPrivilegeSetProperty
+        (ResponseEntity response, Element element) {
+        super(response, element);
+    }
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    public boolean hasReadAccess()  {
+        NodeList readPrivilege = DOMUtils.getElementsByTagNameNS(getElement(), "read", "DAV:");
+        return (readPrivilege.getLength() == 1);
+    }
+
+    public boolean hasWriteAccess()  {
+        NodeList writePrivilege = DOMUtils.getElementsByTagNameNS(getElement(), "write", "DAV:");
+
+        return (writePrivilege.getLength() == 1);
+    }
+
+    public boolean hasReadWriteAccess() {
+        return (hasReadAccess() && hasWriteAccess());
+    }
+
+
+    public String getPropertyAsString() {
+        String theResult="";
+        theResult = (hasReadAccess()) ? "Read" : theResult;
+        theResult = (hasWriteAccess()) ? theResult+" Write" : theResult;
+        return theResult.trim();
+    }
+}
+
+
+
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/DateProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/DateProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/DateProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,71 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/DateProperty.java,v 1.1.2.1 2004/09/26 14:19:20 luetzkendorf Exp $
+ * $Revision: 1.1.2.1 $
+ * $Date: 2004/09/26 14:19:20 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.properties;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Base for all properties that contain date values.
+ */
+public abstract class DateProperty extends BaseProperty
+{
+    
+    private static final SimpleDateFormat FORMATS[] = {
+        new SimpleDateFormat("EEE, d MMM yyyy kk:mm:ss z", Locale.US),
+        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
+        new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US),
+        new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
+        new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US),
+        new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US),
+        new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", Locale.US)
+    };
+
+    public DateProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+    
+    /**
+     * Returns the date value.
+     */
+    public Date getDate()
+    {
+        String dateString = DOMUtils.getTextValue(element);
+        for(int i = 0; i < FORMATS.length; i++) {
+            try {
+                return FORMATS[i].parse(dateString);
+            } catch (ParseException e) {
+                // try next
+            }
+        }
+        return null;
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/GetContentLengthProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/GetContentLengthProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/GetContentLengthProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,50 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/GetContentLengthProperty.java,v 1.3.2.1 2004/09/26 14:19:20 luetzkendorf Exp $
+ * $Revision: 1.3.2.1 $
+ * $Date: 2004/09/26 14:19:20 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * @version $Revision: 1.3.2.1 $
+ */
+public class GetContentLengthProperty extends BaseProperty {
+    
+    public static final String TAG_NAME = "getcontentlength";
+
+    public GetContentLengthProperty(ResponseEntity response, Element element)
+    {
+        super(response, element);
+    }
+    
+    /**
+     * Get the content length.
+     * 
+     * @throws NumberFormatException
+     */
+    public long getLength() {
+        return Long.parseLong(DOMUtils.getTextValue(element));
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/GetLastModifiedProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/GetLastModifiedProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/GetLastModifiedProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,66 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/GetLastModifiedProperty.java,v 1.4.2.1 2004/09/26 14:19:20 luetzkendorf Exp $
+ * $Revision: 1.4.2.1 $
+ * $Date: 2004/09/26 14:19:20 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.ResponseEntity;
+import org.w3c.dom.Element;
+
+/**
+ * This interface models the <code>&lt;D:getlastmodified&gt;</code> property,
+ * which indicates the last time the resource was modified.  It does not, as
+ * the name might misleadingly imply, have anything to do with getting the most
+ * recently modified property.
+ *
+ * @version $Revision: 1.4.2.1 $
+ */
+public class GetLastModifiedProperty extends DateProperty {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "getlastmodified";
+
+
+    /**
+     * The standard date format for the last modified date, as specified in
+     * the HTTP 1.1 specification (RFC 2068).
+     * @deprecated
+     */
+    public static final String DATE_FORMAT = "EEE, d MMM yyyy kk:mm:ss z";
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the property.
+     */
+    public GetLastModifiedProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/HrefValuedProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/HrefValuedProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/HrefValuedProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,72 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/HrefValuedProperty.java,v 1.1.2.1 2004/09/26 14:19:20 luetzkendorf Exp $
+ * $Revision: 1.1.2.1 $
+ * $Date: 2004/09/26 14:19:20 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Base classe for properties with a single <code>href</code> value.
+ */
+public class HrefValuedProperty extends BaseProperty {
+
+
+    // -------------------------------------------------------------- Constants
+
+    // ----------------------------------------------------------- Constructors
+
+    /**
+     * Default constructor for the property.
+     */
+    public HrefValuedProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+
+
+    // --------------------------------------------------------- Public Methods
+
+    /**
+     * Returns the value of the href element.
+     */
+    public String getHref() {
+        String hrefValue="";
+        Element href = DOMUtils.getFirstElement(element, "DAV:", "href");
+        if (href!=null)
+        {
+            hrefValue = DOMUtils.getTextValue(href);
+        }
+        return hrefValue;
+    }
+
+    public String getPropertyAsString() {
+        return getHref();
+    }
+
+    public String toString() {
+        return getHref();
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/LockDiscoveryProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/LockDiscoveryProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/LockDiscoveryProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,213 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/LockDiscoveryProperty.java,v 1.4.2.1 2004/10/11 08:17:20 luetzkendorf Exp $
+ * $Revision: 1.4.2.1 $
+ * $Date: 2004/10/11 08:17:20 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib.properties;
+
+import java.util.ArrayList;
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.Lock;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.methods.DepthSupport;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * This class represents a listing of who has lock, what type of lock he has,
+ * the timeout type and the time remaining on the timeout, and the associated
+ * lock token.  The server is free to withhold any or all of this information
+ * if the requesting principal does not have sufficient access rights to see
+ * the requested data.
+ *
+ * <!ELEMENT lockdiscovery (activelock)* >
+ *
+ * @version $Revision: 1.4.2.1 $
+ */
+public class LockDiscoveryProperty extends BaseProperty {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "lockdiscovery";
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the property.
+     */
+    public LockDiscoveryProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Get the activelock in this lockdiscovery property.
+     *
+     * @return Lock[] A lock array or null when there is no lock.
+     */
+    public Lock[] getActiveLocks() {
+        NodeList children = element.getChildNodes();
+        if (children == null || children.getLength() == 0)
+            return null;
+        ArrayList locks = new ArrayList();
+        for (int i = 0; i < children.getLength(); i++) {
+            try {
+                Element child = (Element) children.item(i);
+                String namespace = DOMUtils.getElementNamespaceURI(child);
+                if (namespace != null && namespace.equals("DAV:")) {
+                    String localName = DOMUtils.getElementLocalName(child);
+                    if ("activelock".equals(localName)) {
+                        locks.add(parseLock(child));
+                    }
+                }
+            } catch (ClassCastException e) {
+            }
+        }
+        return (Lock[]) locks.toArray(new Lock[locks.size()]);
+    }
+
+
+    // ------------------------------------------------------ Protected Methods
+
+
+    /**
+     * Parse a lock.
+     */
+    protected Lock parseLock(Element element) {
+
+        int ls = -1;
+        Element child = DOMUtils.getFirstElement(element, "DAV:", "lockscope");
+        if (child != null) {
+            Element lockScope =
+                DOMUtils.getFirstElement(child, "DAV:", "exclusive");
+            if (lockScope != null) {
+                ls = Lock.SCOPE_EXCLUSIVE;
+            }
+            lockScope = DOMUtils.getFirstElement(child, "DAV:", "shared");
+            if (lockScope != null) {
+                ls = Lock.SCOPE_SHARED;
+            }
+        }
+
+        int lt = -1;
+        child = DOMUtils.getFirstElement(element, "DAV:", "locktype");
+        if (child != null) {
+            Element lockType = DOMUtils.getFirstElement(child, "DAV:", "write");
+            if (lockType != null) {
+                lt = Lock.TYPE_WRITE;
+            } else {
+                lockType = DOMUtils.getFirstElement(child, "DAV:", "transaction");
+                if (lockType != null) {
+                    lt = Lock.TYPE_TRANSACTION;
+                }
+            }
+        }
+
+        int d = -1;
+        child = DOMUtils.getFirstElement(element, "DAV:", "depth");
+        if (child != null) {
+            String depth = DOMUtils.getTextValue(child);
+            if (depth != null) {
+                if ("0".equals(depth)) {
+                    d = DepthSupport.DEPTH_0;
+                } else if ("1".equals(depth)) {
+                    d = DepthSupport.DEPTH_1;
+                } else if ("infinity".equalsIgnoreCase(depth)) {
+                    d = DepthSupport.DEPTH_INFINITY;
+                } else {
+                    try {
+                        d = Integer.parseInt(depth);
+                        if (d<0) {
+                            d = -1; // unknown
+                        }
+                    } catch (NumberFormatException ex) {
+                        d = -1; // unknown
+                    }
+                }
+            }
+        }
+
+        String owner = null;
+        child = DOMUtils.getFirstElement(element, "DAV:", "owner");
+        owner = DOMUtils.getTextValue(child);
+
+        int t = -1;
+        child = DOMUtils.getFirstElement(element, "DAV:", "timeout");
+        if (child != null) {
+            String timeout = DOMUtils.getTextValue(child);
+            int at = timeout.indexOf('-');
+            if (at > 0) {
+                try {
+                    t = Integer.parseInt(timeout.substring(at + 1));
+                } catch (NumberFormatException e) {
+                }
+            }
+        }
+
+        String lockToken = null;
+        child = DOMUtils.getFirstElement(element, "DAV:", "locktoken");
+        if (child != null) {
+            Element href = DOMUtils.getFirstElement(child, "DAV:", "href");
+            if (href != null) {
+                lockToken = DOMUtils.getTextValue(href);
+            }
+        }
+        
+        String principalUrl = null;
+        child = DOMUtils.getFirstElement(element, "DAV:", "principal-URL");
+        if (child != null) {
+            Element href = DOMUtils.getFirstElement(child, "DAV:", "href");
+            if (href != null) {
+                principalUrl = DOMUtils.getTextValue(href);
+            }
+        } 
+
+        return new Lock(ls, lt, d, owner, t, lockToken, principalUrl);
+
+    }
+
+    public String getPropertyAsString() {
+        Lock[] locks = getActiveLocks();
+
+        if ((locks==null) || (locks.length==0))
+            return "";
+
+        StringBuffer tmp = new StringBuffer(locks[0].toString());
+        for (int i=1; i<locks.length ; i++) {
+            tmp.append(", ");
+            tmp.append(locks[i].toString());
+        }
+
+        return tmp.toString();
+    }
+
+}
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/LockEntryProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/LockEntryProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/LockEntryProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,39 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/LockEntryProperty.java,v 1.3 2004/07/28 09:30:35 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:30:35 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.Property;
+
+/**
+ * @version $Revision: 1.3 $
+ */
+public interface LockEntryProperty extends Property {
+
+    public static final short TYPE_WRITE = 0;
+
+    public static final short SCOPE_EXCLUSIVE = 0;
+    public static final short SCOPE_SHARED = 1;
+
+    public abstract short getScope();
+    public abstract short getType();
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/ModificationDateProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/ModificationDateProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/ModificationDateProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,21 @@
+// vi: set ts=3 sw=3:
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.ResponseEntity;
+import org.w3c.dom.Element;
+
+
+/**
+ * <code>DAV:modificationdate</code>
+ */
+public class ModificationDateProperty extends DateProperty
+{
+
+    public static final String TAG_NAME = "modificationdate";
+    
+    public ModificationDateProperty(ResponseEntity response, Element element)
+    {
+        super(response, element);
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/OwnerProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/OwnerProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/OwnerProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,50 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/OwnerProperty.java,v 1.4.2.1 2004/09/26 14:19:20 luetzkendorf Exp $
+ * $Revision: 1.4.2.1 $
+ * $Date: 2004/09/26 14:19:20 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.ResponseEntity;
+import org.w3c.dom.Element;
+
+/**
+ * This interface models the <code>&lt;D:owner&gt;</code> property, which is
+ * defined in the WebDAV Access Control Protocol specification.
+ */
+public class OwnerProperty extends HrefValuedProperty {
+
+    // -------------------------------------------------------------- Constants
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "owner";
+
+    // ----------------------------------------------------------- Constructors
+
+    /**
+     * Default constructor for the property.
+     */
+    public OwnerProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/PrincipalCollectionSetProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/PrincipalCollectionSetProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/PrincipalCollectionSetProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,109 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/PrincipalCollectionSetProperty.java,v 1.4 2004/08/02 15:45:50 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:50 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.properties;
+
+import java.util.Vector;
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * This class models the <code>&lt;D:principal-collection-set&gt;</code> property, which is
+ * defined in the WebDAV Access Control Protocol specification.
+ *
+ * @version $Revision: 1.4 $
+ */
+public class PrincipalCollectionSetProperty extends BaseProperty {
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "principal-collection-set";
+
+    // ----------------------------------------------------------- Constructors
+
+    /**
+     * Default constructor for the property.
+     */
+    public PrincipalCollectionSetProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+
+
+    // --------------------------------------------------------- Public Methods
+
+    private String[] hrefs=null;
+
+    private void init()
+    {
+        // check if already initialized
+        if (this.hrefs!=null)
+            return;
+
+        Vector hrefVector = new Vector();
+        NodeList hrefNodes = DOMUtils.getElementsByTagNameNS(element, "href", "DAV:");
+        if (hrefNodes!=null)
+        {
+            for (int i = 0; i < hrefNodes.getLength(); i++)
+            {
+                Node hrefNode = hrefNodes.item(i);
+                String href = DOMUtils.getTextValue(hrefNode);
+                if ((href!=null) && (href.length()>0))
+                    hrefVector.add(href);
+            }
+        }
+
+        this.hrefs=(String[]) hrefVector.toArray(new String[hrefVector.size()]);
+    }
+
+    /**
+     * Returns the Hrefs present in this principal-collection-set property.
+     *
+     * @return String[] A href array or null when there are no href.
+     */
+    public String[] getHrefs()
+    {
+        init();
+        return this.hrefs;
+    }
+
+    public String getPropertyAsString() {
+        String[] hrefs = getHrefs();
+
+        if ((hrefs==null) || (hrefs.length==0))
+            return "";
+
+        StringBuffer tmp = new StringBuffer(hrefs[0]);
+        for (int i=1; i<hrefs.length ; i++) {
+            tmp.append(", ");
+            tmp.append(hrefs[i]);
+        }
+
+        return tmp.toString();
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/PropertyFactory.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/PropertyFactory.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/PropertyFactory.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,120 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/PropertyFactory.java,v 1.1.2.2 2004/10/08 15:04:36 luetzkendorf Exp $
+ * $Revision: 1.1.2.2 $
+ * $Date: 2004/10/08 15:04:36 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.properties;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.Property;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.WebdavException;
+import org.w3c.dom.Element;
+
+
+/**
+ * Factory for instanciating {@link org.apache.webdav.lib.Property}s.
+ */
+public class PropertyFactory
+{
+    private static final Class[] CTOR_PARAMS = { ResponseEntity.class, Element.class };
+    
+    /**
+     * Maps namespace URIs to maps, that map names to constructors. 
+     */
+    private static Map propertyClasses = new HashMap();
+    
+    static {
+        try {
+            PropertyFactory.register("DAV:", AclProperty.TAG_NAME, AclProperty.class);
+            PropertyFactory.register("DAV:", CheckedinProperty.TAG_NAME, CheckedinProperty.class);
+            PropertyFactory.register("DAV:", CheckedoutProperty.TAG_NAME, CheckedoutProperty.class);
+            PropertyFactory.register("DAV:", CreationDateProperty.TAG_NAME, CreationDateProperty.class);
+            PropertyFactory.register("DAV:", CurrentUserPrivilegeSetProperty.TAG_NAME, CurrentUserPrivilegeSetProperty.class);
+            PropertyFactory.register("DAV:", GetContentLengthProperty.TAG_NAME, GetContentLengthProperty.class);
+            PropertyFactory.register("DAV:", GetLastModifiedProperty.TAG_NAME, GetLastModifiedProperty.class);
+            PropertyFactory.register("DAV:", LockDiscoveryProperty.TAG_NAME, LockDiscoveryProperty.class);
+            PropertyFactory.register("DAV:", ModificationDateProperty.TAG_NAME, ModificationDateProperty.class);
+            PropertyFactory.register("DAV:", OwnerProperty.TAG_NAME, OwnerProperty.class);
+            PropertyFactory.register("DAV:", PrincipalCollectionSetProperty.TAG_NAME, PrincipalCollectionSetProperty.class);
+            PropertyFactory.register("DAV:", ResourceTypeProperty.TAG_NAME, ResourceTypeProperty.class);
+            PropertyFactory.register("DAV:", SupportedLockProperty.TAG_NAME, SupportedLockProperty.class);
+        } catch (Exception e) {
+            throw new WebdavException(e);
+        }
+    }
+    
+    /**
+     * Creates a new property from an xml element provided in an WebDAV response.
+     * 
+     * <p>If no property class was registered a {@link BaseProperty} will returned.
+     * 
+     * @see Property
+     * @see BaseProperty 
+     */
+    public static Property create(ResponseEntity response, Element element) 
+    {
+        // look for the namespace
+        Map nsMap = (Map)propertyClasses.get(element.getNamespaceURI());
+        if (nsMap != null) { 
+            // look up for name
+            Constructor ctor = (Constructor)nsMap.get(element.getLocalName());
+            if (ctor != null) {
+                try {
+                    // try to create
+                    Object[] params = {response, element};
+                    return (Property)ctor.newInstance(params);
+                } catch (Exception e) {
+                    throw new WebdavException(e);
+                }
+            }
+        }
+        
+        return new BaseProperty(response, element);
+    };
+    
+    /**
+     * Registers a new property.
+     * 
+     * @param namespaceUri namespace of the property
+     * @param elmentName name of the property
+     * @param cls class that implements the property. Must have a constructor that
+     * takes two parameters of type ResponseEntity and Element.
+     * 
+     * @throws NoSuchMethodException if cls does not implement the required ctor.
+     */
+    public static void register(String namespaceUri, String elementName, Class cls) 
+        throws NoSuchMethodException, SecurityException
+    {
+        Constructor ctor = cls.getConstructor(CTOR_PARAMS);
+        
+        Map nsMap = (Map)propertyClasses.get(namespaceUri);
+        if (nsMap == null) {
+            nsMap = new HashMap();
+            propertyClasses.put(namespaceUri, nsMap);
+        }
+        nsMap.put(elementName, ctor);
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/ResourceTypeProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/ResourceTypeProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/ResourceTypeProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,129 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/ResourceTypeProperty.java,v 1.5.2.1 2004/09/26 14:19:20 luetzkendorf Exp $
+ * $Revision: 1.5.2.1 $
+ * $Date: 2004/09/26 14:19:20 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.properties;
+
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * An interface that describes a standard Resource Type property (as defined by
+ * the WebDAV specification).
+ *
+ */
+public class ResourceTypeProperty extends BaseProperty {
+
+    private boolean initialized = false;
+    private boolean isCollection = false;
+    private boolean isPrincipal = false;
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "resourcetype";
+
+    /**
+     * The property collection tag.
+     */
+    public static final String TAG_COLLECTION = "collection";
+    public static final String TAG_PRINCIPAL = "principal";
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the property.
+     */
+    public ResourceTypeProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Returns true if the resource is a collection.  A collection is indicated
+     * by a response like this:
+     *
+     * <pre>
+     * &lt;D:resourcetype&gt;&lt;D:collection/&gt;&lt;/D:resourcetype&gt;
+     * </pre>
+     */
+    public boolean isCollection() {
+        init();
+        return isCollection;
+    }
+    
+    public boolean isPrincipal() {
+        init();
+        return isPrincipal;
+    }
+
+    private void init()
+    {
+
+        if (initialized)
+            return;
+
+        initialized=true;
+
+        NodeList tmp = element.getChildNodes();
+        for (int i = 0; tmp != null && i < tmp.getLength(); i++ ) {
+            try {
+                Element child = (Element) tmp.item(i);
+                if (TAG_COLLECTION.equals(DOMUtils.getElementLocalName(child))
+                     && "DAV:".equals(DOMUtils.getElementNamespaceURI(child)))
+                {
+                    isCollection=true;
+                }
+                if (TAG_PRINCIPAL.equals(DOMUtils.getElementLocalName(child))
+                        && "DAV:".equals(DOMUtils.getElementNamespaceURI(child)))
+                {
+                    isPrincipal=true;
+                }
+            } catch (ClassCastException e) {
+            }
+        }
+    }
+
+    /**
+     * This method returns the value of the property.
+     * For this property "COLLECTION" is returned if
+     * this resource is a collection, "" otherwise.
+     *
+     * WARNING: this will change in the future
+     * use isCollection()
+     */
+    public String getPropertyAsString() {
+        init();
+        return isCollection?"COLLECTION":"";
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/SupportedLockProperty.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/SupportedLockProperty.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/properties/SupportedLockProperty.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,141 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/SupportedLockProperty.java,v 1.4 2004/08/02 15:45:50 unico Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/08/02 15:45:50 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.webdav.lib.properties;
+
+import java.util.ArrayList;
+import org.apache.webdav.lib.BaseProperty;
+import org.apache.webdav.lib.Lock;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.util.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * @version $Revision: 1.4 $
+ */
+public class SupportedLockProperty extends BaseProperty {
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    /**
+     * The property name.
+     */
+    public static final String TAG_NAME = "supportedlock";
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Default constructor for the property.
+     */
+    public SupportedLockProperty(ResponseEntity response, Element element) {
+        super(response, element);
+    }
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+
+    /**
+     * Get the lockentry in this supportedlock property.
+     *
+     * @return Lock[] A lock array or null when there is no lock.
+     */
+    public Lock[] getLockEntries() {
+        NodeList children = element.getChildNodes();
+        if (children == null || children.getLength() == 0)
+            return null;
+        ArrayList locks = new ArrayList();
+        for (int i = 0; i < children.getLength(); i++) {
+            try {
+                Element child = (Element) children.item(i);
+                String namespace = DOMUtils.getElementNamespaceURI(child);
+                if (namespace != null && namespace.equals("DAV:")) {
+                    String localName = DOMUtils.getElementLocalName(child);
+                    if ("lockentry".equals(localName)) {
+                        locks.add(parseLock(child));
+                    }
+                }
+            } catch (ClassCastException e) {
+            }
+        }
+        return (Lock[]) locks.toArray(new Lock[locks.size()]);
+    }
+
+
+    // ------------------------------------------------------ Protected Methods
+
+
+    /**
+     * Parse a lock.
+     */
+    protected Lock parseLock(Element element) {
+
+        int ls = -1;
+        Element child = DOMUtils.getFirstElement(element, "DAV:", "lockscope");
+        if (child != null) {
+            Element lockScope =
+                DOMUtils.getFirstElement(child, "DAV:", "exclusive");
+            if (lockScope != null) {
+                ls = Lock.SCOPE_EXCLUSIVE;
+            }
+            lockScope = DOMUtils.getFirstElement(child, "DAV:", "shared");
+            if (lockScope != null) {
+                ls = Lock.SCOPE_SHARED;
+            }
+        }
+
+        int lt = -1;
+        child = DOMUtils.getFirstElement(element, "DAV:", "locktype");
+        if (child != null) {
+            Element lockType =
+                DOMUtils.getFirstElement(child, "DAV:", "write");
+            if (lockType != null) {
+                lt = Lock.TYPE_WRITE;
+            }
+        }
+
+        return new Lock(ls, lt);
+    }
+
+    public String getPropertyAsString() {
+        Lock[] locks = getLockEntries();
+
+        if ((locks==null) || (locks.length==0))
+            return "";
+
+        StringBuffer tmp = new StringBuffer(locks[0].toString());
+        for (int i=1; i<locks.length ; i++) {
+            tmp.append(", ");
+            tmp.append(locks[i].toString());
+        }
+
+        return tmp.toString();
+    }
+}
+
+

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/DOMUtils.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/DOMUtils.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/DOMUtils.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,305 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/util/DOMUtils.java,v 1.2.2.1 2004/08/30 08:09:04 ib Exp $
+ * $Revision: 1.2.2.1 $
+ * $Date: 2004/08/30 08:09:04 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.util;
+
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * This class provides some basic utility methods for working with
+ * XML Document objects.  Many of these utilities provide JAXP 1.0 "brute
+ * force" implementations of functions that are available in JAXP 1.1.
+ *
+ * @version $Revision: 1.2.2.1 $
+ */
+public class DOMUtils {
+
+    protected static Class[] getElementsByNSParameterTypes =
+        { String.class, String.class };
+
+    /**
+     *  Determine the namespace prefix being used for DAV.
+     *  Generally, DAV responses say something like:
+     *
+     *  <PRE>
+     *  &lt;D:multistatus xmlns:D="DAV:"&gt;
+     *  </PRE>
+     *
+     *  <P>  In this case, the "D:" is the prefix for DAV.
+     *  @deprecated
+     */
+    public static String findDavPrefix(Document document) {
+        Element multistatus = document.getDocumentElement();
+        NamedNodeMap list = multistatus.getAttributes();
+        String prefix = "DAV:";
+        for (int i = 0; i < list.getLength(); i++) {
+            try {
+                Attr attr = (Attr) list.item(i);
+                if (attr.getName() != null &&
+                    attr.getName().startsWith("xmlns") &&
+                    attr.getValue().equals("DAV:")) {
+                    int indx = attr.getName().indexOf(":");
+                    if ((indx >= 0) && (indx < attr.getName().length()-1)) {
+                        prefix = attr.getName().substring(indx + 1) + ":";
+                    } else {
+                        prefix = "";
+                    }
+                }
+            } catch (ClassCastException e) {
+            }
+        }
+        return prefix;
+    }
+
+
+    /**
+     *  Recursively scans all child elements, appending any text nodes.
+     *
+     *  <PRE>
+     *  &lt;customer&gt;Joe Schmoe&lt;/customer&gt;
+     *  </PRE>
+     *
+     *  <P>  In this case, calling this method on the
+     *  <CODE>customer</CODE> element returns "Joe Schmoe".
+     */
+    public static String getTextValue(Node node) {
+
+        // I *thought* that I should be able to use element.getNodeValue()...
+
+        StringBuffer text = new StringBuffer();
+        NodeList nodeList = node.getChildNodes();
+        for (int i = 0; i < nodeList.getLength(); i++) {
+            if (nodeList.item(i).getNodeType() == Node.TEXT_NODE
+                || nodeList.item(i).getNodeType() == Node.CDATA_SECTION_NODE) {
+                text.append(((Text) nodeList.item(i)).getData());
+            } else {
+                text.append(getTextValue(nodeList.item(i)));
+            }
+        }
+        return text.toString();
+    }
+
+    /**
+     *  Get the status code out of the normal status response.
+     *
+     *  <P>  Each <code>DAV:propstat</code> node contains a
+     *  status line, such as:
+     *
+     *  <PRE>
+     *  &lt;DAV:status&gt;HTTP/1.1 200 OK&lt;/DAV:status&gt;
+     *  </PRE>
+     *
+     *  <P>  In this case, calling this method on the
+     *  text string returns 200.
+     */
+    public static int parseStatus(String statusString) {
+        int status = -1;
+        if (statusString != null) {
+            StringTokenizer tokenizer = new StringTokenizer(statusString);
+            if (tokenizer.countTokens() >= 2) {
+                tokenizer.nextElement();
+                String statusCode = tokenizer.nextElement().toString();
+                try {
+                    status = Integer.parseInt(statusCode);
+                } catch (NumberFormatException e) {
+                    throw new IllegalArgumentException(
+                        "Status code is not numeric");
+                }
+            } else {
+                throw new IllegalArgumentException(
+                    "There aren't enough words in the input argument");
+            }
+        }
+        return status;
+    }
+
+    public static String getElementNamespaceURI(Element element) {
+        String namespace = null;
+
+        if (element == null) {
+            throw new IllegalArgumentException(
+                "The element cannot be null");
+        } else {
+            try {
+                namespace = element.getNamespaceURI();                
+            }
+            catch (NoSuchMethodError e) {
+                String tagName = element.getTagName();
+                String attribute = "xmlns";
+                int index = tagName.indexOf(":");
+                if (index > 0 && index < (tagName.length()-1)) {
+                    attribute += (":" + tagName.substring(0,index));
+                }
+
+                boolean found = false;
+                for (Node node = element; !found && node != null;
+                    node = node.getParentNode()) {
+                    try {
+                        String tmp = ((Element) node).getAttribute(attribute);
+                        if (tmp != null && !tmp.equals("")) {
+                            namespace = tmp;
+                            found = true;
+                        }
+                    }
+                    catch (ClassCastException f) {
+                        // this will happen for Documents
+                    }
+                }
+            }
+        }
+
+        return namespace;
+    }
+
+    public static String getElementLocalName(Element element) {
+        String localName = null;
+
+        if (element == null) {
+            throw new IllegalArgumentException(
+                "The element cannot be null");
+        } else {
+            try {
+                localName = element.getLocalName();
+            }
+            catch (NoSuchMethodError e) {
+                localName = element.getTagName();
+                int index = localName.indexOf(":");
+                if (index > 0 && index < (localName.length()-1)) {
+                    localName = localName.substring(index + 1);
+                }
+            }
+        }
+        return localName;
+    }
+
+    /**
+     *
+     */
+    public static NodeList getElementsByTagNameNS(
+        Node node, String tagName, String namespace) {
+
+        NodeList list = null;
+        
+        if (node == null) {
+            return null;
+        } 
+        else if (!(node instanceof Document) && !(node instanceof Element)) {
+            throw new IllegalArgumentException(
+                    "The node parameter must be an Element or a Document node");
+        }
+        else {
+            try {
+                list = ((Element) node).getElementsByTagNameNS(namespace, tagName);
+            }
+            catch (NoSuchMethodError e) {
+                Vector vector = new Vector();
+                getChildElementsByTagNameNS(vector, node, tagName, namespace);
+                list = new NodeListImpl(vector);
+            }
+        }
+        return list;
+    }
+
+
+    protected static void getChildElementsByTagNameNS(
+        Vector vector, Node node, String tagName, String namespace) {
+
+        NodeList list = node.getChildNodes();
+        for (int i = 0; list != null && i < list.getLength(); i++) {
+            try {
+                Element element = (Element) list.item(i);
+
+                if (tagName.equals(getElementLocalName(element)) &&
+                    namespace.equals(getElementNamespaceURI(element))) {
+
+                    vector.addElement(element);
+                } else {
+                    // RECURSIVE!  DANGER, WILL ROBINSON!
+                    getChildElementsByTagNameNS(vector, element,
+                                                tagName, namespace);
+                }
+            } catch (ClassCastException e) {
+            }
+        }
+    }
+
+
+    /**
+     * Get the first element matched with the given namespace and name.
+     *
+     * @param node The node.
+     * @param namespac The namespace.
+     * @param name The name.
+     * @return The wanted first element.
+     */
+    public static Element getFirstElement(Node node, String namespace,
+                                          String name) {
+        NodeList children = node.getChildNodes();
+        if (children == null)
+            return null;
+        for (int i = 0; i < children.getLength(); i++) {
+            try {
+                Element child = (Element) children.item(i);
+                if (name.equals(getElementLocalName(child)) &&
+                    namespace.equals(getElementNamespaceURI(child))) {
+                    return child;
+                }
+            } catch (ClassCastException e) {
+            }
+        }
+        return null;
+    }
+
+
+    // ---------------------------------------------------------- Inner Classes
+
+
+    /**
+     * This class provides an implementation of NodeList, which is used by
+     * the getElementsByTagNameNS() method.
+     */
+    static class NodeListImpl implements NodeList {
+        private Vector vector = null;
+
+        NodeListImpl(Vector vector) {
+            this.vector = vector;
+        }
+
+        public int getLength() {
+            return vector.size();
+        }
+
+        public Node item(int i) {
+            return (Node) vector.elementAt(i);
+        }
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/DOMWriter.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/DOMWriter.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/DOMWriter.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,295 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/util/DOMWriter.java,v 1.1 2004/08/02 15:45:49 unico Exp $
+ * $Revision: 1.1 $
+ * $Date: 2004/08/02 15:45:49 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ 
+
+package org.apache.webdav.lib.util;
+
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class DOMWriter {
+
+   //
+   // Data
+   //
+
+   /** Default Encoding */
+   private static  String
+   PRINTWRITER_ENCODING = "UTF8";
+
+   private static String MIME2JAVA_ENCODINGS[] =
+    { "Default", "UTF-8", "US-ASCII", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", 
+      "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-2022-JP",
+      "SHIFT_JIS", "EUC-JP","GB2312", "BIG5", "EUC-KR", "ISO-2022-KR", "KOI8-R", "EBCDIC-CP-US", 
+      "EBCDIC-CP-CA", "EBCDIC-CP-NL", "EBCDIC-CP-DK", "EBCDIC-CP-NO", "EBCDIC-CP-FI", "EBCDIC-CP-SE",
+      "EBCDIC-CP-IT", "EBCDIC-CP-ES", "EBCDIC-CP-GB", "EBCDIC-CP-FR", "EBCDIC-CP-AR1", 
+      "EBCDIC-CP-HE", "EBCDIC-CP-CH", "EBCDIC-CP-ROECE","EBCDIC-CP-YU",  
+      "EBCDIC-CP-IS", "EBCDIC-CP-AR2", "UTF-16"
+    };
+
+
+   /** Print writer. */
+   protected PrintWriter out;
+
+   /** Canonical output. */
+   protected boolean canonical;
+
+
+   public DOMWriter(String encoding, boolean canonical)              
+   throws UnsupportedEncodingException {
+      out = new PrintWriter(new OutputStreamWriter(System.out, encoding));
+      this.canonical = canonical;
+   } // <init>(String,boolean)
+
+   //
+   // Constructors
+   //
+
+   /** Default constructor. */
+   public DOMWriter(boolean canonical) throws UnsupportedEncodingException {
+      this( getWriterEncoding(), canonical);
+   }
+
+    public DOMWriter(Writer writer, boolean canonical) {
+	out = new PrintWriter(writer);
+	this.canonical = canonical;	
+    }
+
+   public static String getWriterEncoding( ) {
+      return (PRINTWRITER_ENCODING);
+   }// getWriterEncoding 
+
+   public static void  setWriterEncoding( String encoding ) {
+      if( encoding.equalsIgnoreCase( "DEFAULT" ) )
+         PRINTWRITER_ENCODING  = "UTF8";
+      else if( encoding.equalsIgnoreCase( "UTF-16" ) )
+         PRINTWRITER_ENCODING  = "Unicode";
+      else
+         PRINTWRITER_ENCODING = MIME2Java.convert( encoding ); 
+   }// setWriterEncoding 
+
+
+   public static boolean isValidJavaEncoding( String encoding ) {
+      for ( int i = 0; i < MIME2JAVA_ENCODINGS.length; i++ )
+         if ( encoding.equals( MIME2JAVA_ENCODINGS[i] ) )
+            return (true);
+
+      return (false);
+   }// isValidJavaEncoding 
+
+
+   /** Prints the specified node, recursively. */
+   public void print(Node node) {
+
+      // is there anything to do?
+      if ( node == null ) {
+         return;
+      }
+
+      int type = node.getNodeType();
+      switch ( type ) {
+         // print document
+         case Node.DOCUMENT_NODE: {
+               if ( !canonical ) {
+                  String  Encoding = getWriterEncoding();
+                  if( Encoding.equalsIgnoreCase( "DEFAULT" ) )
+                     Encoding = "UTF-8";
+                  else if( Encoding.equalsIgnoreCase( "Unicode" ) )
+                     Encoding = "UTF-16";
+                  else 
+                     Encoding = MIME2Java.reverse( Encoding );
+
+                  out.println("<?xml version=\"1.0\" encoding=\""+
+                           Encoding + "\"?>");
+               }
+               print(((Document)node).getDocumentElement());
+               out.flush();
+               break;
+            }
+
+            // print element with attributes
+         case Node.ELEMENT_NODE: {
+               out.print('<');
+               out.print(node.getNodeName());
+               Attr attrs[] = sortAttributes(node.getAttributes());
+               for ( int i = 0; i < attrs.length; i++ ) {
+                  Attr attr = attrs[i];
+                  out.print(' ');
+                  out.print(attr.getNodeName());
+                  out.print("=\"");
+                  out.print(normalize(attr.getNodeValue()));
+                  out.print('"');
+               }
+               out.print('>');
+               NodeList children = node.getChildNodes();
+               if ( children != null ) {
+                  int len = children.getLength();
+                  for ( int i = 0; i < len; i++ ) {
+                     print(children.item(i));
+                  }
+               }
+               break;
+            }
+
+            // handle entity reference nodes
+         case Node.ENTITY_REFERENCE_NODE: {
+               if ( canonical ) {
+                  NodeList children = node.getChildNodes();
+                  if ( children != null ) {
+                     int len = children.getLength();
+                     for ( int i = 0; i < len; i++ ) {
+                        print(children.item(i));
+                     }
+                  }
+               } else {
+                  out.print('&');
+                  out.print(node.getNodeName());
+                  out.print(';');
+               }
+               break;
+            }
+
+            // print cdata sections
+         case Node.CDATA_SECTION_NODE: {
+               if ( canonical ) {
+                  out.print(normalize(node.getNodeValue()));
+               } else {
+                  out.print("<![CDATA[");
+                  out.print(node.getNodeValue());
+                  out.print("]]>");
+               }
+               break;
+            }
+
+            // print text
+         case Node.TEXT_NODE: {
+               out.print(normalize(node.getNodeValue()));
+               break;
+            }
+
+            // print processing instruction
+         case Node.PROCESSING_INSTRUCTION_NODE: {
+               out.print("<?");
+               out.print(node.getNodeName());
+               String data = node.getNodeValue();
+               if ( data != null && data.length() > 0 ) {
+                  out.print(' ');
+                  out.print(data);
+               }
+               out.print("?>");
+               break;
+            }
+      }
+
+      if ( type == Node.ELEMENT_NODE ) {
+         out.print("</");
+         out.print(node.getNodeName());
+         out.print('>');
+      }
+
+      out.flush();
+
+   } // print(Node)
+
+   /** Returns a sorted list of attributes. */
+   protected Attr[] sortAttributes(NamedNodeMap attrs) {
+
+      int len = (attrs != null) ? attrs.getLength() : 0;
+      Attr array[] = new Attr[len];
+      for ( int i = 0; i < len; i++ ) {
+         array[i] = (Attr)attrs.item(i);
+      }
+      for ( int i = 0; i < len - 1; i++ ) {
+         String name  = array[i].getNodeName();
+         int    index = i;
+         for ( int j = i + 1; j < len; j++ ) {
+            String curName = array[j].getNodeName();
+            if ( curName.compareTo(name) < 0 ) {
+               name  = curName;
+               index = j;
+            }
+         }
+         if ( index != i ) {
+            Attr temp    = array[i];
+            array[i]     = array[index];
+            array[index] = temp;
+         }
+      }
+
+      return (array);
+
+   } // sortAttributes(NamedNodeMap):Attr[]
+
+
+   /** Normalizes the given string. */
+   protected String normalize(String s) {
+      StringBuffer str = new StringBuffer();
+
+      int len = (s != null) ? s.length() : 0;
+      for ( int i = 0; i < len; i++ ) {
+         char ch = s.charAt(i);
+         switch ( ch ) {
+            case '<': {
+                  str.append("&lt;");
+                  break;
+               }
+            case '>': {
+                  str.append("&gt;");
+                  break;
+               }
+            case '&': {
+                  str.append("&amp;");
+                  break;
+               }
+            case '"': {
+                  str.append("&quot;");
+                  break;
+               }
+            case '\r':
+            case '\n': {
+                  if ( canonical ) {
+                     str.append("&#");
+                     str.append(Integer.toString(ch));
+                     str.append(';');
+                     break;
+                  }
+                  // else, default append char
+               }
+            default: {
+                  str.append(ch);
+               }
+         }
+      }
+
+      return (str.toString());
+
+   } // normalize(String):String
+
+} 

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/MIME2Java.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/MIME2Java.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/MIME2Java.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,607 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/util/MIME2Java.java,v 1.1 2004/08/02 15:45:49 unico Exp $
+ * $Revision: 1.1 $
+ * $Date: 2004/08/02 15:45:49 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.util;
+
+import java.util.*;
+
+/**
+ * MIME2Java is a convenience class which handles conversions between MIME charset names
+ * and Java encoding names.
+ * <p>The supported XML encodings are the intersection of XML-supported code sets and those 
+ * supported in JDK 1.1.
+ * <p>MIME charset names are used on <var>xmlEncoding</var> parameters to methods such
+ * as <code>TXDocument#setEncoding</code> and <code>DTD#setEncoding</code>.
+ * <p>Java encoding names are used on <var>encoding</var> parameters to
+ * methods such as <code>TXDocument#printWithFormat</code> and <code>DTD#printExternal</code>. 
+ * <P>
+ * <TABLE BORDER="0" WIDTH="100%">
+ *  <TR>
+ *      <TD WIDTH="33%">
+ *          <P ALIGN="CENTER"><B>Common Name</B>
+ *      </TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER"><B>Use this name in XML files</B>
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER"><B>Name Type</B>
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER"><B>Xerces converts to this Java Encoder Name</B>
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">8 bit Unicode</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">UTF-8
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">UTF8
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">ISO Latin 1</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ISO-8859-1
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">ISO-8859-1
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">ISO Latin 2</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ISO-8859-2
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">ISO-8859-2
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">ISO Latin 3</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ISO-8859-3
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">ISO-8859-3
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">ISO Latin 4</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ISO-8859-4
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">ISO-8859-4
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">ISO Latin Cyrillic</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ISO-8859-5
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">ISO-8859-5
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">ISO Latin Arabic</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ISO-8859-6
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">ISO-8859-6
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">ISO Latin Greek</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ISO-8859-7
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">ISO-8859-7
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">ISO Latin Hebrew</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ISO-8859-8
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">ISO-8859-8
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">ISO Latin 5</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ISO-8859-9
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">ISO-8859-9
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: US</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-us
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp037
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Canada</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-ca
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp037
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Netherlands</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-nl
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp037
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Denmark</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-dk
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp277
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Norway</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-no
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp277
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Finland</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-fi
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp278
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Sweden</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-se
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp278
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Italy</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-it
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp280
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Spain, Latin America</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-es
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp284
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Great Britain</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-gb
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp285
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: France</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-fr
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp297
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Arabic</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-ar1
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp420
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Hebrew</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-he
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp424
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Switzerland</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-ch
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp500
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Roece</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-roece
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp870
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Yogoslavia</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-yu
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp870
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Iceland</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-is
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp871
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">EBCDIC: Urdu</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">ebcdic-cp-ar2
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">IANA
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">cp918
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">Chinese for PRC, mixed 1/2 byte</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">gb2312
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">GB2312
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">Extended Unix Code, packed for Japanese</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">euc-jp
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">eucjis
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">Japanese: iso-2022-jp</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">iso-2020-jp
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">JIS
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">Japanese: Shift JIS</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">Shift_JIS
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">SJIS
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">Chinese: Big5</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">Big5
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">Big5
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">Extended Unix Code, packed for Korean</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">euc-kr
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">iso2022kr
+ *      </TD>
+ *  </TR>
+ *  <TR>
+ *      <TD WIDTH="33%">Cyrillic</TD>
+ *      <TD WIDTH="15%">
+ *          <P ALIGN="CENTER">koi8-r
+ *      </TD>
+ *      <TD WIDTH="12%">
+ *          <P ALIGN="CENTER">MIME
+ *      </TD>
+ *      <TD WIDTH="31%">
+ *          <P ALIGN="CENTER">koi8-r
+ *      </TD>
+ *  </TR>
+ * </TABLE>
+ * 
+ */
+public class MIME2Java {
+    
+    static private Hashtable s_enchash;
+    static private Hashtable s_revhash;
+    
+    static {
+        s_enchash = new Hashtable();
+        //    <preferred MIME name>, <Java encoding name>
+        s_enchash.put("UTF-8", "UTF8");
+        s_enchash.put("US-ASCII",        "8859_1");    // ?
+        s_enchash.put("ISO-8859-1",      "8859_1");
+        s_enchash.put("ISO-8859-2",      "8859_2");
+        s_enchash.put("ISO-8859-3",      "8859_3");
+        s_enchash.put("ISO-8859-4",      "8859_4");
+        s_enchash.put("ISO-8859-5",      "8859_5");
+        s_enchash.put("ISO-8859-6",      "8859_6");
+        s_enchash.put("ISO-8859-7",      "8859_7");
+        s_enchash.put("ISO-8859-8",      "8859_8");
+        s_enchash.put("ISO-8859-9",      "8859_9");
+        s_enchash.put("ISO-2022-JP",     "JIS");
+        s_enchash.put("SHIFT_JIS",       "SJIS");
+        s_enchash.put("EUC-JP",          "EUCJIS");
+        s_enchash.put("GB2312",          "GB2312");
+        s_enchash.put("BIG5",            "Big5");
+        s_enchash.put("EUC-KR",          "KSC5601");
+        s_enchash.put("ISO-2022-KR",     "ISO2022KR");
+        s_enchash.put("KOI8-R",          "KOI8_R");
+
+        s_enchash.put("EBCDIC-CP-US",    "CP037");
+        s_enchash.put("EBCDIC-CP-CA",    "CP037");
+        s_enchash.put("EBCDIC-CP-NL",    "CP037");
+        s_enchash.put("EBCDIC-CP-DK",    "CP277");
+        s_enchash.put("EBCDIC-CP-NO",    "CP277");
+        s_enchash.put("EBCDIC-CP-FI",    "CP278");
+        s_enchash.put("EBCDIC-CP-SE",    "CP278");
+        s_enchash.put("EBCDIC-CP-IT",    "CP280");
+        s_enchash.put("EBCDIC-CP-ES",    "CP284");
+        s_enchash.put("EBCDIC-CP-GB",    "CP285");
+        s_enchash.put("EBCDIC-CP-FR",    "CP297");
+        s_enchash.put("EBCDIC-CP-AR1",   "CP420");
+        s_enchash.put("EBCDIC-CP-HE",    "CP424");
+        s_enchash.put("EBCDIC-CP-CH",    "CP500");
+        s_enchash.put("EBCDIC-CP-ROECE", "CP870");
+        s_enchash.put("EBCDIC-CP-YU",    "CP870");
+        s_enchash.put("EBCDIC-CP-IS",    "CP871");
+        s_enchash.put("EBCDIC-CP-AR2",   "CP918");
+
+                                                // j:CNS11643 -> EUC-TW?
+                                                // ISO-2022-CN? ISO-2022-CN-EXT?
+                                                
+        s_revhash = new Hashtable();
+        //    <Java encoding name>, <preferred MIME name>
+        s_revhash.put("UTF8", "UTF-8");
+        //s_revhash.put("8859_1", "US-ASCII");    // ?
+        s_revhash.put("8859_1", "ISO-8859-1");
+        s_revhash.put("8859_2", "ISO-8859-2");
+        s_revhash.put("8859_3", "ISO-8859-3");
+        s_revhash.put("8859_4", "ISO-8859-4");
+        s_revhash.put("8859_5", "ISO-8859-5");
+        s_revhash.put("8859_6", "ISO-8859-6");
+        s_revhash.put("8859_7", "ISO-8859-7");
+        s_revhash.put("8859_8", "ISO-8859-8");
+        s_revhash.put("8859_9", "ISO-8859-9");
+        s_revhash.put("JIS", "ISO-2022-JP");
+        s_revhash.put("SJIS", "Shift_JIS");
+        s_revhash.put("EUCJIS", "EUC-JP");
+        s_revhash.put("GB2312", "GB2312");
+        s_revhash.put("BIG5", "Big5");
+        s_revhash.put("KSC5601", "EUC-KR");
+        s_revhash.put("ISO2022KR", "ISO-2022-KR");
+        s_revhash.put("KOI8_R", "KOI8-R");
+
+        s_revhash.put("CP037", "EBCDIC-CP-US");
+        s_revhash.put("CP037", "EBCDIC-CP-CA");
+        s_revhash.put("CP037", "EBCDIC-CP-NL");
+        s_revhash.put("CP277", "EBCDIC-CP-DK");
+        s_revhash.put("CP277", "EBCDIC-CP-NO");
+        s_revhash.put("CP278", "EBCDIC-CP-FI");
+        s_revhash.put("CP278", "EBCDIC-CP-SE");
+        s_revhash.put("CP280", "EBCDIC-CP-IT");
+        s_revhash.put("CP284", "EBCDIC-CP-ES");
+        s_revhash.put("CP285", "EBCDIC-CP-GB");
+        s_revhash.put("CP297", "EBCDIC-CP-FR");
+        s_revhash.put("CP420", "EBCDIC-CP-AR1");
+        s_revhash.put("CP424", "EBCDIC-CP-HE");
+        s_revhash.put("CP500", "EBCDIC-CP-CH");
+        s_revhash.put("CP870", "EBCDIC-CP-ROECE");
+        s_revhash.put("CP870", "EBCDIC-CP-YU");
+        s_revhash.put("CP871", "EBCDIC-CP-IS");
+        s_revhash.put("CP918", "EBCDIC-CP-AR2");
+    }
+
+    private MIME2Java() {
+    }
+
+    /**
+     * Convert a MIME charset name, also known as an XML encoding name, to a Java encoding name.
+     * @param   mimeCharsetName Case insensitive MIME charset name: <code>UTF-8, US-ASCII, ISO-8859-1,
+     *                          ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6,
+     *                          ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-2022-JP, Shift_JIS, 
+     *                          EUC-JP, GB2312, Big5, EUC-KR, ISO-2022-KR, KOI8-R,
+     *                          EBCDIC-CP-US, EBCDIC-CP-CA, EBCDIC-CP-NL, EBCDIC-CP-DK,
+     *                          EBCDIC-CP-NO, EBCDIC-CP-FI, EBCDIC-CP-SE, EBCDIC-CP-IT,
+     *                          EBCDIC-CP-ES, EBCDIC-CP-GB, EBCDIC-CP-FR, EBCDIC-CP-AR1,
+     *                          EBCDIC-CP-HE, EBCDIC-CP-CH, EBCDIC-CP-ROECE, EBCDIC-CP-YU,
+     *                          EBCDIC-CP-IS and EBCDIC-CP-AR2</code>.
+     * @return                  Java encoding name, or <var>null</var> if <var>mimeCharsetName</var>
+     *                          is unknown.
+     * @see #reverse
+     */
+    public static String convert(String mimeCharsetName) {
+        return (String)s_enchash.get(mimeCharsetName.toUpperCase());
+    }
+
+    /**
+     * Convert a Java encoding name to MIME charset name.
+     * Available values of <i>encoding</i> are "UTF8", "8859_1", "8859_2", "8859_3", "8859_4",
+     * "8859_5", "8859_6", "8859_7", "8859_8", "8859_9", "JIS", "SJIS", "EUCJIS",
+     * "GB2312", "BIG5", "KSC5601", "ISO2022KR",  "KOI8_R", "CP037", "CP277", "CP278",
+     * "CP280", "CP284", "CP285", "CP297", "CP420", "CP424", "CP500", "CP870", "CP871" and "CP918".
+     * @param   encoding    Case insensitive Java encoding name: <code>UTF8, 8859_1, 8859_2, 8859_3,
+     *                      8859_4, 8859_5, 8859_6, 8859_7, 8859_8, 8859_9, JIS, SJIS, EUCJIS,
+     *                      GB2312, BIG5, KSC5601, ISO2022KR, KOI8_R, CP037, CP277, CP278,
+     *                      CP280, CP284, CP285, CP297, CP420, CP424, CP500, CP870, CP871 
+     *                      and CP918</code>.
+     * @return              MIME charset name, or <var>null</var> if <var>encoding</var> is unknown.
+     * @see #convert
+     */
+    public static String reverse(String encoding) {
+        return (String)s_revhash.get(encoding.toUpperCase());
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/PropertyWriter.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/PropertyWriter.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/PropertyWriter.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,303 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/util/PropertyWriter.java,v 1.1 2004/08/02 15:45:49 unico Exp $
+ * $Revision: 1.1 $
+ * $Date: 2004/08/02 15:45:49 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ 
+
+package org.apache.webdav.lib.util;
+
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class PropertyWriter {
+
+   //
+   // Data
+   //
+
+   /** Default Encoding */
+   private static  String
+   PRINTWRITER_ENCODING = "UTF8";
+
+   private static String MIME2JAVA_ENCODINGS[] =
+    { "Default", "UTF-8", "US-ASCII", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", 
+      "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-2022-JP",
+      "SHIFT_JIS", "EUC-JP","GB2312", "BIG5", "EUC-KR", "ISO-2022-KR", "KOI8-R", "EBCDIC-CP-US", 
+      "EBCDIC-CP-CA", "EBCDIC-CP-NL", "EBCDIC-CP-DK", "EBCDIC-CP-NO", "EBCDIC-CP-FI", "EBCDIC-CP-SE",
+      "EBCDIC-CP-IT", "EBCDIC-CP-ES", "EBCDIC-CP-GB", "EBCDIC-CP-FR", "EBCDIC-CP-AR1", 
+      "EBCDIC-CP-HE", "EBCDIC-CP-CH", "EBCDIC-CP-ROECE","EBCDIC-CP-YU",  
+      "EBCDIC-CP-IS", "EBCDIC-CP-AR2", "UTF-16"
+    };
+
+
+   /** Print writer. */
+   protected PrintWriter out;
+
+   /** Canonical output. */
+   protected boolean canonical;
+
+
+   public PropertyWriter(String encoding, boolean canonical)              
+   throws UnsupportedEncodingException {
+      out = new PrintWriter(new OutputStreamWriter(System.out, encoding));
+      this.canonical = canonical;
+   } // <init>(String,boolean)
+
+   //
+   // Constructors
+   //
+
+   /** Default constructor. */
+   public PropertyWriter(boolean canonical) throws UnsupportedEncodingException {
+      this( getWriterEncoding(), canonical);
+   }
+
+    public PropertyWriter(Writer writer, boolean canonical) {
+	out = new PrintWriter(writer);
+	this.canonical = canonical;	
+    }
+
+   public static String getWriterEncoding( ) {
+      return (PRINTWRITER_ENCODING);
+   }// getWriterEncoding 
+
+   public static void  setWriterEncoding( String encoding ) {
+      if( encoding.equalsIgnoreCase( "DEFAULT" ) )
+         PRINTWRITER_ENCODING  = "UTF8";
+      else if( encoding.equalsIgnoreCase( "UTF-16" ) )
+         PRINTWRITER_ENCODING  = "Unicode";
+      else
+         PRINTWRITER_ENCODING = MIME2Java.convert( encoding ); 
+   }// setWriterEncoding 
+
+
+   public static boolean isValidJavaEncoding( String encoding ) {
+      for ( int i = 0; i < MIME2JAVA_ENCODINGS.length; i++ )
+         if ( encoding.equals( MIME2JAVA_ENCODINGS[i] ) )
+            return (true);
+
+      return (false);
+   }// isValidJavaEncoding 
+
+
+   /** Prints the specified node, recursively. */
+   public void print(Node node) {
+
+      // is there anything to do?
+      if ( node == null ) {
+         return;
+      }
+
+      int type = node.getNodeType();
+      switch ( type ) {
+         // print document
+         case Node.DOCUMENT_NODE: {
+               if ( !canonical ) {
+                  String  Encoding = getWriterEncoding();
+                  if( Encoding.equalsIgnoreCase( "DEFAULT" ) )
+                     Encoding = "UTF-8";
+                  else if( Encoding.equalsIgnoreCase( "Unicode" ) )
+                     Encoding = "UTF-16";
+                  else 
+                     Encoding = MIME2Java.reverse( Encoding );
+
+                  out.println("<?xml version=\"1.0\" encoding=\""+
+                           Encoding + "\"?>");
+               }
+               print(((Document)node).getDocumentElement());
+               out.flush();
+               break;
+            }
+
+            // print element with attributes
+         case Node.ELEMENT_NODE: {
+               out.print('<');
+               out.print(node.getLocalName());
+               out.print(' ');
+               out.print("xmlns=\"");
+               if (node.getNamespaceURI() != null) {
+                   out.print(node.getNamespaceURI());
+               }
+               out.print("\"");
+               Attr attrs[] = sortAttributes(node.getAttributes());
+               for ( int i = 0; i < attrs.length; i++ ) {
+                  Attr attr = attrs[i];
+                  if (!attr.getNodeName().equals("xmlns")) {
+                      out.print(' ');
+                      out.print(attr.getNodeName());
+                      out.print("=\"");
+                      out.print(normalize(attr.getNodeValue()));
+                      out.print('"');
+                  }
+               }
+               out.print('>');
+               NodeList children = node.getChildNodes();
+               if ( children != null ) {
+                  int len = children.getLength();
+                  for ( int i = 0; i < len; i++ ) {
+                     print(children.item(i));
+                  }
+               }
+               break;
+            }
+
+            // handle entity reference nodes
+         case Node.ENTITY_REFERENCE_NODE: {
+               if ( canonical ) {
+                  NodeList children = node.getChildNodes();
+                  if ( children != null ) {
+                     int len = children.getLength();
+                     for ( int i = 0; i < len; i++ ) {
+                        print(children.item(i));
+                     }
+                  }
+               } else {
+                  out.print('&');
+                  out.print(node.getNodeName());
+                  out.print(';');
+               }
+               break;
+            }
+
+            // print cdata sections
+         case Node.CDATA_SECTION_NODE: {
+               if ( canonical ) {
+                  out.print(normalize(node.getNodeValue()));
+               } else {
+                  out.print("<![CDATA[");
+                  out.print(node.getNodeValue());
+                  out.print("]]>");
+               }
+               break;
+            }
+
+            // print text
+         case Node.TEXT_NODE: {
+               out.print(normalize(node.getNodeValue()));
+               break;
+            }
+
+            // print processing instruction
+         case Node.PROCESSING_INSTRUCTION_NODE: {
+               out.print("<?");
+               out.print(node.getNodeName());
+               String data = node.getNodeValue();
+               if ( data != null && data.length() > 0 ) {
+                  out.print(' ');
+                  out.print(data);
+               }
+               out.print("?>");
+               break;
+            }
+      }
+
+      if ( type == Node.ELEMENT_NODE ) {
+         out.print("</");
+         out.print(node.getLocalName());
+         out.print('>');
+      }
+
+      out.flush();
+
+   } // print(Node)
+
+   /** Returns a sorted list of attributes. */
+   protected Attr[] sortAttributes(NamedNodeMap attrs) {
+
+      int len = (attrs != null) ? attrs.getLength() : 0;
+      Attr array[] = new Attr[len];
+      for ( int i = 0; i < len; i++ ) {
+         array[i] = (Attr)attrs.item(i);
+      }
+      for ( int i = 0; i < len - 1; i++ ) {
+         String name  = array[i].getNodeName();
+         int    index = i;
+         for ( int j = i + 1; j < len; j++ ) {
+            String curName = array[j].getNodeName();
+            if ( curName.compareTo(name) < 0 ) {
+               name  = curName;
+               index = j;
+            }
+         }
+         if ( index != i ) {
+            Attr temp    = array[i];
+            array[i]     = array[index];
+            array[index] = temp;
+         }
+      }
+
+      return (array);
+
+   } // sortAttributes(NamedNodeMap):Attr[]
+
+
+   /** Normalizes the given string. */
+   protected String normalize(String s) {
+      StringBuffer str = new StringBuffer();
+
+      int len = (s != null) ? s.length() : 0;
+      for ( int i = 0; i < len; i++ ) {
+         char ch = s.charAt(i);
+         switch ( ch ) {
+            case '<': {
+                  str.append("&lt;");
+                  break;
+               }
+            case '>': {
+                  str.append("&gt;");
+                  break;
+               }
+            case '&': {
+                  str.append("&amp;");
+                  break;
+               }
+            case '"': {
+                  str.append("&quot;");
+                  break;
+               }
+            case '\r':
+            case '\n': {
+                  if ( canonical ) {
+                     str.append("&#");
+                     str.append(Integer.toString(ch));
+                     str.append(';');
+                     break;
+                  }
+                  // else, default append char
+               }
+            default: {
+                  str.append(ch);
+               }
+         }
+      }
+
+      return (str.toString());
+
+   } // normalize(String):String
+
+} 

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/QName.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/QName.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/QName.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,85 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/util/QName.java,v 1.1 2004/08/02 15:45:49 unico Exp $
+ * $Revision: 1.1 $
+ * $Date: 2004/08/02 15:45:49 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */ 
+
+package org.apache.webdav.lib.util;
+
+import org.w3c.dom.Node;
+
+/**
+ * A <code>QName</code> represents a fully-qualified name.
+ */
+public class QName
+{
+	private String namespaceURI;
+	private String localName;
+	private int hashCode;
+
+	public QName(String namespaceURI, String localName)
+	{
+		this.namespaceURI = (namespaceURI == null ? "" : namespaceURI).intern();
+		this.localName = localName.intern();
+		
+		String hash1 = this.namespaceURI.hashCode() + "";
+		String hash2 = this.localName.hashCode() + "";
+		String hash3 = hash1 + '_' + hash2;
+		this.hashCode=hash3.hashCode();
+	}
+
+	public String getNamespaceURI()
+	{
+		return this.namespaceURI;
+	}
+
+	public String getLocalName()
+	{
+		return this.localName;
+	}
+
+	public int hashCode()
+	{
+		return this.hashCode;
+	}
+
+	public boolean equals(Object obj)
+	{
+		return (obj != null
+			&& (obj instanceof QName)
+	        && namespaceURI == ((QName)obj).getNamespaceURI()
+	        && localName == ((QName)obj).getLocalName());
+	}
+
+	public boolean matches(Node node)
+	{
+		return (node!=null)
+					&& (node.getNamespaceURI()!=null)
+					&& (node.getLocalName()!=null)
+					&& (node.getNamespaceURI().intern()==this.namespaceURI)
+					&& (node.getLocalName().intern()==this.localName);
+	}
+
+	public String toString()
+	{
+		return namespaceURI + ':' + localName;
+	}
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/WebdavStatus.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/WebdavStatus.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/WebdavStatus.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,176 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/util/WebdavStatus.java,v 1.1 2004/08/02 15:45:49 unico Exp $
+ * $Revision: 1.1 $
+ * $Date: 2004/08/02 15:45:49 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.util;
+
+import java.util.Hashtable;
+
+public class WebdavStatus {
+
+
+    // -------------------------------------------------------------- Variables
+
+
+    private static Hashtable mapStatusCodes = new Hashtable();
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    public static String getStatusText(int nHttpStatusCode) {
+        Integer intKey = new Integer(nHttpStatusCode);
+
+        if (!mapStatusCodes.containsKey(intKey)) {
+            // No information
+            return null;
+
+        } else {
+            return (String) mapStatusCodes.get(intKey);
+        }
+    }
+
+
+    // -------------------------------------------------------- Private Methods
+
+
+    private static void addStatusCodeMap(int nKey, String strVal) {
+        mapStatusCodes.put(new Integer(nKey), strVal);
+    }
+
+
+    // -------------------------------------------------------------- Constants
+
+
+    public static final int SC_CONTINUE = 100;
+    public static final int SC_SWITCHING_PROTOCOLS = 101;
+    public static final int SC_PROCESSING = 102;
+
+    public static final int SC_OK = 200;
+    public static final int SC_CREATED = 201;
+    public static final int SC_ACCEPTED = 202;
+    public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203;
+    public static final int SC_NO_CONTENT = 204;
+    public static final int SC_RESET_CONTENT = 205;
+    public static final int SC_PARTIAL_CONTENT = 206;
+    public static final int SC_MULTI_STATUS = 207;
+    // This one colides with HTTP 1.1
+    // "207 Parital Update OK"
+    public static final int SC_ALREADY_REPORTED = 208;
+
+    public static final int SC_MULTIPLE_CHOICES = 300;
+    public static final int SC_MOVED_PERMANENTLY = 301;
+    public static final int SC_MOVED_TEMPORARILY = 302;
+    public static final int SC_SEE_OTHER = 303;
+    public static final int SC_NOT_MODIFIED = 304;
+    public static final int SC_USE_PROXY = 305;
+
+    public static final int SC_BAD_REQUEST = 400;
+    public static final int SC_UNAUTHORIZED = 401;
+    public static final int SC_PAYMENT_REQUIRED = 402;
+    public static final int SC_FORBIDDEN = 403;
+    public static final int SC_NOT_FOUND = 404;
+    public static final int SC_METHOD_NOT_ALLOWED = 405;
+    public static final int SC_NOT_ACCEPTABLE = 406;
+    public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
+    public static final int SC_REQUEST_TIMEOUT = 408;
+    public static final int SC_CONFLICT = 409;
+    public static final int SC_GONE = 410;
+    public static final int SC_LENGTH_REQUIRED = 411;
+    public static final int SC_PRECONDITION_FAILED = 412;
+    public static final int SC_REQUEST_TOO_LONG = 413;
+    public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
+    public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+    public static final int SC_EXPECTATION_FAILED = 417;
+    //public static final int SC_UNPROCESSABLE_ENTITY = 418;
+    // This one colides with HTTP 1.1
+    // "418 Reauthentication Required"
+    public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419;
+    // This one colides with HTTP 1.1
+    // "419 Proxy Reauthentication Required"
+    public static final int SC_METHOD_FAILURE = 420;
+    public static final int SC_UNPROCESSABLE_ENTITY = 422;
+    public static final int SC_LOCKED = 423;
+    public static final int SC_FAILED_DEPENDENCY = 424;
+
+    public static final int SC_INTERNAL_SERVER_ERROR = 500;
+    public static final int SC_NOT_IMPLEMENTED = 501;
+    public static final int SC_BAD_GATEWAY = 502;
+    public static final int SC_SERVICE_UNAVAILABLE = 503;
+    public static final int SC_GATEWAY_TIMEOUT = 504;
+    public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
+    public static final int SC_LOOP_DETECTED = 506;
+    public static final int SC_INSUFFICIENT_STORAGE = 507;
+
+
+    // ----------------------------------------------------- Static Initializer
+
+
+    static {
+        // HTTP 1.0 Server status codes -- see RFC 1945
+        addStatusCodeMap(SC_OK, "OK");
+        addStatusCodeMap(SC_CREATED, "Created");
+        addStatusCodeMap(SC_ACCEPTED, "Accepted");
+        addStatusCodeMap(SC_NO_CONTENT, "No Content");
+        addStatusCodeMap(SC_MOVED_PERMANENTLY, "Moved Permanently");
+        addStatusCodeMap(SC_MOVED_TEMPORARILY, "Moved Temporarily");
+        addStatusCodeMap(SC_NOT_MODIFIED, "Not Modified");
+        addStatusCodeMap(SC_BAD_REQUEST, "Bad Request");
+        addStatusCodeMap(SC_UNAUTHORIZED, "Unauthorized");
+        addStatusCodeMap(SC_FORBIDDEN, "Forbidden");
+        addStatusCodeMap(SC_NOT_FOUND, "Not Found");
+        addStatusCodeMap(SC_INTERNAL_SERVER_ERROR, "Internal Server Error");
+        addStatusCodeMap(SC_NOT_IMPLEMENTED, "Not Implemented");
+        addStatusCodeMap(SC_BAD_GATEWAY, "Bad Gateway");
+        addStatusCodeMap(SC_SERVICE_UNAVAILABLE, "Service Unavailable");
+
+        // HTTP 1.1 Server status codes -- see RFC 2048
+        addStatusCodeMap(SC_CONTINUE, "Continue");
+        addStatusCodeMap(SC_METHOD_NOT_ALLOWED, "Method Not Allowed");
+        addStatusCodeMap(SC_CONFLICT, "Conflict");
+        addStatusCodeMap(SC_PRECONDITION_FAILED, "Precondition Failed");
+        addStatusCodeMap(SC_REQUEST_TOO_LONG, "Request Too Long");
+        addStatusCodeMap(SC_UNSUPPORTED_MEDIA_TYPE, "Unsupported Media Type");
+
+        addStatusCodeMap(SC_SWITCHING_PROTOCOLS, "Switching Protocols");
+        addStatusCodeMap(SC_NON_AUTHORITATIVE_INFORMATION,
+                         "Non Authoritative Information");
+        addStatusCodeMap(SC_RESET_CONTENT, "Reset Content");
+        addStatusCodeMap(SC_GATEWAY_TIMEOUT, "Gateway Timeout");
+        addStatusCodeMap(SC_HTTP_VERSION_NOT_SUPPORTED,
+                         "Http Version Not Supported");
+
+        // WebDAV Server-specific status codes
+        addStatusCodeMap(SC_PROCESSING, "Processing");
+        addStatusCodeMap(SC_MULTI_STATUS, "Multi-Status");
+        addStatusCodeMap(SC_UNPROCESSABLE_ENTITY, "Unprocessable Entity");
+        addStatusCodeMap(SC_INSUFFICIENT_SPACE_ON_RESOURCE,
+                         "Insufficient Space On Resource");
+        addStatusCodeMap(SC_METHOD_FAILURE, "Method Failure");
+        addStatusCodeMap(SC_LOCKED, "Locked");
+        addStatusCodeMap(SC_LOOP_DETECTED, "Loop Detected");
+        addStatusCodeMap(SC_INSUFFICIENT_STORAGE , "Insufficient Storage");
+        addStatusCodeMap(SC_FAILED_DEPENDENCY, "Failed Dependency");
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/XMLDebugOutputer.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/XMLDebugOutputer.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/XMLDebugOutputer.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,246 @@
+/*
+ * $Header: 
+ * $Revision: 
+ * $Date: 
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.lib.util;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.NamedNodeMap;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.*;
+import org.xml.sax.InputSource;
+
+
+
+import java.util.StringTokenizer;
+
+/**
+ * XMLDebugOutputer helper class.
+ */
+public class XMLDebugOutputer {
+    
+    // -------------------------------------------------------------- Constants
+    
+    // blanks for indent (80 char)                  
+    private final static String INDENT = "                                                                                ";
+    private int tabWidth = 3;    
+
+
+    // ----------------------------------------------------- Instance Variables
+    
+    // indicator of debug mode
+    private boolean debug = false;
+    
+    
+    // local parser
+    private DocumentBuilderFactory dbf=null;
+    private DocumentBuilder         db=null;
+            
+
+    // ----------------------------------------------------------- Constructors
+    
+    /**
+     * Constructor
+     */
+    public XMLDebugOutputer() {
+
+        try {
+             dbf=DocumentBuilderFactory.newInstance();
+             db =dbf.newDocumentBuilder();
+            
+        } catch (ParserConfigurationException e) {
+        }
+
+    //        Document doc=db.parse(file);
+
+    };
+
+    // --------------------------------------------------------- Public Methods
+
+    /**
+     * Print the given document to debug output. If debug is set to true;
+     * @param doc
+     */
+    public void print(Document doc) {
+        
+        if (debug) {
+            Node root = doc.getDocumentElement();
+    
+            dispatchNode(root, 0);
+        }
+    }  
+    
+    /**
+     * Print the given XML string to debug output. If debug is set to true;
+     * @param xmlString
+     */
+    public void print(String xmlString) {
+ 
+        if (debug) {
+            try {
+                Document doc = db.parse(new InputSource(new StringReader(xmlString)));
+                print(doc);
+               
+            } catch (SAXException e) {
+            } catch (IOException e) {
+            }
+        }
+        
+        
+    }  
+    
+    /**
+     * Set debug information.
+     * @param debug
+     */
+    public void setDebug(boolean debug) {
+        this.debug = debug;
+    } 
+    
+    
+    // --------------------------------------------------------- Private Methods
+
+ 
+    
+    private void dispatchNode(Node node, int level) {
+        switch (node.getNodeType()) {
+            case Node.CDATA_SECTION_NODE :
+                printCDATANode(node, level);
+                break;
+    
+            case Node.COMMENT_NODE :
+                printCommentNode(node, level);
+                break;
+    
+            case Node.TEXT_NODE :
+                printTextNode(node, level);
+                break;
+    
+            case Node.ELEMENT_NODE :
+                printElementNode(node, level);
+                break;
+    
+            default :
+                break;
+        }
+    }
+    
+    private void printCDATANode(Node node, int level) {
+        System.out.print(INDENT.substring(0, level * tabWidth));
+        System.out.println("<![CDATA[");
+    
+        indentBlock(node.getNodeValue(), level + 1);
+    
+        System.out.print(INDENT.substring(0, level * tabWidth));
+        System.out.println("]]>");
+    }
+    
+    private void printTextNode(Node node, int level) {
+        indentBlock(node.getNodeValue(), level + 1);
+    }
+    
+    private void printCommentNode(Node node, int level) {
+        System.out.print(INDENT.substring(0, level * tabWidth));
+        System.out.println("<!-- ");
+        indentBlock(node.getNodeValue(), level + 1);
+        System.out.print(INDENT.substring(0, level * tabWidth));
+        System.out.println(" -->");
+    }
+    
+    private void printElementNode(Node node, int level) {
+        String name = node.getNodeName();
+        System.out.print(INDENT.substring(0, level * tabWidth));
+        System.out.print("<");
+        System.out.print(name);
+    
+        NamedNodeMap attributes = node.getAttributes();
+        for (int i = 0; attributes != null && i < attributes.getLength(); i++) {
+            if (attributes.getLength() > 1) {
+                System.out.println();
+                System.out.print(INDENT.substring(0, (2 + level) * tabWidth));
+            } else {
+                System.out.print(" ");
+            }
+    
+            Node attribute = attributes.item(i);
+            System.out.print(attribute.getNodeName());
+            System.out.print("=\"");
+            System.out.print(attribute.getNodeValue());
+            System.out.print("\"");
+        }
+        System.out.println(">");
+    
+        // in case of more than one attribute add a blank line as seperator
+        if (attributes.getLength() > 1) {
+            System.out.println();
+        }
+    
+        if (node.hasChildNodes()) {
+            NodeList children = node.getChildNodes();
+            for (int i = 0; i < children.getLength(); i++) {
+                // recursive use of dispatchNode()
+                dispatchNode(children.item(i), level + 1);
+            }
+        }
+    
+        System.out.print(INDENT.substring(0, level * tabWidth));
+        System.out.print("</");
+        System.out.print(name);
+        System.out.println(">");
+    }
+
+    private void indentBlock(String block, int level) {
+        StringTokenizer linetok = new StringTokenizer(block.replace('\n', ' '));
+        int pos = level * tabWidth;
+    
+        if (linetok.countTokens() > 0) {
+            System.out.print(INDENT.substring(0, level * tabWidth));
+        }
+    
+        while (linetok.hasMoreTokens()) {
+            String token = linetok.nextToken();
+            pos += (token.length() + 1);
+            if (pos < 80 && token.length() < (80 - (level * tabWidth))) {
+                if (linetok.countTokens() > 0) {
+                    System.out.print(token);
+                    System.out.print(" ");
+                } else {
+                    System.out.println(token);
+                }
+            } else {
+                System.out.println(token);
+                if (linetok.countTokens() > 0) {
+                    System.out.print(INDENT.substring(0, level * tabWidth));
+                }
+                pos = level * tabWidth;
+            }
+        }
+    }
+
+
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/XMLPrinter.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/XMLPrinter.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/lib/util/XMLPrinter.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,274 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/util/XMLPrinter.java,v 1.1 2004/08/02 15:45:49 unico Exp $
+ * $Revision: 1.1 $
+ * $Date: 2004/08/02 15:45:49 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ 
+
+package org.apache.webdav.lib.util;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * XMLPrinter helper class.
+ */
+public class XMLPrinter {
+    
+    
+    // -------------------------------------------------------------- Constants
+    
+    
+    /**
+     * Opening tag.
+     */
+    public static final int OPENING = 0;
+    
+    
+    /**
+     * Closing tag.
+     */
+    public static final int CLOSING = 1;
+    
+    
+    /**
+     * Element with no content.
+     */
+    public static final int NO_CONTENT = 2;
+    
+    
+    // ----------------------------------------------------- Instance Variables
+    
+    
+    /**
+     * Buffer.
+     */
+    protected StringBuffer buffer = new StringBuffer();
+    
+    
+    /**
+     * Writer.
+     */
+    protected Writer writer = null;
+    
+    
+    // ----------------------------------------------------------- Constructors
+    
+    
+    /**
+     * Constructor.
+     */
+    public XMLPrinter() {
+    }
+    
+    
+    /**
+     * Constructor.
+     */
+    public XMLPrinter(Writer writer) {
+        this.writer = writer;
+    }
+    
+    
+    // --------------------------------------------------------- Public Methods
+    
+    
+    /**
+     * Retrieve generated XML.
+     * 
+     * @return String containing the generated XML
+     */
+    public String toString() {
+        return buffer.toString();
+    }
+    
+    
+    /**
+     * Write property to the XML.
+     * 
+     * @param namespace Namespace
+     * @param namespaceInfo Namespace info
+     * @param name Property name
+     * @param value Property value
+     */
+    public void writeProperty(String namespace, String namespaceInfo, 
+                              String name, String value, boolean cdata) {
+        writeElement(namespace, namespaceInfo, name, OPENING);
+        if (cdata)
+            writeData(value);
+        else
+            writeText(value);
+        writeElement(namespace, namespaceInfo, name, CLOSING);
+    }
+    
+    
+    /**
+     * Write property to the XML.
+     * 
+     * @param namespace Namespace
+     * @param namespaceInfo Namespace info
+     * @param name Property name
+     * @param value Property value
+     */
+    public void writeProperty(String namespace, String namespaceInfo, 
+                              String name, String value) {
+        writeProperty(namespace, namespaceInfo, name, value, false);
+    }
+    
+    
+    /**
+     * Write property to the XML.
+     * 
+     * @param namespace Namespace
+     * @param name Property name
+     * @param value Property value
+     */
+    public void writeProperty(String namespace, String name, String value) {
+        writeProperty(namespace, null, name, value);
+    }
+    
+    
+    /**
+     * Write property to the XML.
+     * 
+     * @param namespace Namespace
+     * @param name Property name
+     */
+    public void writeProperty(String namespace, String name) {
+        writeElement(namespace, name, NO_CONTENT);
+    }
+    
+    
+    /**
+     * Write an element.
+     * 
+     * @param name Element name
+     * @param namespace Namespace abbreviation
+     * @param type Element type
+     */
+    public void writeElement(String namespace, String name, int type) {
+        writeElement(namespace, null, name, type);
+    }
+    
+    
+    /**
+     * Write an element.
+     * 
+     * @param namespace Namespace abbreviation
+     * @param namespaceInfo Namespace info
+     * @param name Element name
+     * @param type Element type
+     */
+    public void writeElement(String namespace, String namespaceInfo, 
+                             String name, int type) {
+        if ((namespace != null) && (namespace.length() > 0)) {
+            switch (type) {
+            case OPENING:
+                if ((namespaceInfo != null) && (namespaceInfo.length() > 0)) {
+                    buffer.append("<" + namespace + ":" + name + " xmlns:" 
+                                  + namespace + "=\"" 
+                                  + namespaceInfo + "\">");
+                } else {
+                    buffer.append("<" + namespace + ":" + name + ">");
+                }
+                break;
+            case CLOSING:
+                buffer.append("</" + namespace + ":" + name + ">");
+                break;
+            case NO_CONTENT:
+            default:
+                if ((namespaceInfo != null)  && (namespaceInfo.length() > 0)) {
+                    buffer.append("<" + namespace + ":" + name + " xmlns:" 
+                                  + namespace + "=\"" 
+                                  + namespaceInfo + "\"/>");
+                } else {
+                    buffer.append("<" + namespace + ":" + name + "/>");
+                }
+                break;
+            }
+        } else {
+            switch (type) {
+            case OPENING:
+                if ((namespaceInfo != null) && (namespaceInfo.length()>0)) {
+                    buffer.append("<" + name + " xmlns=\"" + namespaceInfo 
+                                  + "\">");
+                } else {
+                    buffer.append("<" + name + ">");
+                }
+                break;
+            case CLOSING:
+                buffer.append("</" + name + ">");
+                break;
+            case NO_CONTENT:
+            default:
+                if ((namespaceInfo != null) && (namespaceInfo.length()>0)) {
+                    buffer.append("<" + name + " xmlns=\"" + namespaceInfo 
+                                  + "\"/>");
+                } else {
+                    buffer.append("<" + name + "/>");
+                }
+                break;
+            }
+        }
+    }
+    
+    
+    /**
+     * Write text.
+     * 
+     * @param text Text to append
+     */
+    public void writeText(String text) {
+        buffer.append(text);
+    }
+    
+    
+    /**
+     * Write data.
+     * 
+     * @param data Data to append
+     */
+    public void writeData(String data) {
+        buffer.append("<![CDATA[");
+        buffer.append(data);
+        buffer.append("]]>");
+    }
+    
+    
+    /**
+     * Write XML Header.
+     */
+    public void writeXMLHeader() {
+        buffer.append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
+    }
+    
+    
+    /**
+     * Send data and reinitializes buffer.
+     */
+    public void sendData()
+        throws IOException {
+        if (writer != null) {
+            writer.write(buffer.toString());
+            buffer = new StringBuffer();
+        }
+    }
+    
+    
+}

Added: branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/ui/WebdavSystemView.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/ui/WebdavSystemView.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/clientlib/src/java/org/apache/webdav/ui/WebdavSystemView.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,621 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/ui/WebdavSystemView.java,v 1.1.2.1 2004/10/11 08:18:14 luetzkendorf Exp $
+ * $Revision: 1.1.2.1 $
+ * $Date: 2004/10/11 08:18:14 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.ui;
+
+import java.io.File;
+import java.io.IOException;
+import javax.swing.UIManager;
+import javax.swing.filechooser.FileSystemView;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.HttpsURL;
+import org.apache.commons.httpclient.URIException;
+import org.apache.webdav.lib.WebdavResource;
+
+/**
+ * WebdavSystemView.java
+ */
+public class WebdavSystemView extends FileSystemView {
+
+
+    /** The WebDAV resource. */
+    private WebdavResource webdavResource = null;
+    private HttpURL rootURL = null;
+    private WebdavFile homedir = null;
+    private String username = null;
+    private String password = null;
+    private String uri = null;
+    private String rootPath = null;
+
+    private static final String newFolderString =
+    UIManager.getString("FileChooser.other.newFolder");
+    static FileSystemView fsv = null;
+
+
+    public WebdavSystemView(String uri, String rootPath, String username,
+                            String password)
+        throws IllegalAccessError, URIException, IOException {
+        try {
+            this.rootURL = this.uriToHttpURL(uri + rootPath);
+            this.uri = uri;
+            this.rootURL.setUserinfo(username, password);
+            this.username = username;
+            this.password = password;
+            this.rootPath = rootPath;
+
+
+            this.connect();
+            //System.out.println("Connected successfully to  : " + this.rootURL);
+            this.disconnect();
+
+            // Create home directory object
+            this.homedir = new WebdavFile(this.rootURL, this.rootURL);
+            //System.out.println("Homedir : " + this.homedir);
+        } catch (IllegalAccessError e) {
+            System.err.println(e.toString());
+            e.printStackTrace();
+            throw e;
+        } catch (URIException e) {
+            System.err.println(e.toString());
+            e.printStackTrace();
+            throw e;
+        } catch (IOException e) {
+            System.err.println(e.toString());
+            e.printStackTrace();
+            throw e;
+        }
+
+    }
+
+    private static HttpURL uriToHttpURL(String uri) throws URIException {
+        HttpURL url = null;
+        if (uri.startsWith("http://")) {
+            url = new HttpURL(uri);
+        } else if (uri.startsWith("https://")) {
+            url = new HttpsURL(uri);
+        } else {
+            throw new URIException("Unknown protocol in URL " + uri);
+        }
+        return url;
+    }
+
+    public void disconnect() throws java.lang.UnknownError {
+        try {
+            this.webdavResource.close();
+        } catch (Exception e) {
+            System.err.println(e.toString());
+            throw new UnknownError();
+        }
+    }
+    public void connect() throws java.lang.IllegalAccessError {
+        try {
+            this.webdavResource = new WebdavResource(this.rootURL);
+        } catch (Exception e) {
+            System.err.println(e.toString());
+            throw new IllegalAccessError();
+        }
+    }
+
+    public static FileSystemView getFileSystemView() {
+        try {
+            if (fsv == null) {
+                fsv = new WebdavSystemView("http://127.0.0.1", "/", "",  "");
+            }
+            return fsv;
+        } catch (Exception e) {
+            System.err.println(e.toString());
+            return null;
+        }
+    }
+
+    /**
+     * Returns a File object constructed in dir from the given filename.
+     */
+    public File createFileObject(File dir, String filename) {
+        File file = null;
+        if (dir == null) {
+            file = new File(filename);
+        } else {
+            file = new File(dir, filename);
+        }
+        return file;
+    }
+
+    /**
+     * Returns a File object constructed from the given path string.
+     */
+    public File createFileObject(String path) {
+        File f = new File(path);
+        if (isFileSystemRoot(f)) {
+            f = createFileSystemRoot(f);
+        }
+        return f;
+    }
+
+
+    /**
+     * Creates a new folder with a default folder name.
+     */
+    public File createNewFolder(File containingDir) throws IOException {
+        try {
+            if (containingDir == null) {
+                throw new IOException("Containing directory is null:");
+            }
+            WebdavFile newFolder = null;
+            HttpURL url = null;
+
+            url = this.uriToHttpURL(containingDir.getPath() +
+                                    WebdavFile.davSeparator + newFolderString);
+            // Need to add user info so has access for queries
+            url.setUserinfo(username, password);
+            newFolder = new WebdavFile(url, this.rootURL);
+            //System.out.println("new folder : " + newFolder.toString());
+
+            this.connect();
+            if (this.webdavResource.mkcolMethod(
+                    newFolder.getAbsolutePath())) {
+                //System.out.println("succeeded.");
+                return newFolder;
+            } else {
+                System.err.println("failed.");
+                System.err.println(this.webdavResource.getStatusMessage());
+                throw new IOException(
+                    this.webdavResource.getStatusMessage());
+            }
+        } catch (IOException e) {
+            throw e;
+        } catch (Exception e) {
+            System.err.println(e.toString());
+            e.printStackTrace();
+            return null;
+        } finally {
+            this.disconnect();
+        }
+    }
+    /**
+     * Returns all root partitions on this system. For example, on
+     * Windows, this would be the "Desktop" folder, while on DOS this
+     * would be the A: through Z: drives.
+     */
+    public File[] getRoots() {
+        try {
+            return new WebdavFile[] {this.homedir};
+        } catch (Exception e) {
+            System.err.println(e.toString());
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+    /**
+     * Returns true if the file (directory) can be visited.
+     * Returns false if the directory cannot be traversed.
+     *
+     * @param f the <code>File</code>
+     * @return <code>true</code> if the file/directory can be traversed,
+     *         otherwise <code>false</code>
+     * @see JFileChooser#isTraversable
+     * @see FileView#isTraversable
+     */
+    public Boolean isTraversable(File f) {
+        try {
+            //            System.out.println("isTraversable : " + f.getPath());
+            //            WebdavFile webdavFile = null;
+            //            this.connect();
+            //            webdavFile = (WebdavFile) f;
+            //            this.webdavResource.setHttpURL(new HttpURL(f.getPath()));
+            //            System.out.println(this.webdavResource.getPath() + " : collection : " + this.webdavResource.isCollection());
+            //            return Boolean.valueOf(this.webdavResource.isCollection());
+            return f.isDirectory() ? Boolean.TRUE : Boolean.FALSE;
+        } catch (Exception e) {
+            System.err.println(e.toString());
+            e.printStackTrace();
+            return Boolean.FALSE;
+        } finally {
+            this.disconnect();
+        }
+    }
+
+    /**
+     * Name of a file, directory, or folder as it would be displayed in
+     * a system file browser. Example from Windows: the "M:\" directory
+     * displays as "CD-ROM (M:)"
+     *
+     * The default implementation gets information from the ShellFolder
+     * class.
+     *
+     * @param f a <code>File</code> object
+     * @return the file name as it would be displayed by a native file
+     *         chooser
+     * @see JFileChooser#getName
+     */
+    public String getSystemDisplayName(File f) {
+        try {
+            //System.out.println("getSystemDisplayName : getName          : "
+                               //+ f.getName());
+            //System.out.println("getSystemDisplayName : getAbsolutePath  : "
+                               //+ f.getAbsolutePath());
+            //System.out.println("getSystemDisplayName : getCanonicalPath : "
+                               //+ f.getCanonicalPath());
+            //System.out.println("getSystemDisplayName : getPath          : "
+                               //+ f.getPath());
+            return f.getName();
+        } catch (Exception e) {
+            System.err.println(e.toString());
+            e.printStackTrace();
+            return null;
+        } finally {
+            this.disconnect();
+        }
+    }
+
+    /**
+     * Type description for a file, directory, or folder as it would be
+     * displayed in
+     * a system file browser. Example from Windows: the "Desktop" folder
+     * is desribed as "Desktop".
+     *
+     * Override for platforms with native ShellFolder implementations.
+     *
+     * @param f a <code>File</code> object
+     * @return the file type description as it would be displayed by a
+     *         native file chooser or null if no native information is
+     *         available.
+     * @see JFileChooser#getTypeDescription
+     */
+    public String getSystemTypeDescription(File f) {
+        return null;
+    }
+
+
+
+    /**
+     * Checks if <code>f</code> represents a real directory or file as
+     * opposed to a special folder such as <code>"Desktop"</code>. Used by UI
+     * classes to decide if a folder is selectable when doing directory
+     * choosing.
+     *
+     * @param f a <code>File</code> object
+     * @return <code>true</code> if <code>f</code> is a real file or directory.
+     */
+    public boolean isFileSystem(File f) {
+        return true;
+    }
+
+
+    /**
+     * Returns whether a file is hidden or not.
+     */
+    public boolean isHiddenFile(File f) {
+        return f.isHidden();
+    }
+
+
+    /**
+     * Is dir the root of a tree in the file system, such as a drive
+     * or partition. Example: Returns true for "C:\" on Windows 98.
+     *
+     * @param f a <code>File</code> object representing a directory
+     * @return <code>true</code> if <code>f</code> is a root of a filesystem
+     * @see #isRoot
+     */
+    public boolean isFileSystemRoot(File dir) {
+        try {
+            return (rootURL.getPath().equals(dir.getPath()));
+        }
+        catch (Exception e) {
+            System.err.println("isFileSystemRoot" + e.toString());
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * Used by UI classes to decide whether to display a special icon
+     * for drives or partitions, e.g. a "hard disk" icon.
+     *
+     * The default implementation has no way of knowing, so always returns
+     * false.
+     *
+     * @param dir a directory
+     * @return <code>false</code> always
+     */
+    public boolean isDrive(File dir) {
+        return false;
+    }
+
+    /**
+     * Used by UI classes to decide whether to display a special icon
+     * for a floppy disk. Implies isDrive(dir).
+     *
+     * The default implementation has no way of knowing, so always returns
+     * false.
+     *
+     * @param dir a directory
+     * @return <code>false</code> always
+     */
+    public boolean isFloppyDrive(File dir) {
+        return false;
+    }
+
+    /**
+     * Used by UI classes to decide whether to display a special icon
+     * for a computer node, e.g. "My Computer" or a network server.
+     *
+     * The default implementation has no way of knowing, so always returns
+     * false.
+     *
+     * @param dir a directory
+     * @return <code>false</code> always
+     */
+    public boolean isComputerNode(File dir) {
+        return false;
+    }
+
+    // Providing default implementations for the remaining methods
+    // because most OS file systems will likely be able to use this
+    // code. If a given OS can't, override these methods in its
+    // implementation.
+
+    public File getHomeDirectory() {
+        return this.homedir;
+    }
+
+    /**
+     * Return the user's default starting directory for the file chooser.
+     *
+     * @return a <code>File</code> object representing the default
+     *         starting folder
+     */
+    public File getDefaultDirectory() {
+        return this.homedir;
+    }
+
+
+    /**
+     * Gets the list of shown (i.e. not hidden) files.
+     */
+    public File[] getFiles(File dir, boolean useFileHiding) {
+        try {
+
+            String filenames[] = null;
+            WebdavFile files[] = null;
+            HttpURL url = null;
+            String path = null;
+            String localDir = null;
+
+            this.connect();
+            // Now we try to list files
+
+            path = dir.getPath();
+            //System.out.println("getFiles : RAW PATH : '" + path + "'");
+
+            // If path contains the server preamble, we need to extract that
+            // and have the path only
+            if (path.startsWith("http")) {
+                //System.out.println("getFiles : preample : " + this.uri);
+                path = path.replaceAll(this.uri, "");
+            }
+            if (!path.endsWith("/")) {
+                path = path + "/";
+            }
+
+            //System.out.println("getFiles : path : " + path);
+
+            this.webdavResource.setPath(path);
+            filenames = this.webdavResource.list();
+            files = new WebdavFile[filenames.length];
+            for (int i = 0; i < filenames.length; i++) {
+                //System.out.println("file : " + filenames[i]);
+                // Lets try to construct a uri from the dir
+                // given and the current file
+
+                localDir = dir.getPath();
+                if (!localDir.endsWith("/")) localDir = localDir + "/";
+
+                String filepath =  localDir + filenames[i];
+                //System.out.println("getFiles : file fullpath : " + filepath);
+                url = this.uriToHttpURL(filepath);
+                // Need to add user info so has access for queries
+                url.setUserinfo(username, password);
+                files[i] = new WebdavFile(url, this.rootURL);
+            }
+            return files;
+        } catch (Exception e) {
+            System.err.println(e.toString());
+            e.printStackTrace();
+            return null;
+        } finally {
+            this.disconnect();
+        }
+    }
+
+
+
+    /**
+     * Returns the parent directory of <code>dir</code>.
+     * @param dir the <code>File</code> being queried
+     * @return the parent directory of <code>dir</code>, or
+     *   <code>null</code> if <code>dir</code> is <code>null</code>
+     */
+    public File getParentDirectory(File dir) {
+        //System.out.println("dir : " + dir);
+        if (dir == null) {
+            return null;
+        } else if (dir.equals(this.homedir)) {
+            return this.homedir;
+        } else {
+            //System.out.println("getParentDirectory : calling getParentFile" + dir);
+            return dir.getParentFile();
+        }
+    }
+
+    /**
+     * Creates a new <code>File</code> object for <code>f</code> with
+     * correct behavior for a file system root directory.
+     *
+     * @param f a <code>File</code> object representing a file system root
+     *      directory, for example "/" on Unix or "C:\" on Windows.
+     * @return a new <code>File</code> object
+     */
+    protected File createFileSystemRoot(File f) {
+        try {
+            return new FileSystemRoot((WebdavFile) f);
+
+        } catch (Exception e) {
+            System.err.println("createFileSystemRoot : " + e.toString());
+            return null;
+        }
+    }
+
+    static class WebdavFile extends org.apache.webdav.lib.WebdavFile {
+        protected WebdavResource webdavResource = null;
+        protected HttpURL rootUrl = null;
+
+        public WebdavFile(HttpURL pathUrl, HttpURL rootUrl) throws
+            URIException, IOException {
+            super(pathUrl);
+            this.webdavResource = new WebdavResource(pathUrl);
+            this.rootUrl = rootUrl;
+        }
+
+
+        public String getName() {
+            String name = null;
+
+            // Get the base name
+            name = super.getName();
+
+            // If is a directory, we need to add a trailing slash
+            if (this.isDirectory()) {
+                name = name + "/";
+            }
+            return name;
+        }
+        public boolean isRoot() {
+            try {
+                String path = null;
+                String root = null;
+                root =  this.rootUrl.getPath();
+                path = this.webdavResource.getHttpURL().getPath();
+                //System.out.println("isRoot : root : " + root);
+                //System.out.println("isRoot : path : " + path);
+
+                // If we are at the root already
+                if (root .equalsIgnoreCase(path)) {
+                    //System.out.println("isRoot : we are at root");
+                    return true;
+                } else {
+                    // otherwise call original
+                    return false;
+                }
+            }
+            catch (Exception e) {
+                System.err.println(e.toString());
+                e.printStackTrace();
+                return false;
+            }
+        }
+        public String getParent() {
+            try {
+                // If we are at the root already
+                if (this.isRoot()) {
+                    //System.out.println("getParentFile : we are at root");
+                    return null;
+                } else {
+                    // otherwise call original
+                    String escapedPath =
+                        this.webdavResource.getHttpURL().getPath();
+                    String parent = escapedPath.substring(
+                        0, escapedPath.lastIndexOf('/', escapedPath.length() -
+                                                   2) + 1);
+                    //System.out.println("getParent : escapedPath : " + escapedPath);
+                    return super.getParent();
+                }
+            }
+            catch (Exception e) {
+                System.err.println(e.toString());
+                e.printStackTrace();
+                return null;
+            }
+        }
+        public File getParentFile() {
+            try {
+                HttpURL httpURL = null;
+                String parent = null;
+                parent = this.getParent();
+                if (parent == null) {
+                    //System.out.println("getParentFile : at root so return null");
+                    return null;
+                } else {
+                    httpURL = this.rootUrl;
+                    httpURL.setPath(parent);
+                    //System.out.println("getParentFile : set path to " + parent);
+                    return new WebdavFile(httpURL, this.rootUrl);
+                }
+            } catch (Exception e) {
+                System.err.println(e.toString());
+                e.printStackTrace();
+                return null;
+            }
+
+        }
+        public boolean exists() {
+            //System.out.println("exists : " + this.getPath());
+            return this.webdavResource.exists();
+        }
+        public boolean isDirectory() {
+            //System.out.println("isDirectory : " + this.getPath()  + " : " +
+                               //this.webdavResource.isCollection());
+            return this.webdavResource.isCollection();
+        }
+    }
+
+
+
+    static class FileSystemRoot extends WebdavFile {
+
+        public FileSystemRoot(HttpURL rootUrl) throws URIException,
+            IOException {
+            super(rootUrl, rootUrl);
+        }
+        public FileSystemRoot(WebdavFile webdavFile) throws URIException,
+            IOException {
+            super(webdavFile.rootUrl, webdavFile.rootUrl);
+        }
+
+    }
+
+    // Test code
+    public static void main(String args[]) throws Exception {
+        javax.swing.JFrame frame = new javax.swing.JFrame();
+
+        // Setup
+        javax.swing.JFileChooser fc = new javax.swing.JFileChooser(
+            new WebdavSystemView(
+                "http://localhost:8080", "/slide/files", "root", "root"));
+        fc.showOpenDialog(frame);
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/bin/lcp.bat
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/bin/lcp.bat	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/bin/lcp.bat	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,15 @@
+REM   Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
+REM   reserved.
+
+set _CLASSPATHCOMPONENT=%1
+if ""%1""=="""" goto gotAllArgs
+shift
+
+:argCheck
+if ""%1""=="""" goto gotAllArgs
+set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1
+shift
+goto argCheck
+
+:gotAllArgs
+set LOCALCLASSPATH=%_CLASSPATHCOMPONENT%;%LOCALCLASSPATH%

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/bin/run.bat
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/bin/run.bat	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/bin/run.bat	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,20 @@
+ at echo off
+rem ---------------------------------------------------------------------------
+rem run.bat - Start Script for the Slide Client
+rem
+rem $Id: run.bat,v 1.3 2004/03/31 09:42:00 ozeigermann Exp $
+rem ---------------------------------------------------------------------------
+
+set _SLIDE_CLIENT_HOME=%SLIDE_CLIENT_HOME%
+if "%_SLIDE_CLIENT_HOME%" == "" set _SLIDE_CLIENT_HOME=..
+
+rem add all jars from lib to classpath
+set LOCALCLASSPATH=%CLASSPATH%
+for %%i in ("%_SLIDE_CLIENT_HOME%\lib\*.jar") do call "%_SLIDE_CLIENT_HOME%\bin\lcp.bat" %%i
+
+set MAINCLASS=org.apache.webdav.cmd.Slide
+java -classpath "%LOCALCLASSPATH%" %MAINCLASS% %1 %2 %3 %4 %5 %6 %7 %8 %9
+
+set _SLIDE_CLIENT_HOME=
+set MAINCLASS=
+set LOCALCLASSPATH=

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/bin/run.sh
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/bin/run.sh	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/bin/run.sh	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,20 @@
+#!/bin/sh
+# ---------------------------------------------------------------------------
+# run.sh - Start Script for the Slide Client
+#
+# $Id: run.sh,v 1.2.2.1 2004/01/27 14:22:39 ozeigermann Exp $
+# ---------------------------------------------------------------------------
+
+SLIDE_CLIENT_HOME=`dirname $0`/..
+
+CP=${CLASSPATH}
+for lib in ${SLIDE_CLIENT_HOME}/lib/*.jar; do
+    CP=${CP}:${lib};
+done
+
+if [ -d ${SLIDE_CLIENT_HOME}/classes ] ; then
+    CP=${CP}:${SLIDE_CLIENT_HOME}/classes
+fi
+
+MAINCLASS=org.apache.webdav.cmd.Slide
+java -classpath ${CP} ${MAINCLASS} $*

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Client.g
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Client.g	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Client.g	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,1289 @@
+header 
+{
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/commandline/src/java/org/apache/webdav/cmd/Client.g,v 1.8 2004/07/05 15:23:55 ozeigermann Exp $
+ * $Revision: 1.8 $
+ * $Date: 2004/07/05 15:23:55 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.cmd;
+
+import java.io.*;
+import java.util.*;
+import org.apache.util.QName;
+import org.apache.webdav.lib.PropertyName;
+
+}
+
+// --------------------------------------------------- parser class definitions
+
+/**
+ * The Slide WebDAV client parser.
+ *
+ * @version     $Revision: 1.8 $ $Date: 2004/07/05 15:23:55 $
+ * @author      Dirk Verbeeck 
+ */
+class ClientParser extends Parser;
+
+// ------------------------------------------------------------ options section
+
+options {
+    k = 2;
+    exportVocab = Slide;            // call this vocabulary "Slide"
+    codeGenMakeSwitchThreshold = 2; // for debug or some optimizations
+    codeGenBitsetTestThreshold = 3;
+    defaultErrorHandler = false;    // abort parsing on error 
+    // TODO: use a tree-parser rule
+    // buildAST = true;                // build tree construction
+    buildAST = false;               // uses CommonAST by default
+}
+
+// ------------------------------------------------------------- tokens section
+
+// Java code
+{
+
+    // ------------------------------------------------------------- properties
+
+    /**
+     * The Slide WebDAV client.
+     */
+    protected Client client;
+    
+    // --------------------------------------------------------- helper methods
+
+    /**
+     * Set a client.
+     *
+     * @param client a client
+     */
+    void setClient(Client client) {
+        this.client = client;
+    }
+
+
+    /**
+     * Get the text from a token.
+     *
+     * @param token a token
+     * @return the token string
+     */
+    private String text(Token token) {
+        return (token != null) ? token.getText() : null;
+    }
+    
+
+    /**
+     * Get the qualified name from a token.
+     *
+     * @param token a token
+     * @return the qualified name
+     */
+    private QName qname(Token token) {
+        if (token == null) return null;
+
+        String tmp = token.getText();
+        if (!tmp.startsWith("<")) {
+            return new PropertyName("DAV:", text(token));
+        }
+        String namespaceURI = tmp.substring(tmp.indexOf('"') + 1,
+                tmp.lastIndexOf('"'));
+        String localName = tmp.substring(1, tmp.indexOf(' '));
+        
+        return new QName(namespaceURI, localName);
+    }
+
+    
+    /**
+     * Get the property name from a token.
+     *
+     * @param token a token
+     * @return the property name
+     */
+    private PropertyName pname(Token token) {
+        if (token == null) return null;
+
+        String tmp = token.getText();
+        if (!tmp.startsWith("<")) {
+            return new PropertyName("DAV:", text(token));
+        }
+
+        String namespaceURI = tmp.substring(tmp.indexOf('"') + 1,
+                tmp.lastIndexOf('"'));
+        String localName = tmp.substring(1, tmp.indexOf(' '));
+        
+        return new PropertyName(namespaceURI, localName);
+    }
+
+    
+    /**
+     * Print the usage for a given command.
+     *
+     * @param command a command
+     */
+    private void printUsage(String command)
+        throws RecognitionException, TokenStreamException {
+
+        client.printUsage(command);
+        skip(); // skip the rest of the line
+    }
+
+}
+
+// --------------------------------------------------------------- parser rules
+
+commands
+    :   {
+            client.prompt();
+        }
+        (   command
+            {
+                client.prompt();
+            }
+        )+
+    ;
+exception catch [ANTLRException ex] {
+    // XXX bad hack for bug #28100
+    if (ex.toString().indexOf("null") != -1) System.exit(-1);
+    // handle parse errors gracefully
+    client.print("Error: "+ex.toString());
+     }
+
+command
+    :   
+    ( exit
+    |   help
+    |   invalid
+    |   nothing
+    |   spool
+    |   run
+    |   echo
+    |   debug
+    |   status
+    |   optionsmethod
+    |   connect
+    |   disconnect
+    |   lpwd
+    |   lcd
+    |   lls
+    |   pwc
+    |   cd
+    |   ls
+    |   mkcol
+    |   move
+    |   copy
+    |   delete
+    |   get
+    |   put
+    |   propfind
+    |   propfindall
+    |   proppatch
+    |   lock
+    |   unlock
+    |   locks
+    |   grant
+    |   deny
+    |   revoke
+    |   acl
+    |   principalcollectionset
+    |   versioncontrol
+    |   report
+    |   ereport
+    |   lreport
+    |   mkws
+    |   checkin
+    |   checkout
+    |   uncheckout
+    |   update
+    |   begin
+    |   commit
+    |   abort
+    )
+    ;
+
+help
+    :   (   HELP
+        |   QUESTION
+        )
+        EOL
+        {
+            client.help(null);
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("help");
+    }
+         
+status
+    :   STATUS
+        EOL
+        {
+            client.status();
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("status");
+    }
+
+spool
+    :   SPOOL
+        (   file:STRING
+        |   OFF
+        )
+        EOL
+        {
+            if (file != null) {
+                client.enableSpoolToFile(text(file));
+            } else {
+                client.disableSpoolToFile();
+            }
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("spool");
+    }
+
+run
+    :   RUN
+        script:STRING
+        EOL
+        {
+            client.executeScript(text(script));
+        }
+    ;
+    exception catch [RecognitionException ex]
+    {
+        printUsage("run");
+    }
+
+echo
+    :   ECHO
+        {
+            boolean isEnabled;
+        }
+        (   ON
+            {
+                isEnabled = true;
+            }
+        |   OFF
+            {
+                isEnabled = true;
+            }
+        )
+        EOL
+        {
+            client.setEchoEnabled(isEnabled);
+        }
+    ;
+    exception catch [RecognitionException ex]
+    {
+        printUsage("echo");
+    }
+
+debug
+    :   {
+            int level;
+        }
+        DEBUG
+        (   ON
+            {
+                level = Client.DEBUG_ON;
+            }
+        |   OFF
+            {
+                level = Client.DEBUG_OFF;
+            }
+        )
+        EOL
+        {
+            client.setDebug(level);
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("debug");
+    }
+          
+optionsmethod
+    :   OPTIONS
+        path:STRING
+        EOL
+        {
+            client.options(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("options");
+    }
+
+connect
+    :   (   CONNECT
+        |   OPEN
+        )
+        uri:STRING
+        EOL
+        {
+            client.connect(text(uri));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("connect");
+    }
+
+disconnect
+    :   DISCONNECT
+        EOL
+        {
+            client.disconnect();
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("disconnect");
+    }
+
+lpwd
+    :   LPWD
+        EOL
+        {
+            client.lpwd();
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("lpwd");
+    }
+
+pwc
+    :   (   PWC
+        |   PWD
+        )
+        EOL
+        {
+            client.pwc();
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("pwc");
+    }
+
+lcd
+    :   LCD
+        path:STRING
+        EOL
+        {
+            client.lcd(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("lcd");
+    }
+
+cd
+    :   (   CD
+        |   CC
+        )
+        path:STRING
+        EOL
+        {
+            client.cd(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("cd");
+    }
+
+lls
+    :   (   LLS
+        |   LDIR
+        )
+        (option:OPTIONSTRING)?
+        (path:STRING)?
+        EOL
+        {
+            client.lls(text(option), text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+         printUsage("lls");
+    }
+
+ls
+    :   (   LS
+        |   DIR
+        )
+        (option:OPTIONSTRING)?
+        (path:STRING)?
+        EOL
+        {
+            client.ls(text(option), text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("ls");
+    }
+
+mkcol
+    :   (   MKCOL
+        |   MKDIR
+        )
+        path:STRING
+        EOL
+        {
+            client.mkcol(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("mkcol");
+    }
+
+move
+    :   MOVE
+        source:STRING
+        destination:STRING
+        EOL
+        {
+            client.move(text(source), text(destination));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("move");
+    }
+
+copy
+    :   COPY
+        source:STRING
+        destination:STRING
+        EOL
+        {
+            client.copy(text(source), text(destination));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("copy");
+    }
+
+delete
+    :   (   DELETE
+        |   DEL
+        |   RM
+        )
+        path:STRING
+        EOL
+        {
+            client.delete(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("delete");
+    }
+
+propfind
+    :   (   PROPFIND
+        |   PROPGET
+        )
+        path:STRING
+        {
+            Vector properties = new Vector();
+        }
+        (   prop:STRING
+            {
+                properties.add(pname(prop));
+            }
+        |   nsprop:QNAME
+            {
+                properties.add(pname(nsprop));
+            }
+        )+
+        EOL
+        {
+            client.propfind(text(path), properties);
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("propfind");
+    }
+
+propfindall
+    :   (   PROPFINDALL
+        |   PROPGETALL
+        )
+        (path:STRING)?
+        EOL
+        {
+            client.propfindall(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("propfindall");
+    }
+
+proppatch
+    :   (   PROPPATCH
+        |   PROPSET
+        )
+        path:STRING
+        prop:STRING
+        value:STRING
+        EOL
+        {
+            client.proppatch(text(path), text(prop), text(value));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("proppatch");
+    }
+
+get
+    :   GET
+        path:STRING
+        (file:STRING)?
+        EOL
+        {
+            client.get(text(path), text(file));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("get");
+    }
+
+put
+    :   PUT
+        file:STRING
+        (path:STRING)?
+        EOL
+        {
+            client.put(text(file), text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("put");
+    }
+
+begin : 
+  BEGIN  (timeout:STRING (owner:STRING)? )? EOL
+  {
+    client.beginTransaction(text(timeout), text(owner));
+  }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("begin");
+    }
+
+commit : 
+  COMMIT
+  {
+    client.commitTransaction();
+  }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("commit");
+    }
+
+abort : 
+  ABORT
+  {
+    client.abortTransaction();
+  }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("abort");
+    }
+
+lock
+    :   LOCK
+        (path:STRING)?
+        (os1:OPTIONSTRING
+          (os2:OPTIONSTRING
+            (os3:OPTIONSTRING)?
+           )?
+        )?
+        EOL
+        {
+
+	        String[] opt = {text(os1), text(os2), text(os3), null};
+	        
+	        int parNr[]  = {3, 3, 3};
+	        String err = null;
+	            
+	        for (int i = 0 ; i< opt.length ;i++) {
+	            
+	            if (opt[i] != null) {
+
+	                if ( opt[i].toLowerCase().startsWith("-t")) {
+	                    parNr[0] = i;
+	                } else
+
+	                if ( opt[i].toLowerCase().startsWith("-s")) {
+	                    parNr[1] = i;
+	                } else
+	                
+	                if ( opt[i].toLowerCase().startsWith("-o")) {
+	                    parNr[2] = i;
+	                } else {
+	                    err = "Wrong parameter: "+ opt[i];
+	                }
+	            }
+	        }
+       
+       		if (err == null)
+            	client.lock(text(path), opt[parNr[0]], opt[parNr[1]], opt[parNr[2]]);
+            else
+            	client.print(err); 	
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("lock");
+    }
+
+unlock
+    :   UNLOCK
+        (path:STRING)?
+        (os:OPTIONSTRING)?
+        EOL
+        {
+            String owner = text(os);
+            String err = null;
+        	
+        
+	        if ((owner != null) && (!owner.toLowerCase().startsWith("-o")) ) {
+                err = "Wrong parameter: "+ owner;
+            }
+            client.unlock(text(path), owner);
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("unlock");
+    }
+
+locks
+    :   LOCKS
+        (path:STRING)?
+        EOL
+        {
+            client.locks(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("locks");
+    }
+
+grant
+    :   GRANT
+        (   permission:STRING
+        |   nspermisssion:QNAME
+        )
+        (   ON
+        path:STRING)?
+        TO
+        principal:STRING
+        EOL
+        {
+            if (permission != null)
+                client.grant(text(permission), text(path), text(principal));
+            else
+                client.grant(qname(nspermisssion), text(path), text(principal));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        client.printUsage("grant");
+    }
+
+deny
+    :   DENY
+        (   permission:STRING
+        |   nspermisssion:QNAME)
+        (   ON
+            path:STRING
+        )?
+        TO
+        principal:STRING
+        EOL
+        {
+            if (permission != null)
+                client.deny(text(permission), text(path), text(principal));
+            else
+                client.deny(qname(nspermisssion), text(path), text(principal));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        client.printUsage("deny");
+    }
+
+revoke
+    :   REVOKE
+        (   permission:STRING
+        |   nspermisssion:QNAME
+        )
+        (   ON
+            path:STRING
+        )?
+        FROM
+        principal:STRING
+        EOL
+        {
+            if (permission != null)
+                client.revoke(text(permission), text(path), text(principal));
+            else
+                client.revoke(qname(nspermisssion), text(path),
+                        text(principal));
+            }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        client.printUsage("revoke");
+    }
+
+acl
+    :   ACL
+        (path:STRING)?
+        EOL
+        {
+            client.acl(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("acl");
+    }
+
+principalcollectionset
+    :   PRINCIPALCOLLECTIONSET
+        (path:STRING)?
+        EOL
+        {
+            client.principalcollectionset(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("principalcollectionset");
+    }
+
+versioncontrol
+    :   VERSIONCONTROL
+        (target:STRING)?
+        path:STRING
+        EOL
+        {
+            if (target == null)
+                client.versioncontrol(text(path));
+            else
+                client.versioncontrol(text(target), text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("versioncontrol");
+    }
+
+
+update
+    :   UPDATE
+        path:STRING
+        target:STRING
+        EOL
+        {
+            client.update(text(path), text(target));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("update <path> <historyURL>");
+    }
+
+
+
+
+checkin
+    :   CHECKIN
+        path:STRING
+        EOL
+        {
+            client.checkin(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("checkin");
+    }
+
+checkout
+    :   CHECKOUT
+        path:STRING
+        EOL
+        {
+            client.checkout(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("checkout");
+    }
+
+uncheckout
+    :   UNCHECKOUT
+        path:STRING
+        EOL
+        {
+            client.uncheckout(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("uncheckout");
+    }
+
+report
+    :   REPORT
+        path:STRING
+        {
+            Vector properties = new Vector();
+        }
+        (   prop:STRING
+            {
+                properties.add(pname(prop));
+            }
+        |   nsprop:QNAME
+            {
+                properties.add(pname(nsprop)); }
+        )?
+        EOL
+        {
+            client.report(text(path), properties);
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("report");
+    }
+
+ereport
+    :   EREPORT
+        path:STRING
+        (filename:STRING)?
+        EOL
+        {
+            client.ereport(text(path), text(filename));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("ereport");
+    }
+
+lreport
+    :   LREPORT
+        path:STRING
+        {
+            Vector properties = new Vector();
+        }
+        (   prop:STRING
+            {
+                properties.add(pname(prop));
+            }
+        |   nsprop:QNAME
+            {
+                properties.add(pname(nsprop));
+            }
+        )+
+        ON
+        {
+            Vector historyUris = new Vector();
+        }
+        (   uri:STRING
+            {
+                historyUris.add(text(uri));
+            }
+        )+
+        EOL
+        {
+            client.lreport(text(path), properties, historyUris);
+        } 
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("lreport");
+    }
+
+mkws
+    :   MKWS
+        path:STRING
+        EOL
+        {
+            client.mkws(text(path));
+        }
+    ;
+    exception
+    catch [RecognitionException ex]
+    {
+        printUsage("mkws");
+    }
+
+exit
+    :   (   EXIT
+        |   QUIT
+        |   BYE
+        )
+        EOL
+        {
+            System.exit(0);
+        }
+    ;
+
+invalid
+    :   cmd:STRING (STRING)* EOL
+        {
+            client.printInvalidCommand(text(cmd));
+        }
+    ;
+
+nothing
+    :   EOL
+    ;
+
+skip
+    :   (   STRING
+        |   all_tokens
+        )*
+        EOL
+        { /* skip all */ }
+    ;
+
+all_tokens
+    :   EXIT
+    |   QUIT
+    |   BYE
+    |   HELP
+    |   QUESTION
+    |   RUN
+    |   SPOOL
+    |   STATUS
+    |   ECHO
+    |   ON
+    |   OFF
+    |   SET
+    |   DEBUG
+    |   OPTIONS
+    |   OPEN
+    |   CONNECT
+    |   CLOSE
+    |   DISCONNECT
+    |   LPWD
+    |   LCD
+    |   LLS
+    |   LDIR
+    |   PWC
+    |   PWD
+    |   CC
+    |   CD
+    |   LS
+    |   DIR
+    |   GET
+    |   PUT
+    |   MKCOL
+    |   MKDIR
+    |   DELETE
+    |   DEL
+    |   RM
+    |   COPY
+    |   CP
+    |   MOVE
+    |   MV
+    |   LOCK
+    |   UNLOCK
+    |   LOCKS
+    |   PROPGET
+    |   PROPFIND
+    |   PROPGETALL
+    |   PROPFINDALL
+    |   PROPPUT
+    |   PROPPATCH
+    |   ACL
+    |   PRINCIPALCOL
+    |   GRANT
+    |   DENY
+    |   REVOKE
+    |   TO
+    |   FROM
+    |   PRINCIPALCOLLECTIONSET
+    |   VERSIONCONTROL
+    |   REPORT
+    |   EREPORT
+    |   LREPORT
+    |   MKWS
+    |   CHECKIN
+    |   CHECKOUT
+    |   UNCHECKOUT
+    |   UPDATE
+    |   BEGIN
+    |   COMMIT
+    |   ABORT
+    ;
+
+// ----------------------------------------- lexical analyzer class definitions
+
+/**
+ * The Slide WebDAV client scanner.
+ *
+ * @version     $Revision: 1.8 $ $Date: 2004/07/05 15:23:55 $
+ * @author      Dirk Verbeeck 
+ */
+class ClientLexer extends Lexer;
+
+// ------------------------------------------------------------ options section
+
+options {
+    k = 2;
+    caseSensitiveLiterals = false;
+    charVocabulary = '\u0003'..'\uFFFF';
+}
+
+// ------------------------------------------------------------- tokens section
+
+tokens {
+    EXIT                    = "exit";
+    QUIT                    = "quit";
+    BYE                     = "bye";
+    HELP                    = "help";
+    STATUS                  = "status";
+    RUN                     = "run";
+    SPOOL                   = "spool";
+    ECHO                    = "echo";
+    ON                      = "on";
+    OFF                     = "off";
+    SET                     = "set";
+    DEBUG                   = "debug";
+                            
+    OPTIONS                 = "options";
+    OPEN                    = "open";
+    CONNECT                 = "connect";
+    CLOSE                   = "close";
+    DISCONNECT              = "disconnect";
+    LPWD                    = "lpwd";
+    LCD                     = "lcd";
+    LLS                     = "lls";
+    LDIR                    = "ldir";
+    PWC                     = "pwc";
+    PWD                     = "pwd";
+    CC                      = "cc";
+    CD                      = "cd";
+    LS                      = "ls";
+    DIR                     = "dir";
+    GET                     = "get";
+    PUT                     = "put";
+    MKCOL                   = "mkcol";
+    MKDIR                   = "mkdir";
+    DELETE                  = "delete";
+    DEL                     = "del";
+    RM                      = "rm";
+    COPY                    = "copy";
+    CP                      = "cp";
+    MOVE                    = "move";
+    MV                      = "mv";
+    LOCK                    = "lock";
+    UNLOCK                  = "unlock";
+    LOCKS                   = "locks";
+    PROPGET                 = "propget";
+    PROPFIND                = "propfind";
+    PROPGETALL              = "propgetall";
+    PROPFINDALL             = "propfindall";
+    PROPPUT                 = "propput";
+    PROPPATCH               = "proppatch";
+    ACL                     = "acl";
+    PRINCIPALCOL            = "principalcol";
+    GRANT                   = "grant";
+    DENY                    = "deny";
+    REVOKE                  = "revoke";
+    TO                      = "to";
+    FROM                    = "from";
+    PRINCIPALCOLLECTIONSET  = "principalcollectionset";
+    VERSIONCONTROL          = "versioncontrol";
+    REPORT                  = "report";
+    EREPORT                 = "ereport";
+    LREPORT                 = "lreport";
+    MKWS                    = "mkws";
+    CHECKIN                 = "checkin";
+    CHECKOUT                = "checkout";
+    UNCHECKOUT              = "uncheckout";
+    UPDATE                  = "update";
+    BEGIN                   = "begin";
+    COMMIT                  = "commit";
+    ABORT                   = "abort";
+}
+
+// ---------------------------------------------------------------- lexer rules
+
+WS
+    :   (   ' '
+        |   '\t'
+        )
+        {
+            _ttype = Token.SKIP;
+        }
+    ;
+
+EOL     // the end of line
+    :   "\r\n"    // DOS
+    |   '\r'      // MAC
+    |   '\n'      // UN*X
+    ;
+
+OPTIONSTRING
+    : '-' (CHARS)+
+    ;
+
+
+
+//  Backslashes are accepted by CHARS,
+//  but STRING replace them into slashes !!
+STRING
+    :   ( CHARS (CHARS | '-')*
+        | '"'! ( ~'"' )* '"'!
+        )
+     { String txt = $getText;
+       txt = txt.replace('\\', '/');
+       $setText(txt);
+     }
+    ;
+
+protected        
+CHARS
+    :   'a'..'z'
+    |   'A'..'Z'
+    |   '0'..'9'
+    |   '.'
+    |   ':'
+    |   '/'
+    |   '$'
+    |   '#'
+    |   '%'
+    |   '&'
+    |   '('
+    |   ')'
+    |   '!'
+    |   '+'
+    |   '\\'
+    |   '_'
+    ;
+
+QNAME
+    :   '<' STRING " xmlns=\"" STRING "\">"
+    ;
+
+protected
+ALPHANUM
+    :   ALPHA
+    |   DIGIT
+    ;
+
+protected
+ALPHA
+    :   LOWALPHA
+    |   UPALPHA
+    ;
+
+protected
+LOWALPHA
+    :   'a'..'z'
+    ;
+
+protected
+UPALPHA
+    :   'A'..'Z'
+    ;
+
+protected
+DIGIT
+    :   '0'..'9'
+    ;
+
+QUESTION
+    :   '?'
+    ;
+

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Client.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Client.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Client.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,2186 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/commandline/src/java/org/apache/webdav/cmd/Client.java,v 1.21.2.2 2004/10/02 17:39:11 luetzkendorf Exp $
+ * $Revision: 1.21.2.2 $
+ * $Date: 2004/10/02 17:39:11 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.cmd;
+
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.HttpsURL;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.util.URIUtil;
+import org.apache.webdav.lib.Ace;
+import org.apache.webdav.lib.Lock;
+import org.apache.webdav.lib.Privilege;
+import org.apache.webdav.lib.Property;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.ResponseEntity;
+import org.apache.webdav.lib.WebdavResource;
+import org.apache.webdav.lib.methods.DepthSupport;
+import org.apache.webdav.lib.methods.LockMethod;
+import org.apache.webdav.lib.properties.AclProperty;
+import org.apache.webdav.lib.properties.LockDiscoveryProperty;
+import org.apache.webdav.lib.properties.PrincipalCollectionSetProperty;
+import org.apache.webdav.lib.properties.ResourceTypeProperty;
+import org.apache.webdav.lib.util.QName;
+
+
+/**
+ * The Slide client, the command line version for WebDAV client.
+ *
+ */
+final class Client {
+
+
+    private Spool spool;
+    private InputStream in;
+    private PrintStream out;
+    private boolean displayPrompt = true;
+
+    /** The path for the display information. */
+    private String path = "";
+
+    /** The command prompt for the display information. */
+    private String commandPrompt = null;
+
+    /** The http URL on the client connection. */
+    private HttpURL httpURL;
+
+    /** The debug level. */
+    private int debugLevel = DEBUG_OFF;
+
+    /** The WebDAV resource. */
+    private WebdavResource webdavResource = null;
+
+    /** The current path on the local system. */
+    private File dir = new File(".");
+
+    /////////////////////////////////////////////////////////////////
+
+    Client(InputStream in, PrintStream out)
+    {
+        this.spool = new Spool(in,out);
+        this.in  = in;
+        this.out = new PrintStream(spool.getOutputStream());
+        updatePrompt(getPath());
+    }
+
+    void run()
+    {
+       while(true) {
+          try {
+             InputStream in=spool.getInputStream();
+             ClientLexer lexer = new ClientLexer(new DataInputStream(in));
+             ClientParser parser = new ClientParser(lexer);
+             parser.setClient(this);
+             parser.commands();
+          }
+          catch(TokenStreamException ex) {
+             handleException(ex);
+          }
+          catch(RecognitionException ex) {
+             handleException(ex);
+          }
+       }
+       // TODO test EOF  ???
+    }
+
+    ///////////////////////////////////////////////////////////////////
+    // Helper funtions for the parser and error handlers
+    ///////////////////////////////////////////////////////////////////
+
+    void printInvalidCommand(String command)
+    {
+        out.println("Error: invalid command: " + command);
+    }
+
+    void printUsage(String command)
+    {
+        out.println("Syntax error. \"help\" for more info");
+//        out.println("Usage: " + command + " ...");
+//        out.println
+//            ("[Help] open " +
+//             "http://hostname[:port][/path]");
+//        out.println("Syntax: grant <namespace> <permission> on <path> to <principal>");
+//        out.println("Syntax: revoke <namespace> <permission> on <path> from <principal>");
+//        out.println("Syntax: deny <namespace> <permission> on <path> to <principal>");
+//        out.println("Syntax: lock <path>");
+//        out.println("Syntax: unlock <path>");
+//    out.println("Syntax: vc/VersionControl <path>");
+//        else out.println("Syntax: eReport path");
+//        else out.println("Syntax: lReport <property> \n History URLs are needed");
+
+    }
+
+    void prompt()
+    {
+        if (displayPrompt)
+            out.print(getPrompt());
+    }
+
+   void print(String line) {
+      out.println(line);
+   }
+
+    private void handleException(Exception ex)
+    {
+        if (ex instanceof HttpException) {
+            if (((HttpException) ex).getReasonCode() == HttpStatus.SC_METHOD_NOT_ALLOWED) {
+                out.println("Warning: Not WebDAV-enabled?");
+            }
+            else if (((HttpException) ex).getReasonCode() == HttpStatus.SC_UNAUTHORIZED) {
+                out.println("Warning: Unauthorized");
+            }
+            else {
+                out.println("Warning: " + ex.getMessage());
+            }
+        }
+        else if (ex instanceof IOException) {
+            out.println("Error: " + ex.getMessage());
+        }
+        else {
+            out.println("Fatal Error: " + ex.getMessage());
+            ex.printStackTrace(out);
+            out.println("Please, email to slide-user at jakarta.apache.org");
+            System.exit(-1);
+        }
+    }
+
+    /////////////////////////////////////////////////////////////////
+    // Commands available on the command line
+    /////////////////////////////////////////////////////////////////
+
+    void setEchoEnabled(boolean isEnabled)
+    {
+        spool.setEcho(isEnabled);
+        setDisplayPrompt(isEnabled);
+
+        // if this is an interactive client keep the prompt
+        if (this.in==System.in)
+            setDisplayPrompt(true);
+    }
+
+    void executeScript(String scriptname)
+    {
+        try {
+            FileInputStream script = new FileInputStream(scriptname);
+            Client scriptClient = new Client(script,out);
+            scriptClient.setDisplayPrompt(false);
+            out.println("Executing script: " + scriptname);
+            scriptClient.run();
+            out.println("Script " + scriptname + " complete.");
+            script.close();
+        }
+        catch (FileNotFoundException ex) {
+            out.println("Error: Script " + scriptname + " not found.");
+        }
+        catch (IOException ex) {
+            out.println("Error: " + ex.toString() + " during execution of " + scriptname);
+        }
+    }
+
+    void enableSpoolToFile(String filename)
+    {
+        out.println("Spool to file: " + filename);
+        try {
+            spool.enable(filename);
+        }
+        catch (FileNotFoundException ex) {
+            out.println("Error: Could not spool to file: " + filename);
+            disableSpoolToFile();
+        }
+    }
+
+    void disableSpoolToFile()
+    {
+        spool.disable();
+        out.println("Spooling disabled");
+    }
+
+
+    /** Debug level for all debug messages */
+    final static int DEBUG_ON  = Integer.MAX_VALUE;
+
+    /** Debug level for no debug messages */
+    final static int DEBUG_OFF = 0;
+
+    /**
+     * Set the debug level
+     */
+    void setDebug(int level)
+    {
+        this.debugLevel=level;
+        if (webdavResource != null) webdavResource.setDebug(debugLevel);
+
+        switch (level) {
+            case DEBUG_ON:  out.println("The debug flag is on.");  break;
+            case DEBUG_OFF: out.println("The debug flag is off."); break;
+            default: out.println("The debug level is " + level); break;
+        }
+    }
+
+    void connect(String uri)
+    {
+                
+        if (!uri.endsWith("/") && !uri.endsWith("\\")) {
+            // append / to the path
+             uri+="/";
+        }
+
+        out.println("connect " + uri);
+
+        try {
+            // Set up for processing WebDAV resources
+            httpURL = uriToHttpURL(uri);
+            if (webdavResource == null) {
+                webdavResource = new WebdavResource(httpURL);
+                webdavResource.setDebug(debugLevel);
+                
+                // is not a collection?
+                if (!((ResourceTypeProperty)webdavResource.getResourceType()).isCollection()) {
+                    webdavResource = null;
+                    httpURL = null;
+                    out.println("Error: " + uri + " is not a collection! Use open/connect only for collections!");
+                }
+                
+            } else {
+                webdavResource.close();
+                webdavResource.setHttpURL(httpURL);
+            }
+            setPath(webdavResource.getPath());
+        }
+        catch (HttpException we) {
+            out.print("HttpException.getReasonCode(): "+ we.getReasonCode());
+            if (we.getReasonCode() == HttpStatus.SC_UNAUTHORIZED) {
+                try {
+                    out.print("UserName: ");
+                    BufferedReader in =
+                        new BufferedReader(new InputStreamReader(System.in));
+                    String userName = in.readLine();
+                    if ((userName==null) || (userName.length()==0)) {
+                        disconnect();
+                        return;
+                    }
+                    userName = userName.trim();
+                    System.out.print("Password: ");
+                    String password = in.readLine();
+                    if (password != null)
+                        password= password.trim();
+                    try {
+                        if (webdavResource != null)
+                            webdavResource.close();
+                    } catch (IOException e) {
+                    } finally {
+                        httpURL = null;
+                        webdavResource = null;
+                    }
+                    httpURL = uriToHttpURL(uri);
+                    // It should be used like this way.
+                    httpURL.setUserinfo(userName, password);
+                    webdavResource = new WebdavResource(httpURL);
+                    webdavResource.setDebug(debugLevel);
+                    setPath(webdavResource.getPath());
+
+
+                    if (!((ResourceTypeProperty)webdavResource.getResourceType()).isCollection()) {
+                        webdavResource = null;
+                        httpURL = null;
+                        out.println("Error: " + uri + " is not a collection! Use open/connect only for collections!");
+                    }
+                }
+                catch (Exception ex) {
+                    handleException(ex);
+                    httpURL = null;
+                    webdavResource = null;
+                }
+            }
+            else  {
+                handleException(we);
+                httpURL = null;
+                webdavResource = null;
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+            webdavResource = null;
+            httpURL = null;
+        }
+        updatePrompt(getPath());
+    }
+
+    void disconnect()
+    {
+        out.println("disconnect");
+        try {
+            webdavResource.close();
+        } catch (IOException e) {
+        } finally {
+            // Make sure the connection closed.
+            httpURL = null;
+            webdavResource = null;
+        }
+        updatePrompt(getPath());
+    }
+
+    void options(String path)
+    {
+        out.println("options " + path);
+
+        String param = path;
+        try {
+            boolean succeeded = false;
+            if (param != null) {
+                if (!param.startsWith("/")) {
+                    httpURL = uriToHttpURL(param);
+                    Enumeration enum = null;
+                    try {
+                        // OPTIONS business logic
+                        enum =
+                            webdavResource.optionsMethod(httpURL);
+                        while (enum.hasMoreElements()) {
+                            out.print(enum.nextElement());
+                            if (enum.hasMoreElements()) {
+                                out.print(", ");
+                            } else {
+                                out.println();
+                            }
+                        }
+                    } catch (HttpException we) {
+                        if (we.getReasonCode() ==
+                            HttpStatus.SC_UNAUTHORIZED) {
+                            BufferedReader in =
+                                new BufferedReader(new InputStreamReader(System.in));
+                            out.print("UserName: ");
+                            String userName = in.readLine();
+                            if (userName != null &&
+                                userName.length() > 0) {
+                                userName = userName.trim();
+                                out.print("Password: ");
+                                String password = in.readLine();
+                                if (password != null)
+                                    password= password.trim();
+                                try {
+                                    // OPTIONS business logic
+                                    httpURL.setUserinfo(userName,
+                                        password);
+                                    enum = webdavResource.
+                                        optionsMethod(httpURL);
+                                    while (
+                                        enum.hasMoreElements()) {
+                                        out.print
+                                            (enum.nextElement());
+                                        if (enum.
+                                            hasMoreElements()) {
+                                            out.print
+                                                (", ");
+                                        } else {
+                                            out.println();
+                                        }
+                                    }
+                                } catch (Exception e) {
+                                    out.println("Error: "
+                                        + e.getMessage());
+                                }
+                            }
+                        } else {
+                            out.println("Error: " +
+                                    we.getMessage());
+                        }
+                    } catch (IOException e) {
+                        out.println(
+                            "Error: Check! " + e.getMessage());
+                    }
+                    httpURL = null;
+                    return;
+                } else
+                if (webdavResource != null) {
+                    succeeded =
+                        webdavResource.optionsMethod(param);
+                } else {
+                    out.println("Not connected yet.");
+                }
+            } else
+            if (webdavResource != null) {
+                succeeded = webdavResource.optionsMethod("*");
+            } else {
+                out.println("Not connected yet.");
+            }
+
+            if (succeeded) {
+                out.print
+                    ("Allowed methods by http OPTIONS: ");
+                Enumeration allowed =
+                    webdavResource.getAllowedMethods();
+                while (allowed.hasMoreElements()) {
+                    out.print(allowed.nextElement());
+                    if (allowed.hasMoreElements())
+                        out.print(", ");
+                 }
+                Enumeration davCapabilities =
+                    webdavResource.getDavCapabilities();
+                if (davCapabilities.hasMoreElements())
+                    out.print("\nDAV: ");
+                while (davCapabilities.hasMoreElements()) {
+                    out.print
+                        (davCapabilities.nextElement());
+                    if (davCapabilities.hasMoreElements())
+                        out.print(", ");
+                }
+                out.println();
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void help(String topic)
+    {
+        if (topic==null) {
+            printSlideClientUsage();
+        }
+        else {
+            out.println("No help available on " + topic);
+        }
+    }
+
+    void lpwd()
+    {
+        try {
+            out.println(dir.getCanonicalPath());
+        }
+        catch (IOException ex) {
+            out.println("Warning: Not found the path");
+        }
+    }
+    
+    private File getFileByPath(String path) {
+        
+        if (path != null) {
+             // set a new file if '\' or '/' at the begin of path 
+             // or ':' at the 2nd position of path exists.
+             // if not: take the old parent entry of file and add a '/' to path.
+             return(path.startsWith("/") ||
+                    path.startsWith("\\") || 
+                  ((path.length() > 1) && (path.charAt(1) == ':'))  ) ?
+                    new File(path) :
+                    new File(dir, "/"+path);
+         } else {
+             return dir;    
+         }    
+  
+    }
+
+
+    void lcd(String path)
+    {
+        File anotherDir = getFileByPath(path); 
+                   
+        if (anotherDir.isDirectory()) {
+            dir = anotherDir;
+        } else {
+            out.println("Warning: path not found!");
+        }
+        
+        updatePrompt(getPath());
+
+    }
+    
+   
+
+    void lls(String options, String path)
+    {
+        // set default option.
+        char option = 'F';
+        if ((options!=null) && (options.indexOf('l') > 0))
+            option = 'l';
+    
+        File temp = getFileByPath(path); 
+        
+
+       if (!temp.exists() || !temp.isDirectory()) {
+           out.println("Warning: path not found!");
+           return;
+        }
+
+        String[] list = temp.list();
+        // TODO: consider of options like '-a' for all and so on.
+        switch (option) {
+        case 'l':
+            for (int i = 0; i < list.length; i++) {
+                String s = list[i];
+                File file = new File(temp, s);
+                for (int j = 0; j < 4; j++) {
+                    switch (j)  {
+                        case 0:
+                            // Print the filename.
+                            out.print(s);
+                            for (int k = list[i].length();
+                                k < 35; k++)
+                                out.print(" ");
+                            break;
+                        case 1:
+                            s = Long.toString(file.length());
+                            for (int k = 10 - s.length();
+                                k > 0 ; k--)
+                                out.print(" ");
+                            // don't cut the size.
+                            out.print(s + " ");
+                            break;
+                        case 2:
+                            // cut the description.
+                            s = file.isDirectory() ?
+                                "DIR" : "";
+                            out.print(" " +
+                                ((s.length() > 5) ?
+                                s.substring(0, 5) : s));
+                            for (int k = s.length(); k < 5; k++)
+                                out.print(" ");
+                            break;
+                        case 3:
+                            s = new SimpleDateFormat().format(
+                                new Date(file.lastModified()));
+                            out.print(" " + s);
+                        default:
+                    }
+                }
+                // Start with a new line.
+                out.println();
+            }
+            break;
+        case 'F':
+            int i = 0;
+            for (; i < list.length; i++) {
+                out.print(list[i] + " ");
+                for (int j = list[i].length();
+                    j < 25; j++) {
+                    out.print(" ");
+                }
+                if (i % 3 == 2)
+                   out.println();
+            }
+            if (list.length > 0 && i % 3 != 0) {
+                out.println();
+            }
+            break;
+        default:
+        } // end of switch
+
+    }
+
+    void pwc()
+    {
+        out.println(getPath());
+    }
+
+    void cd(String path)
+    {
+    	String currentPath = webdavResource.getPath();
+    	
+        try {
+            String cdPath = checkUri(path + "/");
+            webdavResource.setPath(cdPath);
+            
+            if (webdavResource.exists()) {
+                if (webdavResource.isCollection()) {
+                    setPath(webdavResource.getPath());
+                } else {
+                    out.println("Warning: Not a collection");
+                    webdavResource.setPath(currentPath);
+                }
+            } else {
+                out.println("Warning: Not found the path");
+                webdavResource.setPath(currentPath);
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+            try {
+                webdavResource.setPath(currentPath);    
+            } catch (Exception e) {
+                handleException(e);
+            }
+
+        }
+
+        updatePrompt(getPath());
+    }
+
+    void ls(String options, String path)
+    {
+        // set default option.
+        char option = 'F';
+        if ((options!=null) && (options.indexOf('l') > 0))
+            option = 'l';
+
+        try {
+            // Check that the path is ok.
+            if (path != null) {
+                path = checkUri(path + "/");
+                webdavResource.setPath(path);
+            } else {
+                path = checkUri("./");
+                webdavResource.setPath(path);
+            }
+            switch (option) {
+                
+            case 'l':
+
+                Vector basiclist = webdavResource.listBasic();
+                for (int i = 0; i < basiclist.size(); i++) {
+                    String[] longFormat =
+                        (String []) basiclist.elementAt(i);
+                        
+                        // name -> position 4
+                        String s = longFormat[4];
+                        int len = s.length();
+                        out.print(s);
+                        for (int k = len; k < 20; k++)
+                            out.print(" ");
+                        
+
+                        // size -> position 1            
+                        s = longFormat[1];
+                        len = s.length();
+                        for (int k = 10 - len;
+                            k > 0 ; k--)
+                            out.print(" ");
+                        // don't cut the size.
+                        out.print(s + " ");
+                                
+                                
+                        // description   -> position 2                                
+                        // cut the description.
+                        s = longFormat[2];
+                        len = s.length();
+
+                        out.print(" " +
+                            ((len > 20) ?
+                            s.substring(0, 20) : s));
+                        for (int k = len; k < 20; k++)
+                            out.print(" ");
+                            
+                        // date -> position 3                            
+                        s = longFormat[3];
+                        len = s.length();
+                        out.println(" " + s);
+                    }
+                    
+                    
+                
+                break;
+                
+                
+            case 'F':
+                String[] list = webdavResource.list();
+                if (list != null) {
+                    int i = 0;
+                    for (; i < list.length; i++) {
+                        out.print(list[i] + " ");
+                        for (int j = list[i].length(); j < 25; j++) {
+                            out.print(" ");
+                        }
+                        if (i % 3 == 2)
+                           out.println();
+                    }
+                    if (list.length > 0 && i % 3 != 0)
+                        out.println();
+                }
+                break;
+            default:
+            } // end of switch
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void propfind(String path, Vector properties)
+    {
+        try {
+            path = checkUri(path);
+            out.print("Getting properties '" + path + "': ");
+
+            Enumeration propertyValues =
+                webdavResource.propfindMethod(path, properties);
+            if (propertyValues.hasMoreElements()){
+                while (propertyValues.hasMoreElements()){
+                    out.println(propertyValues.nextElement());
+                }
+            }
+            else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void status()
+    {
+      out.println(webdavResource.getStatusMessage());
+    }
+
+    void propfindall(String path)
+    {
+        try {
+            path=checkUri(path);
+            out.print("Getting properties '" + path + "': ");
+            Enumeration responses = webdavResource.propfindMethod(path, DepthSupport.DEPTH_0);
+            if (!responses.hasMoreElements()) {
+                out.println("failed (no response received).");
+                out.println(webdavResource.getStatusMessage());
+                return;
+            }
+            else {
+                out.println();
+            }
+            ResponseEntity response = (ResponseEntity) responses.nextElement();
+            Enumeration properties = response.getProperties();
+            while (properties.hasMoreElements()){
+                Property property = (Property)properties.nextElement();
+                out.println("   " + property.getName() + " : " + property.getPropertyAsString());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void proppatch(String path, String prop, String value)
+    {
+        String name=prop;
+        try {
+            path=checkUri(path);
+            out.print("Putting property(" + name + ", " + value +
+                ") to '" + path + "': ");
+            if (webdavResource.proppatchMethod(
+                path, new PropertyName("DAV:",name), value, true)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+    
+    String getLocalTragetFileName(String path, String filename) {
+        
+        String srcFileName = null;
+        String tarFileName = null;
+ 
+
+        // get traget filename from last portion of path
+        StringTokenizer st = new StringTokenizer(path, "/\\");
+        while (st.hasMoreTokens()) {
+            srcFileName = st.nextToken();
+        }
+                
+        File targetFile = getFileByPath((filename != null) ? filename : srcFileName); 
+        
+        try {           
+            if (targetFile.isDirectory()) {
+                tarFileName = targetFile.getCanonicalPath() + "/"+ srcFileName;    
+            } else {
+                tarFileName = targetFile.getCanonicalPath();    
+            }         
+        } catch (IOException e) {
+            System.err.println(e.toString());
+            return null;
+        }           
+
+        return tarFileName;
+    }
+
+    void get(String path, String filename)
+    {
+        
+        filename = getLocalTragetFileName( path,  filename);
+        
+        try {
+            // The resource on the remote.
+            String src = checkUri(path);
+            // The file on the local.
+            String dest = (filename!=null)
+                ? filename
+                : URIUtil.getName(src.endsWith("/")
+                                  ? src.substring(0, src.length() - 1)
+                                  : src);
+
+            out.println("get " + src + " " + dest);
+
+            // For the overwrite operation;
+            String y = "y";
+            File file = new File(dest);
+            // Checking the local file.
+            if (file.exists()) {
+
+                // FIXME: interactive ?
+                out.print("Aleady exists. " +
+                    "Do you want to overwrite it(y/n)? ");
+                BufferedReader in =
+                    new BufferedReader(new InputStreamReader(System.in));
+                y = in.readLine();
+            }
+            if (y.trim().equalsIgnoreCase("y") ||
+                (y != null && y.length() == 0)) {
+                out.print("Downloading  '" + src +
+                    "' to '" + dest + "': ");
+                if (webdavResource.getMethod(src, file)) {
+                    out.println("succeeded.");
+                } else {
+                    out.println("failed.");
+                    out.println(webdavResource.getStatusMessage());
+                }
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+    
+    String getRemoteTragetFileName(String filename, String path) {
+        
+        String srcPathName = null;
+        String target = null;
+       
+ 
+
+        // get traget filename from last portion of filename
+        StringTokenizer st = new StringTokenizer(filename, "/\\");
+        while (st.hasMoreTokens()) {
+            srcPathName = st.nextToken();
+        }
+        
+        
+        try {
+                
+            if (path != null) {
+                target = checkUri(path);
+                
+                // check is path a collection ?
+                String currentPath = webdavResource.getPath();
+                
+                webdavResource.setPath(target);
+                
+                if (webdavResource.exists()) {
+                    if (webdavResource.isCollection()) {
+                        target += "/" + srcPathName;
+                    } 
+                } 
+                
+                webdavResource.setPath(currentPath);
+                
+            } else {
+                target = checkUri(getPath() + "/" + srcPathName);
+            }
+                
+                            
+        } catch (Exception ex) {
+        }
+        
+        return target;
+               
+
+    }
+    
+    
+
+
+    void put(String filename, String path)
+    {
+        String y = "y";
+
+        try {
+            String src  = filename;
+            String dest = getRemoteTragetFileName( filename,  path);
+            
+            String currentPath = webdavResource.getPath();
+            
+            try {
+                webdavResource.setPath(dest);
+                if (webdavResource.exists()) {
+                    out.print("Aleady exists. " +
+                              "Do you want to overwrite it(y/n)? ");
+                    BufferedReader in =
+                          new BufferedReader(new InputStreamReader(System.in));
+                    y = in.readLine();
+                }
+                webdavResource.setPath(currentPath);
+            } catch (Exception ex) {
+            } 
+            
+            if (y.trim().equalsIgnoreCase("y") ||
+                  (y != null && y.length() == 0)) {
+ 
+            
+                File file = getFileByPath(src);
+                
+                if (file.exists()) {
+                    out.print("Uploading  '" + file.getCanonicalPath() + "' to '" + dest + "' ");
+                    
+                    if (webdavResource.putMethod(dest, file)) {
+                        out.println("succeeded.");
+                    }
+                    else {
+                        out.println("failed.");
+                        out.println(webdavResource.getStatusMessage());
+                    }
+                }
+                else {
+                    out.println("Warning: File not exists");
+                }
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    // TODO multi
+    void delete(String path)
+    {
+        try {
+            path = checkUri(path);
+            out.print("Deleting '" + path + "': ");
+            if (webdavResource.deleteMethod(path)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    // TODO multi
+    void mkcol(String path)
+    {
+        try {
+            path = checkUri(path);
+            out.print("Making '" + path + "' collection: ");
+            if (webdavResource.mkcolMethod(path)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void copy(String src, String dst)
+    {
+        try {
+            src = checkUri(src);
+            dst = checkUri(dst);
+            out.print("Copying '" + src + "' to '" + dst + "': ");
+            if (webdavResource.copyMethod(src, dst)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void move(String src, String dst)
+    {
+        try {
+            src = checkUri(src);
+            dst = checkUri(dst);
+            out.print("Moving '" + src + "' to '" + dst + "': ");
+            if (webdavResource.moveMethod(src, dst)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void locks(String path)
+    {
+        try {
+            path=checkUri(path);
+            LockDiscoveryProperty lockDiscoveryProperty=webdavResource.lockDiscoveryPropertyFindMethod(path);
+            if (lockDiscoveryProperty==null) {
+                out.println("Server did not return a LockDiscoveryProperty.");
+                out.println(webdavResource.getStatusMessage());
+                return;
+            }
+            Lock[] locks=lockDiscoveryProperty.getActiveLocks();
+            showLocks(path,locks);
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void lock(String path, String timeout, String scope, String owner)
+    {
+       try {
+            // Test the parameter
+            //
+            // Timeout
+            int to=0; 
+            if ((timeout != null) && (timeout.toLowerCase().substring(0,5).equals("-tinf")) ) { //infinite
+                to = LockMethod.TIMEOUT_INFINITY;   
+            } else {
+                to = (timeout == null)? 120 : Integer.parseInt(timeout.substring(2));
+            }
+            
+            
+            // scope
+            short scopeType = ((scope != null) && (scope.substring(2).toLowerCase().equals("shared")) ) ?
+                LockMethod.SCOPE_SHARED : LockMethod.SCOPE_EXCLUSIVE;
+           
+            // owner
+            owner = (owner != null) ? (owner.substring(2)) : owner;
+ 
+            path = checkUri(path);
+            out.print("Locking '" + path + "' "); 
+            out.print( (owner != null) ? "owner:'"+ owner + "' " : "");
+            out.print("scope:" +scopeType+" timeout:"+to+ " :");
+            if (webdavResource.lockMethod(path, owner, to, scopeType)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    
+    void unlock(String path, String owner)
+    {
+        try {
+            // Test the parameter
+            //
+            // owner
+            owner = (owner != null) ? (owner.substring(2)) : owner;
+            
+            path = checkUri(path);
+            out.print("Unlocking '" + path + "'");
+            out.print((owner!=null)? (" owner:"+owner+": ") : (": "));
+            if (webdavResource.unlockMethod(path, owner)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+
+    void grant(String permission,String path, String principal)
+    {
+        grant(new QName("DAV:",permission),path,principal);
+
+        // FIME lookup permission ?
+//                if (namespace==null) {
+//            namespace=resolveNamespace(permission);
+//            if (namespace==null) {
+//                out.println("Could not resolve namespace for permission " + permission);
+//                continue;
+//            }
+//        }
+    }
+
+    void grant(QName permission,String path, String principal)
+    {
+        try  {
+            principal=checkPrincipal(principal,webdavResource,path);
+            grant(webdavResource, permission, path, principal);
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void deny(String permission,String path, String principal)
+    {
+        deny(new QName("DAV:",permission),path,principal);
+    }
+
+    void deny(QName permission,String path, String principal)
+    {
+        try  {
+            principal=checkPrincipal(principal,webdavResource,path);
+            deny(webdavResource, permission, path, principal);
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void revoke(String permission,String path, String principal)
+    {
+        revoke(new QName("DAV:",permission),path,principal);
+    }
+
+    void revoke(QName permission,String path, String principal)
+    {
+        try  {
+            principal=checkPrincipal(principal,webdavResource,path);
+            revoke(webdavResource, permission, path, principal);
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void acl(String path)
+    {
+        try
+        {
+            AclProperty acl=null;
+            if (path!=null) {
+                path=checkUri(path);
+            }
+            else {
+                path=webdavResource.getPath();
+            }
+            acl = webdavResource.aclfindMethod(path);
+
+            if (acl==null)
+            {
+                out.println("Error: PropFind didn't return an AclProperty!");
+                return;
+            }
+            out.println();
+            showAces(path, acl.getAces());
+        }
+        catch (Exception ex)
+        {
+            handleException(ex);
+        }
+    }
+
+    void principalcollectionset(String path)
+    {
+        try
+        {
+            PrincipalCollectionSetProperty set=null;
+            if (path!=null) {
+                path=checkUri(path);
+            }
+            else {
+                path=webdavResource.getPath();
+            }
+            set = webdavResource.principalCollectionSetFindMethod(path);
+
+            if (set==null)
+            {
+                out.println("Error: PropFind didn't return an PrincipalCollectionSetProperty!");
+                return;
+            }
+            String[] hrefs=set.getHrefs();
+            if (hrefs==null) {
+                out.println("No PrincipalCollectionSet for " + path);
+            }
+            out.println();
+            out.println("PrincipalCollectionSet for " + path + ":");
+            for (int i=0 ; i<hrefs.length ; i++)
+                out.println("   " + hrefs[i]);
+            out.println();
+        }
+        catch (Exception ex)
+        {
+        }
+    }
+
+    ///////////////////////////////////////////////////////////////////
+
+    void checkin(String path)
+    {
+        try {
+            path = checkUri(path);
+            out.print("checking in '" + path + "': ");
+            if (webdavResource.checkinMethod(path)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void checkout(String path)
+    {
+        try {
+            path = checkUri(path);
+            out.print("checking out '" + path + "': ");
+            if (webdavResource.checkoutMethod(path)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void uncheckout(String path)
+    {
+        try {
+            path = checkUri(path);
+            out.print("unchecking out '" + path + "': ");
+            if (webdavResource.uncheckoutMethod(path)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+
+    void versioncontrol(String path)
+    {
+        try {
+            path = checkUri(path);
+            out.print("setting up VersionControl '" + path + "': ");
+            if (webdavResource.versionControlMethod(path)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void versioncontrol(String target, String path)
+    {
+        try {
+            path = checkUri(path);
+            out.print("creating versioncontroled Resource '" + target + "' based on '" + path + "' : ");
+            if (webdavResource.versionControlMethod(path, target)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void report(String path, Vector properties)
+    {
+        Enumeration propertyValues;
+        try {
+            path = checkUri(path);
+            out.println("Getting version-tree Report of '" + path + "':");
+
+            if ((properties!=null) && (properties.size()>0)) {
+                propertyValues =
+                    webdavResource.reportMethod(uriToHttpURL(path), properties, 1);
+            }
+            else  {
+                propertyValues =
+                    webdavResource.reportMethod(uriToHttpURL(path), 1);
+            }
+
+            if (propertyValues.hasMoreElements()){
+                while (propertyValues.hasMoreElements()){
+                    out.println(propertyValues.nextElement().toString());
+                }
+            }
+            else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void ereport(String path, String srcFilename)
+    {
+        try {
+            String sQuery ="";
+            if (srcFilename==null) {
+                sQuery = "<D:expand-property xmlns:D='DAV:'><D:property name='version-history'><D:property name='version-set'><D:property name='successor-set'><D:property name='comment'/></D:property></D:property></D:property></D:expand-property>";
+            }
+            else  {
+                File file = new File(dir.getCanonicalPath(), srcFilename);
+                if (!file.exists()) {
+                    out.println("report src file not found");
+                    return;
+                }
+                InputStream isQuery = new FileInputStream(file);
+                BufferedReader reader = new BufferedReader(new InputStreamReader(isQuery));
+
+                while (reader.ready()) {
+                    sQuery += reader.readLine();
+                }
+                reader.close();
+
+                sQuery.replace('\t',' ');
+                out.println (sQuery);
+            }
+
+            path = checkUri(path);
+            out.println("expand-property Report of '" + path + "':");
+
+            Enumeration propertyValues =
+                webdavResource.reportMethod(uriToHttpURL(path), sQuery, 1);
+            if (propertyValues.hasMoreElements()){
+                while (propertyValues.hasMoreElements()){
+                    out.println(displayXML(propertyValues.nextElement().toString(), 0));
+                }
+            }
+            else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    /**
+     * lreport path properties on historyUris
+     */
+    void lreport(String path, Vector properties, Vector historyUris)
+    {
+        try {
+            path = checkUri(path);
+            out.println("Getting version-tree Report of '" + path + "':");
+
+            Enumeration propertyValues =
+                webdavResource.reportMethod(uriToHttpURL(path), properties, historyUris, 1);
+            if (propertyValues.hasMoreElements()) {
+                while (propertyValues.hasMoreElements()) {
+                    out.println(propertyValues.nextElement().toString());
+                }
+            }
+            else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void mkws(String path)
+    {
+        try {
+            path = checkUri(path);
+            out.print("Making '" + path + "' workspace: ");
+            if (webdavResource.mkWorkspaceMethod(path)) {
+                out.println("succeeded.");
+            }
+            else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+
+    /**
+     * Update
+     *
+     * @param path
+     * @param version
+     */
+    void update(String path, String version){
+        try {
+            path = checkUri(path);
+            out.print("Updateing resource " + path + ": ");
+            if (webdavResource.updateMethod(path, version)) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed!");
+                out.println(webdavResource.getStatusMessage());
+            }
+        } catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void beginTransaction(String timeout, String owner)
+    {
+        try {
+            checkUri(null);
+
+            // Test the parameter
+            //
+            // Timeout
+            int to=0; 
+            if ((timeout != null) && (timeout.toLowerCase().substring(0,5).equals("-tinf")) ) { //infinite
+                to = LockMethod.TIMEOUT_INFINITY;   
+            } else {
+                to = (timeout == null)? 120 : Integer.parseInt(timeout.substring(2));
+            }
+            
+            // owner
+            owner = (owner != null) ? (owner.substring(2)) : owner;
+ 
+            out.print("Starting transaction "); 
+            if (webdavResource.startTransaction(owner, to)) {
+                out.println("succeeded.");
+                out.println("Handle: '"+webdavResource.getTransactionHandle()+"'");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+
+    void commitTransaction()
+    {
+        try {
+            checkUri(null);
+
+            out.print("Committing transaction: '" + webdavResource.getTransactionHandle() + "' ");
+            if (webdavResource.commitTransaction()) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+    
+    void abortTransaction()
+    {
+        try {
+            checkUri(null);
+
+            out.print("Rolling back transaction: '" +webdavResource.getTransactionHandle()+ "' ");
+            if (webdavResource.abortTransaction()) {
+                out.println("succeeded.");
+            } else {
+                out.println("failed.");
+                out.println(webdavResource.getStatusMessage());
+            }
+        }
+        catch (Exception ex) {
+            handleException(ex);
+        }
+    }
+    
+    ///////////////////////////////////////////////////////////////////
+    // Support methods
+    ///////////////////////////////////////////////////////////////////
+
+    private void setDisplayPrompt(boolean displayPrompt)
+    {
+        this.displayPrompt = displayPrompt;
+    }
+
+    /**
+     * Determine which URI to use at the prompt.
+     *
+     * @param uri the path to be set.
+     * @return the absolute path.
+     */
+    private String checkUri(String uri) throws IOException
+    {
+
+        if (webdavResource == null) {
+            throw new IOException("Not connected yet.");
+        }
+
+        if (uri==null) {
+            uri=webdavResource.getPath();
+        }
+
+        if (!uri.startsWith("/")) {
+            uri = getPath() + uri;
+        }
+
+        return normalize(uri);
+    }
+
+    private String checkPrincipal(String principal, WebdavResource webdavResource, String path) throws HttpException,IOException
+    {
+        // Do not complete reserved words
+        String[] types={"all","authenticated","unauthenticated","property","self"};
+        for (int i=0; i<types.length ; i++)
+        {
+            if (types[i].equals(principal))
+                return principal;
+        }
+
+        // FIXME: when search support is complete enhance this
+        //        to really search for the principal
+        if (!principal.startsWith("/") && !principal.startsWith("http")) {
+            PrincipalCollectionSetProperty set = webdavResource.principalCollectionSetFindMethod(path);
+            if ((set!=null) && (set.getHrefs()!=null) && (set.getHrefs().length==1))
+                principal = set.getHrefs()[0] + "/" + principal;
+        }
+        return normalize(principal);
+    }
+
+    /**
+     * Set the path.
+     *
+     * @param path the path string.
+     */
+    private void setPath(String path)
+    {
+        if (!path.endsWith("/")) {
+            path = path + "/";
+        }
+
+        this.path = normalize(path);
+    }
+
+
+    /**
+     * Get the path.
+     *
+     * @return the path string.
+     */
+    private String getPath()
+    {
+        return path;
+    }
+
+
+    /**
+     * Update the command prompt for the display.
+     *
+     * @param path the path string
+     */
+    private void updatePrompt(String path)
+    {
+        StringBuffer buff = new StringBuffer();
+        try {
+            buff.append("[" + httpURL.getHost().toUpperCase() + ":" );
+            buff.append(path+ "] ");
+            buff.append(dir.getCanonicalPath());
+            
+        } catch (Exception e) {
+            buff.append("[ Slide ]");
+        }
+        buff.append(" $ ");
+        commandPrompt = buff.toString();
+    }
+
+
+    /**
+     * Get the prompt.
+     *
+     * @return the prompt to be displayed.
+     */
+    private String getPrompt()
+    {
+        return commandPrompt;
+    }
+
+
+    /**
+     * Return a context-relative path, beginning with a "/", that represents
+     * the canonical version of the specified path after ".." and "." elements
+     * are resolved out.  If the specified path attempts to go outside the
+     * boundaries of the current context (i.e. too many ".." path elements
+     * are present), return <code>null</code> instead.
+     *
+     * @param path the path to be normalized.
+     * @return the normalized path.
+     */
+    private String normalize(String path)
+    {
+        if (path == null)
+            return null;
+
+        String normalized = path;
+
+        // Normalize the slashes and add leading slash if necessary
+        if (normalized.indexOf('\\') >= 0)
+            normalized = normalized.replace('\\', '/');
+        if (!normalized.startsWith("/"))
+            normalized = "/" + normalized;
+
+        // Resolve occurrences of "/./" in the normalized path
+        while (true) {
+            int index = normalized.indexOf("/./");
+            if (index < 0)
+            break;
+            normalized = normalized.substring(0, index) +
+            normalized.substring(index + 2);
+        }
+
+        // Resolve occurrences of "/../" in the normalized path
+        while (true) {
+            int index = normalized.indexOf("/../");
+            if (index < 0)
+            break;
+            if (index == 0)
+            return ("/");  // The only left path is the root.
+            int index2 = normalized.lastIndexOf('/', index - 1);
+            normalized = normalized.substring(0, index2) +
+            normalized.substring(index + 3);
+        }
+
+        // Resolve occurrences of "//" in the normalized path
+        while (true) {
+            int index = normalized.indexOf("//");
+            if (index < 0)
+            break;
+            normalized = normalized.substring(0, index) +
+            normalized.substring(index + 1);
+        }
+
+        // Return the normalized path that we have completed
+        return (normalized);
+    }
+
+    /**
+     * Print the Slide client commands for use
+     */
+    private void printSlideClientUsage()
+    {
+        out.println("Commands:");
+        out.println("  options {http_URL|path}       " +
+            "Print available http methods");
+        out.println("  open [http_URL]               " +
+            "Connect to specified URL");
+        out.println("  close                         " +
+            "Close current connection");
+        out.println("  exit                          " +
+            "Exit Slide");
+        out.println("  help                          " +
+            "Print this help message");
+        out.println("  debug {ON|OFF}                " +
+            "set debugmode");
+        out.println("  lpwd                          " +
+            "Print local working directory");
+        out.println("  lcd [path]                    " +
+            "Change local working directory");
+        out.println("  lls [-lF] [path]              " +
+            "List contents of local directory");
+        out.println("  pwc                           " +
+            "Print working collection");
+        out.println("  cc [path]                     " +
+            "Change working collection");
+        out.println("  ls [-lF] [path]               " +
+            "List contents of collection");
+        out.println("  url                           " +
+            "Print working URL");
+        out.println("  status                        " +
+            "Print latest http status message");
+        out.println("  get path [file]               " +
+            "Get a resource to a file");
+        out.println("  put {URL|file} [path]         " +
+            "Put a given file or URL to path");
+        out.println("  mkcol path ...                " +
+            "Make new collections");
+        out.println("  delete path ...               " +
+            "Delete resources");
+        out.println("  copy source destination       " +
+            "Copy resource from source to destination path");
+        out.println("  move source destination       " +
+            "Move resource from source to destination path");
+        out.println("  lock path [-t(xxx|inf)] "       +
+            "[-s(SHARED|EXCLUSIVE)] [-oOWNER]\n"       +
+            "                                "         +
+            "Lock specified resource.\n"               +
+            "                                "         +
+            "default:\n"                               +
+            "                                "         +
+            "lock file -t120 -sexclusive with current owner");
+        out.println("  unlock path [-oOWNER]         " +
+            "Unlock specified resource.\n"+
+            "                                "         +
+            "default:\n"                               +
+            "                                "         +
+            "unlock file with current owner");
+        out.println("  locks [<path>]                " +
+            "Displays locks on specified resource");
+        out.println("  propget path property ...     " +
+            "Print value of specified property");
+        out.println("  propgetall [<path>]           " +
+            "Print value of all properties");
+        out.println("  propput path property value   " +
+            "Set property with given value");
+        out.println("  set URLencode {on|off}        " +
+            "Set URL encoding flag, default: on");
+        out.println("  set debug {on|off}            " +
+            "Set debug level, default: off");
+        out.println("  acl [<path>]                  " +
+            "Displays the ACL of path");
+        out.println("  principalcol [<path>]         " +
+            "Displays the principal collection set of path");
+        out.println("  grant  [<namespace>] <permission> [on <path>] to <principal>");
+        out.println("  deny   [<namespace>] <permission> [on <path>] to <principal>");
+        out.println("  revoke [<namespace>] <permission> [on <path>] from <principal>");
+        out.println("  versioncontrol path           "+
+            "set a versionable resource under versioncontrol");
+        out.println("  versioncontrol URL path       "+
+            "create a new versioncontrolled resource at path based on history URL");
+        out.println("  checkout path                 "+
+            "checkout of a checkedin resource");
+        out.println("  checkin path                  "+
+            "checkin of a checkedout resource");
+        out.println("  uncheckout path               "+
+            "undoing changes on Resource since checkedout (including checkout)");
+        out.println("  report path [<property>]      "+
+            "getting report (version-tree) for any resource");
+        out.println("  eReport path                  "+
+            "getting report (expand-property) for any resource");
+        out.println("  LReport path [<property>] ON [<historyuri>] "+
+            "getting report (locate-by-history)");
+        out.println("  mkws path ...                 " +
+            "Make new workspace");
+        out.println("  update path target                 " +
+            "Update a resource identified by path to version identified by target");
+        out.println("  begin                          starts a new transaction (only if server supports this)");
+        out.println("  commit                         commits the transaction started by begin (only if server supports this)");
+        out.println("  abort                          aborts and rolls back the transaction started by begin (only if server supports this)");
+        out.println
+            ("Aliases: help=?, open=connect, ls=dir, pwc=pwd, cc=cd, " +
+             "lls=ldir, copy=cp,\n move=mv, delete=del=rm, mkcol=mkdir, " +
+             "propget=propfind, propput=proppatch,\n exit=quit=bye");
+        out.println("Comment : Once executed, the debug mode will " +
+                           "be active.\n\t\tBecause it's not triggered by " +
+                           "methods yet.");
+    }
+
+
+    /**
+     * Sleep
+     */
+//    private static void pause(int secs)
+//    {
+//
+//        try {
+//            Thread.sleep( secs * 1000 );
+//        } catch( InterruptedException ex ) {
+//        }
+//    }
+
+//    private String resolveNamespace(String permission)
+//    {
+//        String DEFAULT_NAMESPACE = "DAV:";
+//        String SLIDE_NAMESPACE = "http://jakarta.apache.org/slide/";
+//        String namespace=null;
+//
+//        if (permission==null)
+//            return null;
+//
+//        if ((permission.equalsIgnoreCase("all")) ||
+//            (permission.equalsIgnoreCase("read")) ||
+//            (permission.equalsIgnoreCase("write")) ||
+//            (permission.equalsIgnoreCase("read-acl")) ||
+//            (permission.equalsIgnoreCase("write-acl")))
+//        {
+//            namespace=DEFAULT_NAMESPACE;
+//        }
+//
+//        if ((permission.equalsIgnoreCase("read-object")) ||
+//            (permission.equalsIgnoreCase("read-revision-metadata")) ||
+//            (permission.equalsIgnoreCase("read-revision-content")) ||
+//            (permission.equalsIgnoreCase("create-object")) ||
+//            (permission.equalsIgnoreCase("remove-object")) ||
+//            (permission.equalsIgnoreCase("lock-object")) ||
+//            (permission.equalsIgnoreCase("read-locks")) ||
+//            (permission.equalsIgnoreCase("create-revision-metadata")) ||
+//            (permission.equalsIgnoreCase("modify-revision-metadata")) ||
+//            (permission.equalsIgnoreCase("remove-revision-metadata")) ||
+//            (permission.equalsIgnoreCase("create-revision-content")) ||
+//            (permission.equalsIgnoreCase("modify-revision-content")) ||
+//            (permission.equalsIgnoreCase("remove-revision-content")) ||
+//            (permission.equalsIgnoreCase("grant-permission")) ||
+//            (permission.equalsIgnoreCase("revoke-permission")))
+//        {
+//            namespace=SLIDE_NAMESPACE;
+//        }
+//
+//        return namespace;
+//    }
+
+    private boolean grant(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
+    {
+        out.println("grant " + permission + " on " + path + " to " + principal);
+        return addPermission(webdavResource, permission, path, principal, false);
+    }
+
+    private boolean deny(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
+    {
+        out.println("deny " + permission + " on " + path + " to " + principal);
+        return addPermission(webdavResource, permission, path, principal, true);
+    }
+
+    private boolean revoke(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
+    {
+        out.println("revoke " + permission + " on " + path + " from " + principal);
+        return removePermission(webdavResource, permission, path, principal);
+    }
+
+    private boolean addPermission(WebdavResource webdavResource, QName permission, String path, String principal, boolean negative) throws HttpException, IOException
+    {
+
+        AclProperty acl = webdavResource.aclfindMethod(path);
+        if (acl==null)
+        {
+            out.println("Error: PropFind didn't return an AclProperty!");
+            return false;
+        }
+        Ace[] aces=acl.getAces();
+
+        if (aces==null)
+            aces=new Ace[0];
+
+        if (debugLevel>5) {
+            out.println();
+            out.println("ACL from server");
+            showAces(path, aces);
+        }
+
+        Ace ace=null;
+        for (int i=0; i<aces.length && (ace==null); i++)
+        {
+            if ((aces[i].isNegative()==negative) && !aces[i].isProtected()
+                && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
+            {
+                if (debugLevel>5)
+                    out.println("found ace");
+                ace=aces[i];
+            }
+        }
+        if (ace==null)
+        {
+            Ace[] oldAces=aces;
+            aces=new Ace[oldAces.length+1];
+            System.arraycopy(oldAces,0,aces,0,oldAces.length);
+            ace=new Ace(principal, negative, false, false,null);
+            aces[oldAces.length]=ace;
+        }
+
+        Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
+        ace.addPrivilege(privilege);
+
+        if (debugLevel>5) {
+            out.println();
+            out.println("ACL with updated privileges");
+            showAces(path, aces);
+        }
+
+        boolean success = webdavResource.aclMethod(path,aces);
+
+        if (!success)
+            out.println(webdavResource.getStatusMessage());
+
+        if (debugLevel>5) {
+            acl = webdavResource.aclfindMethod(path);
+            if (acl==null)
+                out.println("Error: PropFind didn't return an AclProperty!");
+            else
+            {
+                aces=acl.getAces();
+                out.println();
+                out.println("ACL from server after update");
+                showAces(path, aces);
+            }
+        }
+
+        return success;
+    }
+
+    private boolean removePermission(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
+    {
+        AclProperty acl = webdavResource.aclfindMethod(path);
+        if (acl==null)
+        {
+            out.println("Error: PropFind didn't return an AclProperty!");
+            return false;
+        }
+        Ace[] aces=acl.getAces();
+
+        if (aces==null)
+        {
+            out.println("Privilege not found");
+            return false;
+        }
+
+        if (debugLevel>5) {
+            out.println();
+            out.println("ACL from server");
+            showAces(path, aces);
+        }
+
+        boolean found=false;
+        Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
+        for (int i=0; i<aces.length; i++)
+        {
+            if (!aces[i].isProtected() && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
+            {
+                if (debugLevel>5)
+                    out.println("found ace");
+                boolean removed = aces[i].removePrivilege(privilege);
+                found = found || removed;
+                if (removed)
+                    out.println("Privilege removed");
+            }
+        }
+
+        if (!found)
+        {
+            out.println("Privilege not found");
+            return false;
+        }
+
+        if (debugLevel>5) {
+            out.println();
+            out.println("ACL with updated privileges");
+            showAces(path, aces);
+        }
+
+        boolean success = webdavResource.aclMethod(path,aces);
+
+        if (!success)
+            out.println(webdavResource.getStatusMessage());
+
+        if (debugLevel>5) {
+            acl = webdavResource.aclfindMethod(path);
+            if (acl==null)
+                out.println("Error: PropFind didn't return an AclProperty!");
+            else
+            {
+                aces=acl.getAces();
+                out.println();
+                out.println("ACL from server after update");
+                showAces(path, aces);
+            }
+        }
+
+        return success;
+    }
+
+    private void showAces(String path, Ace[] aces)
+    {
+        if ((aces==null) || (aces.length==0)) {
+            out.println("ACL for " + path + " is empty.");
+            return;
+        }
+
+        out.println("ACL for " + path + ":");
+        out.println("------------------------------------------------------------");
+        for (int i=0; i<aces.length ; i++)
+        {
+            Ace ace=aces[i];
+            out.println((!ace.isNegative()?"granted":"denied") +
+                " to " + ace.getPrincipal() + " " +
+                "   (" + (ace.isProtected()?"protected":"not protected") + ")" +
+                "   (" + (ace.isInherited()? ("inherited from '" + ace.getInheritedFrom() + "'"): "not inherited") +")");
+
+            Enumeration privileges=ace.enumeratePrivileges();
+            while (privileges.hasMoreElements())
+            {
+                Privilege priv=(Privilege)privileges.nextElement();
+                out.println("   " + priv.getNamespace() + priv.getName() + "   " + (priv.getParameter()==null?"":("("+priv.getParameter()+")")));
+            }
+        }
+        out.println("------------------------------------------------------------");
+    }
+
+    private void showLocks(String path, Lock[] locks)
+    {
+        if ((locks==null) || (locks.length==0)) {
+            out.println("No locks on " + path);
+            return;
+        }
+
+        out.println("Locks for " + path + ":");
+        out.println("------------------------------------------------------------");
+        for (int i=0; i<locks.length ; i++)
+        {
+            int lockScope = locks[i].getLockScope();
+            if (lockScope==Lock.SCOPE_EXCLUSIVE) {
+                out.print("Exclusive ");
+            }
+            else if (lockScope==Lock.SCOPE_SHARED) {
+                out.print("Shared ");
+            }
+            else if (lockScope==-1) {
+                out.print("Unknown scope ");
+            }
+            else {
+                out.println("!!! Internal error !!!");
+                return;
+            }
+
+            int lockType = locks[i].getLockType();
+            if (lockType==Lock.TYPE_WRITE) {
+                out.println("write lock");
+            }
+            else if (lockType==-1) {
+                out.println("unknown type");
+            }
+            else {
+                out.println("!!! Internal error !!!");
+                return;
+            }
+
+            int depth=locks[i].getDepth();
+            if (depth==DepthSupport.DEPTH_INFINITY) {
+                out.println("   depth: infinity");
+            }
+            else if (depth==-1) {
+                // unknown
+            }
+            else {
+                out.println("   depth: " + depth);
+            }
+
+            String owner=locks[i].getOwner();
+            if (owner!=null)
+                out.println("   owner: " + owner);
+
+            int timeout=locks[i].getTimeout();
+            if (timeout!=-1)
+                out.println("   timeout: " + timeout);
+
+            String token=locks[i].getLockToken();
+            if (token!=null)
+                out.println("   token: " + token);
+        }
+    }
+
+    private String displayXML(String xmlString, int count)
+    {
+        String sResult ="";
+
+        if(xmlString.startsWith("</")) {
+            count --;
+            //out.println("cl: " + count);
+            for (int cc = count; cc > 0; cc--) {
+                sResult += "\t";
+            }
+
+            try {
+                sResult += xmlString.substring(0, xmlString.indexOf(">") + 1)+"\n";
+                xmlString = xmlString.substring(xmlString.indexOf(">") + 1);
+                //count --;
+                sResult += displayXML(xmlString, count);
+            }
+            catch (Exception any) {
+                //sResult += "endtag" + any;
+            }
+
+        }
+        else if (xmlString.startsWith("<")) {
+            //out.println("op: " + count);
+            for (int cc = count; cc > 0; cc--) {
+                sResult += "\t";
+            }
+            try {
+                sResult += xmlString.substring(0, xmlString.indexOf(">") + 1)+"\n";
+                xmlString = xmlString.substring(xmlString.indexOf(">") + 1);
+                count ++;
+                sResult += displayXML(xmlString, count);
+            }
+            catch (Exception any) {
+                //sResult += "starttag" + any;
+            }
+        }
+        else {
+            //out.println("em: " + count);
+            for (int cc = count; cc > 0; cc--) {
+                sResult += "\t";
+            }
+            try {
+                sResult += xmlString.substring(0, xmlString.indexOf("<"))+ "\n";
+                xmlString = xmlString.substring(xmlString.indexOf("<"));
+                sResult += displayXML(xmlString, count);
+            }
+            catch (Exception any) {
+                //sResult += any;
+            }
+        }
+        return sResult;
+    }
+
+    private static HttpURL uriToHttpURL(String uri) throws URIException {
+        return uri.startsWith("https") ? new HttpsURL(uri)
+                                       : new HttpURL(uri);
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/ClientLexer.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/ClientLexer.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/ClientLexer.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,711 @@
+// $ANTLR 2.7.3: "Client.g" -> "ClientLexer.java"$
+
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/commandline/src/java/org/apache/webdav/cmd/ClientLexer.java,v 1.9 2004/08/02 15:45:51 unico Exp $
+ * $Revision: 1.9 $
+ * $Date: 2004/08/02 15:45:51 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.cmd;
+
+import java.io.*;
+import java.util.*;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.util.QName;
+
+
+import java.io.InputStream;
+import antlr.TokenStreamException;
+import antlr.TokenStreamIOException;
+import antlr.TokenStreamRecognitionException;
+import antlr.CharStreamException;
+import antlr.CharStreamIOException;
+import antlr.ANTLRException;
+import java.io.Reader;
+import java.util.Hashtable;
+import antlr.CharScanner;
+import antlr.InputBuffer;
+import antlr.ByteBuffer;
+import antlr.CharBuffer;
+import antlr.Token;
+import antlr.CommonToken;
+import antlr.RecognitionException;
+import antlr.NoViableAltForCharException;
+import antlr.MismatchedCharException;
+import antlr.TokenStream;
+import antlr.ANTLRHashString;
+import antlr.LexerSharedInputState;
+import antlr.collections.impl.BitSet;
+import antlr.SemanticException;
+
+/**
+ * The Slide WebDAV client scanner.
+ *
+ * @version     $Revision: 1.9 $ $Date: 2004/08/02 15:45:51 $
+ */
+public class ClientLexer extends antlr.CharScanner implements SlideTokenTypes, TokenStream
+ {
+public ClientLexer(InputStream in) {
+	this(new ByteBuffer(in));
+}
+public ClientLexer(Reader in) {
+	this(new CharBuffer(in));
+}
+public ClientLexer(InputBuffer ib) {
+	this(new LexerSharedInputState(ib));
+}
+public ClientLexer(LexerSharedInputState state) {
+	super(state);
+	caseSensitiveLiterals = false;
+	setCaseSensitive(true);
+	literals = new Hashtable();
+	literals.put(new ANTLRHashString("spool", this), new Integer(8));
+	literals.put(new ANTLRHashString("copy", this), new Integer(33));
+	literals.put(new ANTLRHashString("mkdir", this), new Integer(31));
+	literals.put(new ANTLRHashString("uncheckout", this), new Integer(63));
+	literals.put(new ANTLRHashString("delete", this), new Integer(34));
+	literals.put(new ANTLRHashString("abort", this), new Integer(48));
+	literals.put(new ANTLRHashString("grant", this), new Integer(52));
+	literals.put(new ANTLRHashString("off", this), new Integer(10));
+	literals.put(new ANTLRHashString("acl", this), new Integer(57));
+	literals.put(new ANTLRHashString("help", this), new Integer(4));
+	literals.put(new ANTLRHashString("lcd", this), new Integer(22));
+	literals.put(new ANTLRHashString("ldir", this), new Integer(26));
+	literals.put(new ANTLRHashString("mv", this), new Integer(74));
+	literals.put(new ANTLRHashString("lock", this), new Integer(49));
+	literals.put(new ANTLRHashString("to", this), new Integer(53));
+	literals.put(new ANTLRHashString("versioncontrol", this), new Integer(59));
+	literals.put(new ANTLRHashString("mkws", this), new Integer(67));
+	literals.put(new ANTLRHashString("mkcol", this), new Integer(30));
+	literals.put(new ANTLRHashString("from", this), new Integer(56));
+	literals.put(new ANTLRHashString("dir", this), new Integer(29));
+	literals.put(new ANTLRHashString("propfind", this), new Integer(37));
+	literals.put(new ANTLRHashString("checkin", this), new Integer(61));
+	literals.put(new ANTLRHashString("quit", this), new Integer(69));
+	literals.put(new ANTLRHashString("open", this), new Integer(17));
+	literals.put(new ANTLRHashString("locks", this), new Integer(51));
+	literals.put(new ANTLRHashString("status", this), new Integer(7));
+	literals.put(new ANTLRHashString("exit", this), new Integer(68));
+	literals.put(new ANTLRHashString("unlock", this), new Integer(50));
+	literals.put(new ANTLRHashString("rm", this), new Integer(36));
+	literals.put(new ANTLRHashString("set", this), new Integer(71));
+	literals.put(new ANTLRHashString("lls", this), new Integer(25));
+	literals.put(new ANTLRHashString("proppatch", this), new Integer(42));
+	literals.put(new ANTLRHashString("propput", this), new Integer(75));
+	literals.put(new ANTLRHashString("commit", this), new Integer(47));
+	literals.put(new ANTLRHashString("propgetall", this), new Integer(41));
+	literals.put(new ANTLRHashString("close", this), new Integer(72));
+	literals.put(new ANTLRHashString("principalcollectionset", this), new Integer(58));
+	literals.put(new ANTLRHashString("run", this), new Integer(11));
+	literals.put(new ANTLRHashString("deny", this), new Integer(54));
+	literals.put(new ANTLRHashString("report", this), new Integer(64));
+	literals.put(new ANTLRHashString("put", this), new Integer(45));
+	literals.put(new ANTLRHashString("connect", this), new Integer(16));
+	literals.put(new ANTLRHashString("propget", this), new Integer(38));
+	literals.put(new ANTLRHashString("revoke", this), new Integer(55));
+	literals.put(new ANTLRHashString("echo", this), new Integer(12));
+	literals.put(new ANTLRHashString("disconnect", this), new Integer(18));
+	literals.put(new ANTLRHashString("debug", this), new Integer(14));
+	literals.put(new ANTLRHashString("move", this), new Integer(32));
+	literals.put(new ANTLRHashString("bye", this), new Integer(70));
+	literals.put(new ANTLRHashString("cd", this), new Integer(23));
+	literals.put(new ANTLRHashString("cp", this), new Integer(73));
+	literals.put(new ANTLRHashString("propfindall", this), new Integer(40));
+	literals.put(new ANTLRHashString("del", this), new Integer(35));
+	literals.put(new ANTLRHashString("get", this), new Integer(44));
+	literals.put(new ANTLRHashString("lpwd", this), new Integer(19));
+	literals.put(new ANTLRHashString("cc", this), new Integer(24));
+	literals.put(new ANTLRHashString("on", this), new Integer(13));
+	literals.put(new ANTLRHashString("options", this), new Integer(15));
+	literals.put(new ANTLRHashString("begin", this), new Integer(46));
+	literals.put(new ANTLRHashString("ereport", this), new Integer(65));
+	literals.put(new ANTLRHashString("pwd", this), new Integer(21));
+	literals.put(new ANTLRHashString("principalcol", this), new Integer(76));
+	literals.put(new ANTLRHashString("update", this), new Integer(60));
+	literals.put(new ANTLRHashString("checkout", this), new Integer(62));
+	literals.put(new ANTLRHashString("lreport", this), new Integer(66));
+	literals.put(new ANTLRHashString("ls", this), new Integer(28));
+	literals.put(new ANTLRHashString("pwc", this), new Integer(20));
+}
+
+public Token nextToken() throws TokenStreamException {
+	Token theRetToken=null;
+tryAgain:
+	for (;;) {
+		Token _token = null;
+		int _ttype = Token.INVALID_TYPE;
+		resetText();
+		try {   // for char stream error handling
+			try {   // for lexical error handling
+				switch ( LA(1)) {
+				case '\t':  case ' ':
+				{
+					mWS(true);
+					theRetToken=_returnToken;
+					break;
+				}
+				case '\n':  case '\r':
+				{
+					mEOL(true);
+					theRetToken=_returnToken;
+					break;
+				}
+				case '-':
+				{
+					mOPTIONSTRING(true);
+					theRetToken=_returnToken;
+					break;
+				}
+				case '!':  case '"':  case '#':  case '$':
+				case '%':  case '&':  case '(':  case ')':
+				case '+':  case '.':  case '/':  case '0':
+				case '1':  case '2':  case '3':  case '4':
+				case '5':  case '6':  case '7':  case '8':
+				case '9':  case ':':  case 'A':  case 'B':
+				case 'C':  case 'D':  case 'E':  case 'F':
+				case 'G':  case 'H':  case 'I':  case 'J':
+				case 'K':  case 'L':  case 'M':  case 'N':
+				case 'O':  case 'P':  case 'Q':  case 'R':
+				case 'S':  case 'T':  case 'U':  case 'V':
+				case 'W':  case 'X':  case 'Y':  case 'Z':
+				case '\\':  case '_':  case 'a':  case 'b':
+				case 'c':  case 'd':  case 'e':  case 'f':
+				case 'g':  case 'h':  case 'i':  case 'j':
+				case 'k':  case 'l':  case 'm':  case 'n':
+				case 'o':  case 'p':  case 'q':  case 'r':
+				case 's':  case 't':  case 'u':  case 'v':
+				case 'w':  case 'x':  case 'y':  case 'z':
+				{
+					mSTRING(true);
+					theRetToken=_returnToken;
+					break;
+				}
+				case '<':
+				{
+					mQNAME(true);
+					theRetToken=_returnToken;
+					break;
+				}
+				case '?':
+				{
+					mQUESTION(true);
+					theRetToken=_returnToken;
+					break;
+				}
+				default:
+				{
+					if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
+				else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
+				}
+				}
+				if ( _returnToken==null ) continue tryAgain; // found SKIP token
+				_ttype = _returnToken.getType();
+				_ttype = testLiteralsTable(_ttype);
+				_returnToken.setType(_ttype);
+				return _returnToken;
+			}
+			catch (RecognitionException e) {
+				throw new TokenStreamRecognitionException(e);
+			}
+		}
+		catch (CharStreamException cse) {
+			if ( cse instanceof CharStreamIOException ) {
+				throw new TokenStreamIOException(((CharStreamIOException)cse).io);
+			}
+			else {
+				throw new TokenStreamException(cse.getMessage());
+			}
+		}
+	}
+}
+
+	public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = WS;
+		int _saveIndex;
+		
+		{
+		switch ( LA(1)) {
+		case ' ':
+		{
+			match(' ');
+			break;
+		}
+		case '\t':
+		{
+			match('\t');
+			break;
+		}
+		default:
+		{
+			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
+		}
+		}
+		}
+		
+		_ttype = Token.SKIP;
+		
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	public final void mEOL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = EOL;
+		int _saveIndex;
+		
+		if ((LA(1)=='\r') && (LA(2)=='\n')) {
+			match("\r\n");
+		}
+		else if ((LA(1)=='\r') && (true)) {
+			match('\r');
+		}
+		else if ((LA(1)=='\n')) {
+			match('\n');
+		}
+		else {
+			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
+		}
+		
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	public final void mOPTIONSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = OPTIONSTRING;
+		int _saveIndex;
+		
+		match('-');
+		{
+		int _cnt112=0;
+		_loop112:
+		do {
+			if ((_tokenSet_0.member(LA(1)))) {
+				mCHARS(false);
+			}
+			else {
+				if ( _cnt112>=1 ) { break _loop112; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
+			}
+			
+			_cnt112++;
+		} while (true);
+		}
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	protected final void mCHARS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = CHARS;
+		int _saveIndex;
+		
+		switch ( LA(1)) {
+		case 'a':  case 'b':  case 'c':  case 'd':
+		case 'e':  case 'f':  case 'g':  case 'h':
+		case 'i':  case 'j':  case 'k':  case 'l':
+		case 'm':  case 'n':  case 'o':  case 'p':
+		case 'q':  case 'r':  case 's':  case 't':
+		case 'u':  case 'v':  case 'w':  case 'x':
+		case 'y':  case 'z':
+		{
+			matchRange('a','z');
+			break;
+		}
+		case 'A':  case 'B':  case 'C':  case 'D':
+		case 'E':  case 'F':  case 'G':  case 'H':
+		case 'I':  case 'J':  case 'K':  case 'L':
+		case 'M':  case 'N':  case 'O':  case 'P':
+		case 'Q':  case 'R':  case 'S':  case 'T':
+		case 'U':  case 'V':  case 'W':  case 'X':
+		case 'Y':  case 'Z':
+		{
+			matchRange('A','Z');
+			break;
+		}
+		case '0':  case '1':  case '2':  case '3':
+		case '4':  case '5':  case '6':  case '7':
+		case '8':  case '9':
+		{
+			matchRange('0','9');
+			break;
+		}
+		case '.':
+		{
+			match('.');
+			break;
+		}
+		case ':':
+		{
+			match(':');
+			break;
+		}
+		case '/':
+		{
+			match('/');
+			break;
+		}
+		case '$':
+		{
+			match('$');
+			break;
+		}
+		case '#':
+		{
+			match('#');
+			break;
+		}
+		case '%':
+		{
+			match('%');
+			break;
+		}
+		case '&':
+		{
+			match('&');
+			break;
+		}
+		case '(':
+		{
+			match('(');
+			break;
+		}
+		case ')':
+		{
+			match(')');
+			break;
+		}
+		case '!':
+		{
+			match('!');
+			break;
+		}
+		case '+':
+		{
+			match('+');
+			break;
+		}
+		case '\\':
+		{
+			match('\\');
+			break;
+		}
+		case '_':
+		{
+			match('_');
+			break;
+		}
+		default:
+		{
+			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
+		}
+		}
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	public final void mSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = STRING;
+		int _saveIndex;
+		
+		{
+		switch ( LA(1)) {
+		case '!':  case '#':  case '$':  case '%':
+		case '&':  case '(':  case ')':  case '+':
+		case '.':  case '/':  case '0':  case '1':
+		case '2':  case '3':  case '4':  case '5':
+		case '6':  case '7':  case '8':  case '9':
+		case ':':  case 'A':  case 'B':  case 'C':
+		case 'D':  case 'E':  case 'F':  case 'G':
+		case 'H':  case 'I':  case 'J':  case 'K':
+		case 'L':  case 'M':  case 'N':  case 'O':
+		case 'P':  case 'Q':  case 'R':  case 'S':
+		case 'T':  case 'U':  case 'V':  case 'W':
+		case 'X':  case 'Y':  case 'Z':  case '\\':
+		case '_':  case 'a':  case 'b':  case 'c':
+		case 'd':  case 'e':  case 'f':  case 'g':
+		case 'h':  case 'i':  case 'j':  case 'k':
+		case 'l':  case 'm':  case 'n':  case 'o':
+		case 'p':  case 'q':  case 'r':  case 's':
+		case 't':  case 'u':  case 'v':  case 'w':
+		case 'x':  case 'y':  case 'z':
+		{
+			mCHARS(false);
+			{
+			_loop116:
+			do {
+				switch ( LA(1)) {
+				case '!':  case '#':  case '$':  case '%':
+				case '&':  case '(':  case ')':  case '+':
+				case '.':  case '/':  case '0':  case '1':
+				case '2':  case '3':  case '4':  case '5':
+				case '6':  case '7':  case '8':  case '9':
+				case ':':  case 'A':  case 'B':  case 'C':
+				case 'D':  case 'E':  case 'F':  case 'G':
+				case 'H':  case 'I':  case 'J':  case 'K':
+				case 'L':  case 'M':  case 'N':  case 'O':
+				case 'P':  case 'Q':  case 'R':  case 'S':
+				case 'T':  case 'U':  case 'V':  case 'W':
+				case 'X':  case 'Y':  case 'Z':  case '\\':
+				case '_':  case 'a':  case 'b':  case 'c':
+				case 'd':  case 'e':  case 'f':  case 'g':
+				case 'h':  case 'i':  case 'j':  case 'k':
+				case 'l':  case 'm':  case 'n':  case 'o':
+				case 'p':  case 'q':  case 'r':  case 's':
+				case 't':  case 'u':  case 'v':  case 'w':
+				case 'x':  case 'y':  case 'z':
+				{
+					mCHARS(false);
+					break;
+				}
+				case '-':
+				{
+					match('-');
+					break;
+				}
+				default:
+				{
+					break _loop116;
+				}
+				}
+			} while (true);
+			}
+			break;
+		}
+		case '"':
+		{
+			_saveIndex=text.length();
+			match('"');
+			text.setLength(_saveIndex);
+			{
+			_loop118:
+			do {
+				if ((_tokenSet_1.member(LA(1)))) {
+					matchNot('"');
+				}
+				else {
+					break _loop118;
+				}
+				
+			} while (true);
+			}
+			_saveIndex=text.length();
+			match('"');
+			text.setLength(_saveIndex);
+			break;
+		}
+		default:
+		{
+			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
+		}
+		}
+		}
+		String txt = new String(text.getBuffer(),_begin,text.length()-_begin);
+		txt = txt.replace('\\', '/');
+		text.setLength(_begin); text.append(txt);
+		
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	public final void mQNAME(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = QNAME;
+		int _saveIndex;
+		
+		match('<');
+		mSTRING(false);
+		match(" xmlns=\"");
+		mSTRING(false);
+		match("\">");
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	protected final void mALPHANUM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = ALPHANUM;
+		int _saveIndex;
+		
+		switch ( LA(1)) {
+		case 'A':  case 'B':  case 'C':  case 'D':
+		case 'E':  case 'F':  case 'G':  case 'H':
+		case 'I':  case 'J':  case 'K':  case 'L':
+		case 'M':  case 'N':  case 'O':  case 'P':
+		case 'Q':  case 'R':  case 'S':  case 'T':
+		case 'U':  case 'V':  case 'W':  case 'X':
+		case 'Y':  case 'Z':  case 'a':  case 'b':
+		case 'c':  case 'd':  case 'e':  case 'f':
+		case 'g':  case 'h':  case 'i':  case 'j':
+		case 'k':  case 'l':  case 'm':  case 'n':
+		case 'o':  case 'p':  case 'q':  case 'r':
+		case 's':  case 't':  case 'u':  case 'v':
+		case 'w':  case 'x':  case 'y':  case 'z':
+		{
+			mALPHA(false);
+			break;
+		}
+		case '0':  case '1':  case '2':  case '3':
+		case '4':  case '5':  case '6':  case '7':
+		case '8':  case '9':
+		{
+			mDIGIT(false);
+			break;
+		}
+		default:
+		{
+			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
+		}
+		}
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	protected final void mALPHA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = ALPHA;
+		int _saveIndex;
+		
+		switch ( LA(1)) {
+		case 'a':  case 'b':  case 'c':  case 'd':
+		case 'e':  case 'f':  case 'g':  case 'h':
+		case 'i':  case 'j':  case 'k':  case 'l':
+		case 'm':  case 'n':  case 'o':  case 'p':
+		case 'q':  case 'r':  case 's':  case 't':
+		case 'u':  case 'v':  case 'w':  case 'x':
+		case 'y':  case 'z':
+		{
+			mLOWALPHA(false);
+			break;
+		}
+		case 'A':  case 'B':  case 'C':  case 'D':
+		case 'E':  case 'F':  case 'G':  case 'H':
+		case 'I':  case 'J':  case 'K':  case 'L':
+		case 'M':  case 'N':  case 'O':  case 'P':
+		case 'Q':  case 'R':  case 'S':  case 'T':
+		case 'U':  case 'V':  case 'W':  case 'X':
+		case 'Y':  case 'Z':
+		{
+			mUPALPHA(false);
+			break;
+		}
+		default:
+		{
+			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
+		}
+		}
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = DIGIT;
+		int _saveIndex;
+		
+		matchRange('0','9');
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	protected final void mLOWALPHA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = LOWALPHA;
+		int _saveIndex;
+		
+		matchRange('a','z');
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	protected final void mUPALPHA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = UPALPHA;
+		int _saveIndex;
+		
+		matchRange('A','Z');
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	public final void mQUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
+		int _ttype; Token _token=null; int _begin=text.length();
+		_ttype = QUESTION;
+		int _saveIndex;
+		
+		match('?');
+		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
+			_token = makeToken(_ttype);
+			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
+		}
+		_returnToken = _token;
+	}
+	
+	
+	private static final long[] mk_tokenSet_0() {
+		long[] data = new long[1025];
+		data[0]=576403002173161472L;
+		data[1]=576460746263625726L;
+		return data;
+	}
+	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
+	private static final long[] mk_tokenSet_1() {
+		long[] data = new long[2048];
+		data[0]=-17179869192L;
+		for (int i = 1; i<=1023; i++) { data[i]=-1L; }
+		return data;
+	}
+	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
+	
+	}

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/ClientParser.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/ClientParser.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/ClientParser.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,2856 @@
+// $ANTLR 2.7.3: "Client.g" -> "ClientParser.java"$
+
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/commandline/src/java/org/apache/webdav/cmd/ClientParser.java,v 1.9 2004/08/02 15:45:50 unico Exp $
+ * $Revision: 1.9 $
+ * $Date: 2004/08/02 15:45:50 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.cmd;
+
+import java.io.*;
+import java.util.*;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.util.QName;
+
+
+import antlr.TokenBuffer;
+import antlr.TokenStreamException;
+import antlr.TokenStreamIOException;
+import antlr.ANTLRException;
+import antlr.LLkParser;
+import antlr.Token;
+import antlr.TokenStream;
+import antlr.RecognitionException;
+import antlr.NoViableAltException;
+import antlr.MismatchedTokenException;
+import antlr.SemanticException;
+import antlr.ParserSharedInputState;
+import antlr.collections.impl.BitSet;
+
+/**
+ * The Slide WebDAV client parser.
+ *
+ * @version     $Revision: 1.9 $ $Date: 2004/08/02 15:45:50 $
+ */
+public class ClientParser extends antlr.LLkParser       implements SlideTokenTypes
+ {
+
+
+    // ------------------------------------------------------------- properties
+
+    /**
+     * The Slide WebDAV client.
+     */
+    protected Client client;
+    
+    // --------------------------------------------------------- helper methods
+
+    /**
+     * Set a client.
+     *
+     * @param client a client
+     */
+    void setClient(Client client) {
+        this.client = client;
+    }
+
+
+    /**
+     * Get the text from a token.
+     *
+     * @param token a token
+     * @return the token string
+     */
+    private String text(Token token) {
+        return (token != null) ? token.getText() : null;
+    }
+    
+
+    /**
+     * Get the qualified name from a token.
+     *
+     * @param token a token
+     * @return the qualified name
+     */
+    private QName qname(Token token) {
+        if (token == null) return null;
+
+        String tmp = token.getText();
+        if (!tmp.startsWith("<")) {
+            return new PropertyName("DAV:", text(token));
+        }
+        String namespaceURI = tmp.substring(tmp.indexOf('"') + 1,
+                tmp.lastIndexOf('"'));
+        String localName = tmp.substring(1, tmp.indexOf(' '));
+        
+        return new QName(namespaceURI, localName);
+    }
+
+    
+    /**
+     * Get the property name from a token.
+     *
+     * @param token a token
+     * @return the property name
+     */
+    private PropertyName pname(Token token) {
+        if (token == null) return null;
+
+        String tmp = token.getText();
+        if (!tmp.startsWith("<")) {
+            return new PropertyName("DAV:", text(token));
+        }
+
+        String namespaceURI = tmp.substring(tmp.indexOf('"') + 1,
+                tmp.lastIndexOf('"'));
+        String localName = tmp.substring(1, tmp.indexOf(' '));
+        
+        return new PropertyName(namespaceURI, localName);
+    }
+
+    
+    /**
+     * Print the usage for a given command.
+     *
+     * @param command a command
+     */
+    private void printUsage(String command)
+        throws RecognitionException, TokenStreamException {
+
+        client.printUsage(command);
+        skip(); // skip the rest of the line
+    }
+
+
+protected ClientParser(TokenBuffer tokenBuf, int k) {
+  super(tokenBuf,k);
+  tokenNames = _tokenNames;
+}
+
+public ClientParser(TokenBuffer tokenBuf) {
+  this(tokenBuf,2);
+}
+
+protected ClientParser(TokenStream lexer, int k) {
+  super(lexer,k);
+  tokenNames = _tokenNames;
+}
+
+public ClientParser(TokenStream lexer) {
+  this(lexer,2);
+}
+
+public ClientParser(ParserSharedInputState state) {
+  super(state,2);
+  tokenNames = _tokenNames;
+}
+
+	public final void commands() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			
+			client.prompt();
+			
+			{
+			int _cnt3=0;
+			_loop3:
+			do {
+				if ((_tokenSet_0.member(LA(1)))) {
+					command();
+					
+					client.prompt();
+					
+				}
+				else {
+					if ( _cnt3>=1 ) { break _loop3; } else {throw new NoViableAltException(LT(1), getFilename());}
+				}
+				
+				_cnt3++;
+			} while (true);
+			}
+		}
+		catch (ANTLRException ex) {
+			
+			// XXX bad hack for bug #28100
+			if (ex.toString().indexOf("null") != -1) System.exit(-1);
+			// handle parse errors gracefully
+			client.print("Error: "+ex.toString());
+			
+		}
+	}
+	
+	public final void command() throws RecognitionException, TokenStreamException {
+		
+		
+		{
+		switch ( LA(1)) {
+		case EXIT:
+		case QUIT:
+		case BYE:
+		{
+			exit();
+			break;
+		}
+		case HELP:
+		case QUESTION:
+		{
+			help();
+			break;
+		}
+		case STRING:
+		{
+			invalid();
+			break;
+		}
+		case EOL:
+		{
+			nothing();
+			break;
+		}
+		case SPOOL:
+		{
+			spool();
+			break;
+		}
+		case RUN:
+		{
+			run();
+			break;
+		}
+		case ECHO:
+		{
+			echo();
+			break;
+		}
+		case DEBUG:
+		{
+			debug();
+			break;
+		}
+		case STATUS:
+		{
+			status();
+			break;
+		}
+		case OPTIONS:
+		{
+			optionsmethod();
+			break;
+		}
+		case CONNECT:
+		case OPEN:
+		{
+			connect();
+			break;
+		}
+		case DISCONNECT:
+		{
+			disconnect();
+			break;
+		}
+		case LPWD:
+		{
+			lpwd();
+			break;
+		}
+		case LCD:
+		{
+			lcd();
+			break;
+		}
+		case LLS:
+		case LDIR:
+		{
+			lls();
+			break;
+		}
+		case PWC:
+		case PWD:
+		{
+			pwc();
+			break;
+		}
+		case CD:
+		case CC:
+		{
+			cd();
+			break;
+		}
+		case LS:
+		case DIR:
+		{
+			ls();
+			break;
+		}
+		case MKCOL:
+		case MKDIR:
+		{
+			mkcol();
+			break;
+		}
+		case MOVE:
+		{
+			move();
+			break;
+		}
+		case COPY:
+		{
+			copy();
+			break;
+		}
+		case DELETE:
+		case DEL:
+		case RM:
+		{
+			delete();
+			break;
+		}
+		case GET:
+		{
+			get();
+			break;
+		}
+		case PUT:
+		{
+			put();
+			break;
+		}
+		case PROPFIND:
+		case PROPGET:
+		{
+			propfind();
+			break;
+		}
+		case PROPFINDALL:
+		case PROPGETALL:
+		{
+			propfindall();
+			break;
+		}
+		case PROPPATCH:
+		case PROPSET:
+		{
+			proppatch();
+			break;
+		}
+		case LOCK:
+		{
+			lock();
+			break;
+		}
+		case UNLOCK:
+		{
+			unlock();
+			break;
+		}
+		case LOCKS:
+		{
+			locks();
+			break;
+		}
+		case GRANT:
+		{
+			grant();
+			break;
+		}
+		case DENY:
+		{
+			deny();
+			break;
+		}
+		case REVOKE:
+		{
+			revoke();
+			break;
+		}
+		case ACL:
+		{
+			acl();
+			break;
+		}
+		case PRINCIPALCOLLECTIONSET:
+		{
+			principalcollectionset();
+			break;
+		}
+		case VERSIONCONTROL:
+		{
+			versioncontrol();
+			break;
+		}
+		case REPORT:
+		{
+			report();
+			break;
+		}
+		case EREPORT:
+		{
+			ereport();
+			break;
+		}
+		case LREPORT:
+		{
+			lreport();
+			break;
+		}
+		case MKWS:
+		{
+			mkws();
+			break;
+		}
+		case CHECKIN:
+		{
+			checkin();
+			break;
+		}
+		case CHECKOUT:
+		{
+			checkout();
+			break;
+		}
+		case UNCHECKOUT:
+		{
+			uncheckout();
+			break;
+		}
+		case UPDATE:
+		{
+			update();
+			break;
+		}
+		case BEGIN:
+		{
+			begin();
+			break;
+		}
+		case COMMIT:
+		{
+			commit();
+			break;
+		}
+		case ABORT:
+		{
+			abort();
+			break;
+		}
+		default:
+		{
+			throw new NoViableAltException(LT(1), getFilename());
+		}
+		}
+		}
+	}
+	
+	public final void exit() throws RecognitionException, TokenStreamException {
+		
+		
+		{
+		switch ( LA(1)) {
+		case EXIT:
+		{
+			match(EXIT);
+			break;
+		}
+		case QUIT:
+		{
+			match(QUIT);
+			break;
+		}
+		case BYE:
+		{
+			match(BYE);
+			break;
+		}
+		default:
+		{
+			throw new NoViableAltException(LT(1), getFilename());
+		}
+		}
+		}
+		match(EOL);
+		
+		System.exit(0);
+		
+	}
+	
+	public final void help() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case HELP:
+			{
+				match(HELP);
+				break;
+			}
+			case QUESTION:
+			{
+				match(QUESTION);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.help(null);
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("help");
+			
+		}
+	}
+	
+	public final void invalid() throws RecognitionException, TokenStreamException {
+		
+		Token  cmd = null;
+		
+		cmd = LT(1);
+		match(STRING);
+		{
+		_loop101:
+		do {
+			if ((LA(1)==STRING)) {
+				match(STRING);
+			}
+			else {
+				break _loop101;
+			}
+			
+		} while (true);
+		}
+		match(EOL);
+		
+		client.printInvalidCommand(text(cmd));
+		
+	}
+	
+	public final void nothing() throws RecognitionException, TokenStreamException {
+		
+		
+		match(EOL);
+	}
+	
+	public final void spool() throws RecognitionException, TokenStreamException {
+		
+		Token  file = null;
+		
+		try {      // for error handling
+			match(SPOOL);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				file = LT(1);
+				match(STRING);
+				break;
+			}
+			case OFF:
+			{
+				match(OFF);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			if (file != null) {
+			client.enableSpoolToFile(text(file));
+			} else {
+			client.disableSpoolToFile();
+			}
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("spool");
+			
+		}
+	}
+	
+	public final void run() throws RecognitionException, TokenStreamException {
+		
+		Token  script = null;
+		
+		try {      // for error handling
+			match(RUN);
+			script = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.executeScript(text(script));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("run");
+			
+		}
+	}
+	
+	public final void echo() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			match(ECHO);
+			
+			boolean isEnabled;
+			
+			{
+			switch ( LA(1)) {
+			case ON:
+			{
+				match(ON);
+				
+				isEnabled = true;
+				
+				break;
+			}
+			case OFF:
+			{
+				match(OFF);
+				
+				isEnabled = true;
+				
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.setEchoEnabled(isEnabled);
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("echo");
+			
+		}
+	}
+	
+	public final void debug() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			
+			int level;
+			
+			match(DEBUG);
+			{
+			switch ( LA(1)) {
+			case ON:
+			{
+				match(ON);
+				
+				level = Client.DEBUG_ON;
+				
+				break;
+			}
+			case OFF:
+			{
+				match(OFF);
+				
+				level = Client.DEBUG_OFF;
+				
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.setDebug(level);
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("debug");
+			
+		}
+	}
+	
+	public final void status() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			match(STATUS);
+			match(EOL);
+			
+			client.status();
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("status");
+			
+		}
+	}
+	
+	public final void optionsmethod() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			match(OPTIONS);
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.options(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("options");
+			
+		}
+	}
+	
+	public final void connect() throws RecognitionException, TokenStreamException {
+		
+		Token  uri = null;
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case CONNECT:
+			{
+				match(CONNECT);
+				break;
+			}
+			case OPEN:
+			{
+				match(OPEN);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			uri = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.connect(text(uri));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("connect");
+			
+		}
+	}
+	
+	public final void disconnect() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			match(DISCONNECT);
+			match(EOL);
+			
+			client.disconnect();
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("disconnect");
+			
+		}
+	}
+	
+	public final void lpwd() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			match(LPWD);
+			match(EOL);
+			
+			client.lpwd();
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("lpwd");
+			
+		}
+	}
+	
+	public final void lcd() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			match(LCD);
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.lcd(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("lcd");
+			
+		}
+	}
+	
+	public final void lls() throws RecognitionException, TokenStreamException {
+		
+		Token  option = null;
+		Token  path = null;
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case LLS:
+			{
+				match(LLS);
+				break;
+			}
+			case LDIR:
+			{
+				match(LDIR);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case OPTIONSTRING:
+			{
+				option = LT(1);
+				match(OPTIONSTRING);
+				break;
+			}
+			case EOL:
+			case STRING:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.lls(text(option), text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("lls");
+			
+		}
+	}
+	
+	public final void pwc() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case PWC:
+			{
+				match(PWC);
+				break;
+			}
+			case PWD:
+			{
+				match(PWD);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.pwc();
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("pwc");
+			
+		}
+	}
+	
+	public final void cd() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case CD:
+			{
+				match(CD);
+				break;
+			}
+			case CC:
+			{
+				match(CC);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.cd(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("cd");
+			
+		}
+	}
+	
+	public final void ls() throws RecognitionException, TokenStreamException {
+		
+		Token  option = null;
+		Token  path = null;
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case LS:
+			{
+				match(LS);
+				break;
+			}
+			case DIR:
+			{
+				match(DIR);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case OPTIONSTRING:
+			{
+				option = LT(1);
+				match(OPTIONSTRING);
+				break;
+			}
+			case EOL:
+			case STRING:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.ls(text(option), text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("ls");
+			
+		}
+	}
+	
+	public final void mkcol() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case MKCOL:
+			{
+				match(MKCOL);
+				break;
+			}
+			case MKDIR:
+			{
+				match(MKDIR);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.mkcol(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("mkcol");
+			
+		}
+	}
+	
+	public final void move() throws RecognitionException, TokenStreamException {
+		
+		Token  source = null;
+		Token  destination = null;
+		
+		try {      // for error handling
+			match(MOVE);
+			source = LT(1);
+			match(STRING);
+			destination = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.move(text(source), text(destination));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("move");
+			
+		}
+	}
+	
+	public final void copy() throws RecognitionException, TokenStreamException {
+		
+		Token  source = null;
+		Token  destination = null;
+		
+		try {      // for error handling
+			match(COPY);
+			source = LT(1);
+			match(STRING);
+			destination = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.copy(text(source), text(destination));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("copy");
+			
+		}
+	}
+	
+	public final void delete() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case DELETE:
+			{
+				match(DELETE);
+				break;
+			}
+			case DEL:
+			{
+				match(DEL);
+				break;
+			}
+			case RM:
+			{
+				match(RM);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.delete(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("delete");
+			
+		}
+	}
+	
+	public final void get() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		Token  file = null;
+		
+		try {      // for error handling
+			match(GET);
+			path = LT(1);
+			match(STRING);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				file = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.get(text(path), text(file));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("get");
+			
+		}
+	}
+	
+	public final void put() throws RecognitionException, TokenStreamException {
+		
+		Token  file = null;
+		Token  path = null;
+		
+		try {      // for error handling
+			match(PUT);
+			file = LT(1);
+			match(STRING);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.put(text(file), text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("put");
+			
+		}
+	}
+	
+	public final void propfind() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		Token  prop = null;
+		Token  nsprop = null;
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case PROPFIND:
+			{
+				match(PROPFIND);
+				break;
+			}
+			case PROPGET:
+			{
+				match(PROPGET);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			path = LT(1);
+			match(STRING);
+			
+			Vector properties = new Vector();
+			
+			{
+			int _cnt43=0;
+			_loop43:
+			do {
+				switch ( LA(1)) {
+				case STRING:
+				{
+					prop = LT(1);
+					match(STRING);
+					
+					properties.add(pname(prop));
+					
+					break;
+				}
+				case QNAME:
+				{
+					nsprop = LT(1);
+					match(QNAME);
+					
+					properties.add(pname(nsprop));
+					
+					break;
+				}
+				default:
+				{
+					if ( _cnt43>=1 ) { break _loop43; } else {throw new NoViableAltException(LT(1), getFilename());}
+				}
+				}
+				_cnt43++;
+			} while (true);
+			}
+			match(EOL);
+			
+			client.propfind(text(path), properties);
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("propfind");
+			
+		}
+	}
+	
+	public final void propfindall() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case PROPFINDALL:
+			{
+				match(PROPFINDALL);
+				break;
+			}
+			case PROPGETALL:
+			{
+				match(PROPGETALL);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.propfindall(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("propfindall");
+			
+		}
+	}
+	
+	public final void proppatch() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		Token  prop = null;
+		Token  value = null;
+		
+		try {      // for error handling
+			{
+			switch ( LA(1)) {
+			case PROPPATCH:
+			{
+				match(PROPPATCH);
+				break;
+			}
+			case PROPSET:
+			{
+				match(PROPSET);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			path = LT(1);
+			match(STRING);
+			prop = LT(1);
+			match(STRING);
+			value = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.proppatch(text(path), text(prop), text(value));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("proppatch");
+			
+		}
+	}
+	
+	public final void lock() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		Token  os1 = null;
+		Token  os2 = null;
+		Token  os3 = null;
+		
+		try {      // for error handling
+			match(LOCK);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			case OPTIONSTRING:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case OPTIONSTRING:
+			{
+				os1 = LT(1);
+				match(OPTIONSTRING);
+				{
+				switch ( LA(1)) {
+				case OPTIONSTRING:
+				{
+					os2 = LT(1);
+					match(OPTIONSTRING);
+					{
+					switch ( LA(1)) {
+					case OPTIONSTRING:
+					{
+						os3 = LT(1);
+						match(OPTIONSTRING);
+						break;
+					}
+					case EOL:
+					{
+						break;
+					}
+					default:
+					{
+						throw new NoViableAltException(LT(1), getFilename());
+					}
+					}
+					}
+					break;
+				}
+				case EOL:
+				{
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(LT(1), getFilename());
+				}
+				}
+				}
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			
+				        String[] opt = {text(os1), text(os2), text(os3), null};
+				        
+				        int parNr[]  = {3, 3, 3};
+				        String err = null;
+				            
+				        for (int i = 0 ; i< opt.length ;i++) {
+				            
+				            if (opt[i] != null) {
+			
+				                if ( opt[i].toLowerCase().startsWith("-t")) {
+				                    parNr[0] = i;
+				                } else
+			
+				                if ( opt[i].toLowerCase().startsWith("-s")) {
+				                    parNr[1] = i;
+				                } else
+				                
+				                if ( opt[i].toLowerCase().startsWith("-o")) {
+				                    parNr[2] = i;
+				                } else {
+				                    err = "Wrong parameter: "+ opt[i];
+				                }
+				            }
+				        }
+			
+					if (err == null)
+				client.lock(text(path), opt[parNr[0]], opt[parNr[1]], opt[parNr[2]]);
+			else
+				client.print(err); 	
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("lock");
+			
+		}
+	}
+	
+	public final void unlock() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		Token  os = null;
+		
+		try {      // for error handling
+			match(UNLOCK);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			case OPTIONSTRING:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case OPTIONSTRING:
+			{
+				os = LT(1);
+				match(OPTIONSTRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			String owner = text(os);
+			String err = null;
+				
+			
+				        if ((owner != null) && (!owner.toLowerCase().startsWith("-o")) ) {
+			err = "Wrong parameter: "+ owner;
+			}
+			client.unlock(text(path), owner);
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("unlock");
+			
+		}
+	}
+	
+	public final void locks() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			match(LOCKS);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.locks(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("locks");
+			
+		}
+	}
+	
+	public final void grant() throws RecognitionException, TokenStreamException {
+		
+		Token  permission = null;
+		Token  nspermisssion = null;
+		Token  path = null;
+		Token  principal = null;
+		
+		try {      // for error handling
+			match(GRANT);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				permission = LT(1);
+				match(STRING);
+				break;
+			}
+			case QNAME:
+			{
+				nspermisssion = LT(1);
+				match(QNAME);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case ON:
+			{
+				match(ON);
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case TO:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(TO);
+			principal = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			if (permission != null)
+			client.grant(text(permission), text(path), text(principal));
+			else
+			client.grant(qname(nspermisssion), text(path), text(principal));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			client.printUsage("grant");
+			
+		}
+	}
+	
+	public final void deny() throws RecognitionException, TokenStreamException {
+		
+		Token  permission = null;
+		Token  nspermisssion = null;
+		Token  path = null;
+		Token  principal = null;
+		
+		try {      // for error handling
+			match(DENY);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				permission = LT(1);
+				match(STRING);
+				break;
+			}
+			case QNAME:
+			{
+				nspermisssion = LT(1);
+				match(QNAME);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case ON:
+			{
+				match(ON);
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case TO:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(TO);
+			principal = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			if (permission != null)
+			client.deny(text(permission), text(path), text(principal));
+			else
+			client.deny(qname(nspermisssion), text(path), text(principal));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			client.printUsage("deny");
+			
+		}
+	}
+	
+	public final void revoke() throws RecognitionException, TokenStreamException {
+		
+		Token  permission = null;
+		Token  nspermisssion = null;
+		Token  path = null;
+		Token  principal = null;
+		
+		try {      // for error handling
+			match(REVOKE);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				permission = LT(1);
+				match(STRING);
+				break;
+			}
+			case QNAME:
+			{
+				nspermisssion = LT(1);
+				match(QNAME);
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			{
+			switch ( LA(1)) {
+			case ON:
+			{
+				match(ON);
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case FROM:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(FROM);
+			principal = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			if (permission != null)
+			client.revoke(text(permission), text(path), text(principal));
+			else
+			client.revoke(qname(nspermisssion), text(path),
+			text(principal));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			client.printUsage("revoke");
+			
+		}
+	}
+	
+	public final void acl() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			match(ACL);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.acl(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("acl");
+			
+		}
+	}
+	
+	public final void principalcollectionset() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			match(PRINCIPALCOLLECTIONSET);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				path = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.principalcollectionset(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("principalcollectionset");
+			
+		}
+	}
+	
+	public final void versioncontrol() throws RecognitionException, TokenStreamException {
+		
+		Token  target = null;
+		Token  path = null;
+		
+		try {      // for error handling
+			match(VERSIONCONTROL);
+			{
+			if ((LA(1)==STRING) && (LA(2)==STRING)) {
+				target = LT(1);
+				match(STRING);
+			}
+			else if ((LA(1)==STRING) && (LA(2)==EOL)) {
+			}
+			else {
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			
+			}
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			if (target == null)
+			client.versioncontrol(text(path));
+			else
+			client.versioncontrol(text(target), text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("versioncontrol");
+			
+		}
+	}
+	
+	public final void report() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		Token  prop = null;
+		Token  nsprop = null;
+		
+		try {      // for error handling
+			match(REPORT);
+			path = LT(1);
+			match(STRING);
+			
+			Vector properties = new Vector();
+			
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				prop = LT(1);
+				match(STRING);
+				
+				properties.add(pname(prop));
+				
+				break;
+			}
+			case QNAME:
+			{
+				nsprop = LT(1);
+				match(QNAME);
+				
+				properties.add(pname(nsprop));
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.report(text(path), properties);
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("report");
+			
+		}
+	}
+	
+	public final void ereport() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		Token  filename = null;
+		
+		try {      // for error handling
+			match(EREPORT);
+			path = LT(1);
+			match(STRING);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				filename = LT(1);
+				match(STRING);
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.ereport(text(path), text(filename));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("ereport");
+			
+		}
+	}
+	
+	public final void lreport() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		Token  prop = null;
+		Token  nsprop = null;
+		Token  uri = null;
+		
+		try {      // for error handling
+			match(LREPORT);
+			path = LT(1);
+			match(STRING);
+			
+			Vector properties = new Vector();
+			
+			{
+			int _cnt93=0;
+			_loop93:
+			do {
+				switch ( LA(1)) {
+				case STRING:
+				{
+					prop = LT(1);
+					match(STRING);
+					
+					properties.add(pname(prop));
+					
+					break;
+				}
+				case QNAME:
+				{
+					nsprop = LT(1);
+					match(QNAME);
+					
+					properties.add(pname(nsprop));
+					
+					break;
+				}
+				default:
+				{
+					if ( _cnt93>=1 ) { break _loop93; } else {throw new NoViableAltException(LT(1), getFilename());}
+				}
+				}
+				_cnt93++;
+			} while (true);
+			}
+			match(ON);
+			
+			Vector historyUris = new Vector();
+			
+			{
+			int _cnt95=0;
+			_loop95:
+			do {
+				if ((LA(1)==STRING)) {
+					uri = LT(1);
+					match(STRING);
+					
+					historyUris.add(text(uri));
+					
+				}
+				else {
+					if ( _cnt95>=1 ) { break _loop95; } else {throw new NoViableAltException(LT(1), getFilename());}
+				}
+				
+				_cnt95++;
+			} while (true);
+			}
+			match(EOL);
+			
+			client.lreport(text(path), properties, historyUris);
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("lreport");
+			
+		}
+	}
+	
+	public final void mkws() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			match(MKWS);
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.mkws(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("mkws");
+			
+		}
+	}
+	
+	public final void checkin() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			match(CHECKIN);
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.checkin(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("checkin");
+			
+		}
+	}
+	
+	public final void checkout() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			match(CHECKOUT);
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.checkout(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("checkout");
+			
+		}
+	}
+	
+	public final void uncheckout() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		
+		try {      // for error handling
+			match(UNCHECKOUT);
+			path = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.uncheckout(text(path));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("uncheckout");
+			
+		}
+	}
+	
+	public final void update() throws RecognitionException, TokenStreamException {
+		
+		Token  path = null;
+		Token  target = null;
+		
+		try {      // for error handling
+			match(UPDATE);
+			path = LT(1);
+			match(STRING);
+			target = LT(1);
+			match(STRING);
+			match(EOL);
+			
+			client.update(text(path), text(target));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("update <path> <historyURL>");
+			
+		}
+	}
+	
+	public final void begin() throws RecognitionException, TokenStreamException {
+		
+		Token  timeout = null;
+		Token  owner = null;
+		
+		try {      // for error handling
+			match(BEGIN);
+			{
+			switch ( LA(1)) {
+			case STRING:
+			{
+				timeout = LT(1);
+				match(STRING);
+				{
+				switch ( LA(1)) {
+				case STRING:
+				{
+					owner = LT(1);
+					match(STRING);
+					break;
+				}
+				case EOL:
+				{
+					break;
+				}
+				default:
+				{
+					throw new NoViableAltException(LT(1), getFilename());
+				}
+				}
+				}
+				break;
+			}
+			case EOL:
+			{
+				break;
+			}
+			default:
+			{
+				throw new NoViableAltException(LT(1), getFilename());
+			}
+			}
+			}
+			match(EOL);
+			
+			client.beginTransaction(text(timeout), text(owner));
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("begin");
+			
+		}
+	}
+	
+	public final void commit() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			match(COMMIT);
+			
+			client.commitTransaction();
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("commit");
+			
+		}
+	}
+	
+	public final void abort() throws RecognitionException, TokenStreamException {
+		
+		
+		try {      // for error handling
+			match(ABORT);
+			
+			client.abortTransaction();
+			
+		}
+		catch (RecognitionException ex) {
+			
+			printUsage("abort");
+			
+		}
+	}
+	
+	public final void skip() throws RecognitionException, TokenStreamException {
+		
+		
+		{
+		_loop105:
+		do {
+			switch ( LA(1)) {
+			case STRING:
+			{
+				match(STRING);
+				break;
+			}
+			case HELP:
+			case QUESTION:
+			case STATUS:
+			case SPOOL:
+			case OFF:
+			case RUN:
+			case ECHO:
+			case ON:
+			case DEBUG:
+			case OPTIONS:
+			case CONNECT:
+			case OPEN:
+			case DISCONNECT:
+			case LPWD:
+			case PWC:
+			case PWD:
+			case LCD:
+			case CD:
+			case CC:
+			case LLS:
+			case LDIR:
+			case LS:
+			case DIR:
+			case MKCOL:
+			case MKDIR:
+			case MOVE:
+			case COPY:
+			case DELETE:
+			case DEL:
+			case RM:
+			case PROPFIND:
+			case PROPGET:
+			case PROPFINDALL:
+			case PROPGETALL:
+			case PROPPATCH:
+			case GET:
+			case PUT:
+			case BEGIN:
+			case COMMIT:
+			case ABORT:
+			case LOCK:
+			case UNLOCK:
+			case LOCKS:
+			case GRANT:
+			case TO:
+			case DENY:
+			case REVOKE:
+			case FROM:
+			case ACL:
+			case PRINCIPALCOLLECTIONSET:
+			case VERSIONCONTROL:
+			case UPDATE:
+			case CHECKIN:
+			case CHECKOUT:
+			case UNCHECKOUT:
+			case REPORT:
+			case EREPORT:
+			case LREPORT:
+			case MKWS:
+			case EXIT:
+			case QUIT:
+			case BYE:
+			case SET:
+			case CLOSE:
+			case CP:
+			case MV:
+			case PROPPUT:
+			case PRINCIPALCOL:
+			{
+				all_tokens();
+				break;
+			}
+			default:
+			{
+				break _loop105;
+			}
+			}
+		} while (true);
+		}
+		match(EOL);
+		/* skip all */
+	}
+	
+	public final void all_tokens() throws RecognitionException, TokenStreamException {
+		
+		
+		switch ( LA(1)) {
+		case EXIT:
+		{
+			match(EXIT);
+			break;
+		}
+		case QUIT:
+		{
+			match(QUIT);
+			break;
+		}
+		case BYE:
+		{
+			match(BYE);
+			break;
+		}
+		case HELP:
+		{
+			match(HELP);
+			break;
+		}
+		case QUESTION:
+		{
+			match(QUESTION);
+			break;
+		}
+		case RUN:
+		{
+			match(RUN);
+			break;
+		}
+		case SPOOL:
+		{
+			match(SPOOL);
+			break;
+		}
+		case STATUS:
+		{
+			match(STATUS);
+			break;
+		}
+		case ECHO:
+		{
+			match(ECHO);
+			break;
+		}
+		case ON:
+		{
+			match(ON);
+			break;
+		}
+		case OFF:
+		{
+			match(OFF);
+			break;
+		}
+		case SET:
+		{
+			match(SET);
+			break;
+		}
+		case DEBUG:
+		{
+			match(DEBUG);
+			break;
+		}
+		case OPTIONS:
+		{
+			match(OPTIONS);
+			break;
+		}
+		case OPEN:
+		{
+			match(OPEN);
+			break;
+		}
+		case CONNECT:
+		{
+			match(CONNECT);
+			break;
+		}
+		case CLOSE:
+		{
+			match(CLOSE);
+			break;
+		}
+		case DISCONNECT:
+		{
+			match(DISCONNECT);
+			break;
+		}
+		case LPWD:
+		{
+			match(LPWD);
+			break;
+		}
+		case LCD:
+		{
+			match(LCD);
+			break;
+		}
+		case LLS:
+		{
+			match(LLS);
+			break;
+		}
+		case LDIR:
+		{
+			match(LDIR);
+			break;
+		}
+		case PWC:
+		{
+			match(PWC);
+			break;
+		}
+		case PWD:
+		{
+			match(PWD);
+			break;
+		}
+		case CC:
+		{
+			match(CC);
+			break;
+		}
+		case CD:
+		{
+			match(CD);
+			break;
+		}
+		case LS:
+		{
+			match(LS);
+			break;
+		}
+		case DIR:
+		{
+			match(DIR);
+			break;
+		}
+		case GET:
+		{
+			match(GET);
+			break;
+		}
+		case PUT:
+		{
+			match(PUT);
+			break;
+		}
+		case MKCOL:
+		{
+			match(MKCOL);
+			break;
+		}
+		case MKDIR:
+		{
+			match(MKDIR);
+			break;
+		}
+		case DELETE:
+		{
+			match(DELETE);
+			break;
+		}
+		case DEL:
+		{
+			match(DEL);
+			break;
+		}
+		case RM:
+		{
+			match(RM);
+			break;
+		}
+		case COPY:
+		{
+			match(COPY);
+			break;
+		}
+		case CP:
+		{
+			match(CP);
+			break;
+		}
+		case MOVE:
+		{
+			match(MOVE);
+			break;
+		}
+		case MV:
+		{
+			match(MV);
+			break;
+		}
+		case LOCK:
+		{
+			match(LOCK);
+			break;
+		}
+		case UNLOCK:
+		{
+			match(UNLOCK);
+			break;
+		}
+		case LOCKS:
+		{
+			match(LOCKS);
+			break;
+		}
+		case PROPGET:
+		{
+			match(PROPGET);
+			break;
+		}
+		case PROPFIND:
+		{
+			match(PROPFIND);
+			break;
+		}
+		case PROPGETALL:
+		{
+			match(PROPGETALL);
+			break;
+		}
+		case PROPFINDALL:
+		{
+			match(PROPFINDALL);
+			break;
+		}
+		case PROPPUT:
+		{
+			match(PROPPUT);
+			break;
+		}
+		case PROPPATCH:
+		{
+			match(PROPPATCH);
+			break;
+		}
+		case ACL:
+		{
+			match(ACL);
+			break;
+		}
+		case PRINCIPALCOL:
+		{
+			match(PRINCIPALCOL);
+			break;
+		}
+		case GRANT:
+		{
+			match(GRANT);
+			break;
+		}
+		case DENY:
+		{
+			match(DENY);
+			break;
+		}
+		case REVOKE:
+		{
+			match(REVOKE);
+			break;
+		}
+		case TO:
+		{
+			match(TO);
+			break;
+		}
+		case FROM:
+		{
+			match(FROM);
+			break;
+		}
+		case PRINCIPALCOLLECTIONSET:
+		{
+			match(PRINCIPALCOLLECTIONSET);
+			break;
+		}
+		case VERSIONCONTROL:
+		{
+			match(VERSIONCONTROL);
+			break;
+		}
+		case REPORT:
+		{
+			match(REPORT);
+			break;
+		}
+		case EREPORT:
+		{
+			match(EREPORT);
+			break;
+		}
+		case LREPORT:
+		{
+			match(LREPORT);
+			break;
+		}
+		case MKWS:
+		{
+			match(MKWS);
+			break;
+		}
+		case CHECKIN:
+		{
+			match(CHECKIN);
+			break;
+		}
+		case CHECKOUT:
+		{
+			match(CHECKOUT);
+			break;
+		}
+		case UNCHECKOUT:
+		{
+			match(UNCHECKOUT);
+			break;
+		}
+		case UPDATE:
+		{
+			match(UPDATE);
+			break;
+		}
+		case BEGIN:
+		{
+			match(BEGIN);
+			break;
+		}
+		case COMMIT:
+		{
+			match(COMMIT);
+			break;
+		}
+		case ABORT:
+		{
+			match(ABORT);
+			break;
+		}
+		default:
+		{
+			throw new NoViableAltException(LT(1), getFilename());
+		}
+		}
+	}
+	
+	
+	public static final String[] _tokenNames = {
+		"<0>",
+		"EOF",
+		"<2>",
+		"NULL_TREE_LOOKAHEAD",
+		"\"help\"",
+		"QUESTION",
+		"EOL",
+		"\"status\"",
+		"\"spool\"",
+		"STRING",
+		"\"off\"",
+		"\"run\"",
+		"\"echo\"",
+		"\"on\"",
+		"\"debug\"",
+		"\"options\"",
+		"\"connect\"",
+		"\"open\"",
+		"\"disconnect\"",
+		"\"lpwd\"",
+		"\"pwc\"",
+		"\"pwd\"",
+		"\"lcd\"",
+		"\"cd\"",
+		"\"cc\"",
+		"\"lls\"",
+		"\"ldir\"",
+		"OPTIONSTRING",
+		"\"ls\"",
+		"\"dir\"",
+		"\"mkcol\"",
+		"\"mkdir\"",
+		"\"move\"",
+		"\"copy\"",
+		"\"delete\"",
+		"\"del\"",
+		"\"rm\"",
+		"\"propfind\"",
+		"\"propget\"",
+		"QNAME",
+		"\"propfindall\"",
+		"\"propgetall\"",
+		"\"proppatch\"",
+		"PROPSET",
+		"\"get\"",
+		"\"put\"",
+		"\"begin\"",
+		"\"commit\"",
+		"\"abort\"",
+		"\"lock\"",
+		"\"unlock\"",
+		"\"locks\"",
+		"\"grant\"",
+		"\"to\"",
+		"\"deny\"",
+		"\"revoke\"",
+		"\"from\"",
+		"\"acl\"",
+		"\"principalcollectionset\"",
+		"\"versioncontrol\"",
+		"\"update\"",
+		"\"checkin\"",
+		"\"checkout\"",
+		"\"uncheckout\"",
+		"\"report\"",
+		"\"ereport\"",
+		"\"lreport\"",
+		"\"mkws\"",
+		"\"exit\"",
+		"\"quit\"",
+		"\"bye\"",
+		"\"set\"",
+		"\"close\"",
+		"\"cp\"",
+		"\"mv\"",
+		"\"propput\"",
+		"\"principalcol\"",
+		"WS",
+		"CHARS",
+		"ALPHANUM",
+		"ALPHA",
+		"LOWALPHA",
+		"UPALPHA",
+		"DIGIT"
+	};
+	
+	private static final long[] mk_tokenSet_0() {
+		long[] data = { -81065343182709776L, 127L, 0L, 0L};
+		return data;
+	}
+	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
+	
+	}

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Slide.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Slide.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Slide.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,118 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/commandline/src/java/org/apache/webdav/cmd/Slide.java,v 1.5 2004/07/28 09:30:33 ib Exp $
+ * $Revision: 1.5 $
+ * $Date: 2004/07/28 09:30:33 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.cmd;
+
+
+import org.apache.commons.httpclient.contrib.ssl.*;
+import org.apache.commons.httpclient.protocol.Protocol;
+
+
+/**
+ * The Slide client, the command line version for WebDAV client.
+ *
+ */
+public class Slide {
+
+    /**
+     * The version information for the Slide client.
+     */
+    public final static String version = "Slide client @VERSION@";
+
+    public static void main(String[] args) {
+        Client client = new Client(System.in,System.out);
+        
+        String remoteHost = null;
+
+        ////////////  BEGIN Command line arguments //////////////
+        String argOptions = null;
+
+        // parse arguments
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].startsWith("-")) {
+                if (argOptions != null)
+                    argOptions += args[i].substring(1);
+                else
+                    argOptions = args[i];
+            } else {
+                remoteHost = args[i];
+            }
+        }
+
+        // print options
+        if (argOptions != null) {
+            char option;
+            for (int i = 0; i < argOptions.length(); i++) {
+                option = argOptions.charAt(i);
+                switch (option) {
+                    case '-':
+                        break;
+                    case 'h':
+                        printCmdLineUsage();
+                        break;
+                    case 'v':
+                        System.out.println(version);
+                        break;
+                    case 'd':
+                        client.setDebug(Client.DEBUG_ON);
+                        break;
+                    case 's':
+                        Protocol.registerProtocol("https", 
+                                                  new Protocol("https",
+                                                               new EasySSLProtocolSocketFactory(), 
+                                                               443));
+                        break;
+                    default:
+                        System.exit(-1);
+                }
+            }
+        }
+        ////////////  END Command line arguments //////////////
+
+        if (remoteHost != null) {
+            client.connect(remoteHost);
+        }
+
+        client.run();
+    }
+
+    /**
+     * Print the commands options from startup
+     */
+    private static void printCmdLineUsage()
+    {
+
+        System.out.println("Usage: Slide [-vdhs] " +
+            "http://hostname[:port][/path]");
+        System.out.println
+            ("  Default protocol: http, port: 80, path: /");
+        System.out.println("Options:");
+        System.out.println("  -v: Print version information.");
+        System.out.println("  -d: Debug.");
+        System.out.println("  -h: Print this help message.");
+        System.out.println("  -s: use EasySSLProtocol");
+        System.out.println(
+            "Please, email bug reports to slide-user at jakarta.apache.org");
+    }
+}
+

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/SlideTokenTypes.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/SlideTokenTypes.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/SlideTokenTypes.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,117 @@
+// $ANTLR 2.7.3: "Client.g" -> "ClientLexer.java"$
+
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/commandline/src/java/org/apache/webdav/cmd/SlideTokenTypes.java,v 1.7 2004/08/02 15:45:50 unico Exp $
+ * $Revision: 1.7 $
+ * $Date: 2004/08/02 15:45:50 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.cmd;
+
+import java.io.*;
+import java.util.*;
+import org.apache.webdav.lib.PropertyName;
+import org.apache.webdav.lib.util.QName;
+
+
+public interface SlideTokenTypes {
+	int EOF = 1;
+	int NULL_TREE_LOOKAHEAD = 3;
+	int HELP = 4;
+	int QUESTION = 5;
+	int EOL = 6;
+	int STATUS = 7;
+	int SPOOL = 8;
+	int STRING = 9;
+	int OFF = 10;
+	int RUN = 11;
+	int ECHO = 12;
+	int ON = 13;
+	int DEBUG = 14;
+	int OPTIONS = 15;
+	int CONNECT = 16;
+	int OPEN = 17;
+	int DISCONNECT = 18;
+	int LPWD = 19;
+	int PWC = 20;
+	int PWD = 21;
+	int LCD = 22;
+	int CD = 23;
+	int CC = 24;
+	int LLS = 25;
+	int LDIR = 26;
+	int OPTIONSTRING = 27;
+	int LS = 28;
+	int DIR = 29;
+	int MKCOL = 30;
+	int MKDIR = 31;
+	int MOVE = 32;
+	int COPY = 33;
+	int DELETE = 34;
+	int DEL = 35;
+	int RM = 36;
+	int PROPFIND = 37;
+	int PROPGET = 38;
+	int QNAME = 39;
+	int PROPFINDALL = 40;
+	int PROPGETALL = 41;
+	int PROPPATCH = 42;
+	int PROPSET = 43;
+	int GET = 44;
+	int PUT = 45;
+	int BEGIN = 46;
+	int COMMIT = 47;
+	int ABORT = 48;
+	int LOCK = 49;
+	int UNLOCK = 50;
+	int LOCKS = 51;
+	int GRANT = 52;
+	int TO = 53;
+	int DENY = 54;
+	int REVOKE = 55;
+	int FROM = 56;
+	int ACL = 57;
+	int PRINCIPALCOLLECTIONSET = 58;
+	int VERSIONCONTROL = 59;
+	int UPDATE = 60;
+	int CHECKIN = 61;
+	int CHECKOUT = 62;
+	int UNCHECKOUT = 63;
+	int REPORT = 64;
+	int EREPORT = 65;
+	int LREPORT = 66;
+	int MKWS = 67;
+	int EXIT = 68;
+	int QUIT = 69;
+	int BYE = 70;
+	int SET = 71;
+	int CLOSE = 72;
+	int CP = 73;
+	int MV = 74;
+	int PROPPUT = 75;
+	int PRINCIPALCOL = 76;
+	int WS = 77;
+	int CHARS = 78;
+	int ALPHANUM = 79;
+	int ALPHA = 80;
+	int LOWALPHA = 81;
+	int UPALPHA = 82;
+	int DIGIT = 83;
+}

Added: branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Spool.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Spool.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/commandline/src/java/org/apache/webdav/cmd/Spool.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,204 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/commandline/src/java/org/apache/webdav/cmd/Spool.java,v 1.3 2004/07/28 09:30:33 ib Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/28 09:30:33 $
+ *
+ * ====================================================================
+ *
+ * Copyright 1999-2002 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.cmd;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * This class provides wrappers around an InputStream and
+ * an OutputStream allowing you to spool both streams to a
+ * shared OutputStream.
+ *
+ */
+public class Spool
+{
+    private InputStream  in   = System.in;
+    private OutputStream out  = System.out;
+    private OutputStream spool= null;
+
+    private InputStream  wrappedInputStream;
+    private OutputStream wrappedOutputStream;
+
+    private boolean echo=false;
+
+    /**
+     * Create a spool for these two streams
+     */
+    public Spool(InputStream in, OutputStream out)
+    {
+        this();
+        this.in=in;
+        this.out=out;
+    }
+
+    /**
+     * Create a spool for System.in and System.out
+     */
+    public Spool()
+    {
+        wrappedInputStream = new InputStream()
+        {
+            public int read(byte b[]) throws IOException {
+                int bytesRead = in.read(b);
+                if (echo)
+                    out.write(b,0,bytesRead);
+                if (spool!=null)
+                    spool.write(b,0,bytesRead);
+                return bytesRead;
+            }
+            public int read(byte b[], int off, int len) throws IOException {
+                int bytesRead = in.read(b,off,len);
+                if (echo)
+                    out.write(b,off,bytesRead);
+                if (spool!=null)
+                    spool.write(b,off,bytesRead);
+                return bytesRead;
+            }
+            public int read() throws IOException {
+                int nextByte = in.read();
+                if ((nextByte!=-1) && (echo))
+                    out.write(nextByte);
+                if ((nextByte!=-1) && (spool!=null))
+                    spool.write(nextByte);
+                return nextByte;
+            }
+            public long skip(long n) throws IOException {
+                return in.skip(n);
+            }
+            public int available() throws IOException {
+                return in.available();
+            }
+            public void close() throws IOException {
+                in.close();
+            }
+            public synchronized void mark(int readlimit) {
+                in.mark(readlimit);
+            }
+            public synchronized void reset() throws IOException {
+                in.reset();
+            }
+            public boolean markSupported() {
+                return in.markSupported();
+            }
+        };
+        wrappedOutputStream = new OutputStream()
+        {
+            public void write(int b) throws IOException {
+                out.write(b);
+                if (spool!=null)
+                    spool.write(b);
+            }
+            public void write(byte b[]) throws IOException {
+                out.write(b);
+                if (spool!=null)
+                    spool.write(b);
+            }
+            public void write(byte b[], int off, int len) throws IOException {
+                out.write(b,off,len);
+                if (spool!=null)
+                    spool.write(b,off,len);
+            }
+            public void flush() throws IOException {
+                out.flush();
+                if (spool!=null)
+                    spool.flush();
+            }
+            public void close() throws IOException {
+                out.close();
+            }
+        };
+    }
+
+    /**
+     * Echo the input stream to the output stream.
+     */
+    public void setEcho(boolean isEnabled)
+    {
+        this.echo=isEnabled;
+    }
+
+    /**
+     * Enable spooling and spool to the given filename.
+     */
+    public void enable(String filename) throws FileNotFoundException
+    {
+        enable(new FileOutputStream(filename));
+    }
+
+    /**
+     * Enable Spooling and spool to the given OutputStream.
+     */
+    public void enable(OutputStream spool)
+    {
+        if (isEnabled())
+            disable();
+        this.spool = spool;
+    }
+
+    /**
+     * Disable spooling
+     */
+    public void disable()
+    {
+        try
+        {
+            if (spool!=null)
+                spool.close();
+        }
+        catch (IOException ex)
+        {
+        }
+        spool=null;
+    }
+
+    /**
+     * Returns if spooling is enabled.
+     */
+    public boolean isEnabled()
+    {
+        return (spool!=null);
+    }
+
+    /**
+     * Returns an InputStream wrapped around the real InputStream.
+     * Use this stream to read from.
+     */
+    public InputStream getInputStream()
+    {
+        return wrappedInputStream;
+    }
+
+    /**
+     * Returns an OutputStream wrapped around the real OutputStream.
+     * Use this stream to write to.
+     */
+    public OutputStream getOutputStream()
+    {
+        return wrappedOutputStream;
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/connector/example/src/conf/jboss-web.xml
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/example/src/conf/jboss-web.xml	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/example/src/conf/jboss-web.xml	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web.dtd">
+
+<jboss-web>
+
+   <!-- Resource references -->
+   <resource-ref>
+      <res-ref-name>WebDAV-Connector</res-ref-name>
+      <jndi-name>java:WebDAV-Connector</jndi-name>
+   </resource-ref>
+</jboss-web>
+

Added: branches/slide-webdavclient/upstream/2.1/connector/example/src/conf/web.xml
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/example/src/conf/web.xml	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/example/src/conf/web.xml	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
+<web-app id="WebApp">
+	<servlet>
+		<servlet-name>Test</servlet-name>
+		<display-name>Test</display-name>
+		<servlet-class>connector.TestServlet</servlet-class>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Test</servlet-name>
+		<url-pattern>/</url-pattern>
+	</servlet-mapping>
+   <resource-ref >
+      <res-ref-name>WebDAV-Connector</res-ref-name>
+      <res-type>org.apache.webdav.connector.WebDAVConnectionFactory</res-type>
+      <res-auth>Container</res-auth>
+   </resource-ref>
+</web-app>

Added: branches/slide-webdavclient/upstream/2.1/connector/example/src/java/connector/TestServlet.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/example/src/java/connector/TestServlet.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/example/src/java/connector/TestServlet.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,129 @@
+package connector;
+
+import java.io.*;
+
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.HttpsURL;
+import org.apache.webdav.connector.*;
+import org.apache.webdav.lib.WebdavResource;
+
+import javax.resource.ResourceException;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+import javax.naming.InitialContext;
+import javax.naming.Context;
+
+
+
+/**
+ * Implementation of the test servlet.
+ */
+public class TestServlet extends HttpServlet {
+    static String HOST = "http://localhost:8888/slide/files";
+    static String USER = "root";
+    static String PASSWORD = "root";
+    static int TIMEOUT = 10;
+
+    // Reference to the factory
+    private WebDAVConnectionFactory _factory;
+
+    
+    /**
+     * <code>init()</code> stores the factory for efficiency since JNDI
+     * is relatively slow.
+     */
+    public void init() throws ServletException {
+        try {
+            Context ic = new InitialContext();
+
+            _factory = (WebDAVConnectionFactory) ic.lookup("java:comp/env/WebDAV-Connector");
+        } catch (Exception e) {
+            throw new ServletException(e);
+        }
+    }
+
+    public void service(HttpServletRequest request, HttpServletResponse response)
+        throws IOException, ServletException {
+        response.setContentType("text/html");
+        PrintWriter out = response.getWriter();
+
+        WebDAVConnection conn1 = null;
+
+        UserTransaction tx = null;
+        try {
+            Context ic = new InitialContext();
+            tx = (UserTransaction) ic.lookup("java:comp/UserTransaction");
+
+            tx.begin();
+
+            System.out.println("Tx: " + tx);
+            out.println("Tx: " + tx + "<br>");
+
+            System.out.println("Factory: " + _factory);
+            out.println("Factory: " + _factory + "<br>");
+            
+            WebDAVConnectionSpec spec = new WebDAVConnectionSpec(HOST, USER, PASSWORD, TIMEOUT);
+            
+            conn1 = (WebDAVConnection) _factory.getConnection(spec);
+            out.println("Connection1: " + conn1 + "<br>");
+            System.out.println("Connection1: " + conn1);
+
+            WebdavResource wr1 = conn1.getWebdavResource();
+            // outside of any transaction:
+            HttpURL httpURL = new HttpURL(HOST.toCharArray());
+            httpURL.setUserinfo(USER, PASSWORD);
+
+            WebdavResource wr2 = new WebdavResource(httpURL);
+
+            out.println("WR1: " + wr1 + "<br>");
+            System.out.println("WR1: " + wr1);
+            out.println("WR2: " + wr2 + "<br>");
+            System.out.println("WR2: " + wr2);
+
+            
+            wr1.putMethod(HOST+"/file1", "Content");
+            String thisIsWhatTx1Sees =  wr1.getMethodDataAsString(HOST+"/file1");
+            String thisIsWhatTx2Sees = wr2.getMethodDataAsString(HOST+"/file1");
+
+            out.println("WR1 sees " + thisIsWhatTx1Sees + "<br>");
+            System.out.println("WR1 sees " + thisIsWhatTx1Sees);
+            out.println("WR2 sees this before commit" + thisIsWhatTx2Sees + "<br>");
+            System.out.println("WR2 sees this before commit " + thisIsWhatTx2Sees);
+
+            tx.commit();
+            
+            thisIsWhatTx2Sees = wr2.getMethodDataAsString(HOST+"/file1");
+            out.println("WR2 sees this after commit " + thisIsWhatTx2Sees + "<br>");
+            System.out.println("WR2 sees this after commit " + thisIsWhatTx2Sees);
+            
+        } catch (Exception e) {
+            if (tx != null)
+                try {
+                    tx.rollback();
+                } catch (IllegalStateException e1) {
+                    // TODO Auto-generated catch block
+                    e1.printStackTrace();
+                } catch (SecurityException e1) {
+                    // TODO Auto-generated catch block
+                    e1.printStackTrace();
+                } catch (SystemException e1) {
+                    // TODO Auto-generated catch block
+                    e1.printStackTrace();
+                }
+            System.out.println(e);
+            e.printStackTrace();
+            throw new ServletException(e);
+        } finally {
+            if (conn1 != null)
+                try {
+                    conn1.close();
+                } catch (ResourceException e1) {
+                    // TODO Auto-generated catch block
+                    e1.printStackTrace();
+                }
+        }
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnection.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnection.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnection.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,85 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVConnection.java,v 1.2 2004/07/15 12:37:36 ozeigermann Exp $
+ * $Revision: 1.2 $
+ * $Date: 2004/07/15 12:37:36 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2004 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.connector;
+
+import javax.resource.ResourceException;
+import javax.resource.cci.Connection;
+import javax.resource.cci.ConnectionMetaData;
+import javax.resource.cci.Interaction;
+import javax.resource.cci.LocalTransaction;
+import javax.resource.cci.ResultSetInfo;
+import javax.resource.spi.ManagedConnection;
+
+import org.apache.webdav.lib.WebdavResource;
+
+/**
+ * Abstraction of a connection to a Slide (WebDAV) server. All actual requests are made via the
+ * {@link WebdavResource} the user gets with {@link #getWebdavResource()}.
+ * 
+ * @version $Revision: 1.2 $
+ * 
+ */
+public class WebDAVConnection implements Connection {
+
+    protected WebDAVManagedConnection mc;
+    
+    public WebDAVConnection(ManagedConnection mc) {
+        this.mc = (WebDAVManagedConnection) mc;
+    }
+
+    /**
+     * Returns the {@link WebdavResource} that has been associated to this WebDAV connection. All actual requests
+     * to the WebDAV server are done with this{@link WebdavResource}.  
+     * 
+     * @return the {@link WebdavResource} associated to this connection 
+     */
+    public WebdavResource getWebdavResource() {
+        return mc.getWebdavResource();
+    }
+    
+    public void close() throws ResourceException {
+        mc.close();
+    }
+
+    public Interaction createInteraction() throws ResourceException {
+        return null;
+    }
+
+    public LocalTransaction getLocalTransaction() throws ResourceException {
+        return (LocalTransaction)mc.getLocalTransaction();
+    }
+
+    public ConnectionMetaData getMetaData() throws ResourceException {
+        return null;
+    }
+
+    public ResultSetInfo getResultSetInfo() throws ResourceException {
+        return null;
+    }
+
+    void invalidate() {
+        mc = null;
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnectionFactory.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnectionFactory.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnectionFactory.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,84 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVConnectionFactory.java,v 1.2 2004/07/15 12:37:36 ozeigermann Exp $
+ * $Revision: 1.2 $
+ * $Date: 2004/07/15 12:37:36 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2004 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.connector;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.resource.NotSupportedException;
+import javax.resource.ResourceException;
+import javax.resource.cci.Connection;
+import javax.resource.cci.ConnectionFactory;
+import javax.resource.cci.ConnectionSpec;
+import javax.resource.cci.RecordFactory;
+import javax.resource.cci.ResourceAdapterMetaData;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ManagedConnectionFactory;
+
+/**
+ *   
+ * @version $Revision: 1.2 $
+ * 
+ */
+public class WebDAVConnectionFactory implements ConnectionFactory {
+
+    protected Reference reference;
+    protected ConnectionManager cm;
+    protected ManagedConnectionFactory mcf;
+
+    public WebDAVConnectionFactory(ManagedConnectionFactory mcf, ConnectionManager cm) {
+        System.out.println("MCF Init with mcf " + mcf + " cm " + cm);
+        this.mcf = mcf;
+        this.cm = cm;
+    }
+
+    public Connection getConnection() throws ResourceException {
+        throw new NotSupportedException(
+                "Need a WebDAVConnectionSpec to create a connection. Call getConnection(ConnectionSpec spec) instead!");
+    }
+
+    public Connection getConnection(ConnectionSpec spec) throws ResourceException {
+        if (!(spec instanceof WebDAVConnectionSpec)) {
+            throw new NotSupportedException("Need a WebDAVConnectionSpec to create a connection!");
+        }
+        System.out.println("Getting connection with spec "+spec);
+        return (Connection) cm.allocateConnection(mcf, (WebDAVConnectionSpec)spec);
+    }
+
+    public RecordFactory getRecordFactory() throws ResourceException {
+        return null;
+    }
+
+    public ResourceAdapterMetaData getMetaData() throws ResourceException {
+        return null;
+    }
+
+    public void setReference(Reference reference) {
+        this.reference = reference;
+    }
+
+    public Reference getReference() throws NamingException {
+        return reference;
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnectionSpec.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnectionSpec.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVConnectionSpec.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,79 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVConnectionSpec.java,v 1.3 2004/07/15 12:37:36 ozeigermann Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/15 12:37:36 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2004 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.connector;
+
+import javax.resource.cci.ConnectionSpec;
+import javax.resource.spi.ConnectionRequestInfo;
+
+import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.HttpsURL;
+import org.apache.commons.httpclient.URIException;
+
+/**
+ * Specifies where the {@link WebDAVConnection} shall go to. 
+ *  
+ * @version $Revision: 1.3 $
+ * 
+ */
+public class WebDAVConnectionSpec implements ConnectionSpec, ConnectionRequestInfo {
+    
+    /** The http URL on the client connection. */
+    protected HttpURL httpURL;
+    protected int timeout;
+    
+    /**
+     * Creates a specification where the {@link WebDAVConnection} shall go to.
+     * 
+     * @param httpURL complete url of the Slide (WebDAV) server including user and password
+     * @param timeout timeout of the externally controlled transaction 
+     */
+    public WebDAVConnectionSpec(HttpURL httpURL, int timeout) {
+        this.httpURL = httpURL;
+        this.timeout = timeout; 
+    
+    }
+
+    /**
+     * Creates a specification where the {@link WebDAVConnection} shall go to.
+     * 
+     * @param url url string of the Slide (WebDAV) server
+     * @param userName user name for login to the Slide (WebDAV) server
+     * @param password password for login to the Slide (WebDAV) server
+     * @param timeout timeout of the externally controlled transaction 
+     * @throws URIException if the given uri is not a valid one
+     */
+    public WebDAVConnectionSpec(String url, String userName, String password, int timeout) throws URIException {
+        this.httpURL = url.startsWith("https") ? new HttpsURL(url) : new HttpURL(url);
+        this.httpURL.setUserinfo(userName, password);
+        this.timeout = timeout; 
+    }
+
+    protected HttpURL getHttpURL() {
+        return httpURL;
+    }
+
+    protected int getTimeout() {
+        return timeout;
+    }
+}

Added: branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVLocalTransaction.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVLocalTransaction.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVLocalTransaction.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,76 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVLocalTransaction.java,v 1.2 2004/07/15 12:37:36 ozeigermann Exp $
+ * $Revision: 1.2 $
+ * $Date: 2004/07/15 12:37:36 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2004 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.connector;
+
+import java.io.IOException;
+
+import javax.resource.ResourceException;
+import org.apache.webdav.lib.WebdavResource;
+
+/**
+ * 
+ * @version $Revision: 1.2 $
+ * 
+ */
+public class WebDAVLocalTransaction implements javax.resource.spi.LocalTransaction, javax.resource.cci.LocalTransaction {
+
+    protected WebdavResource webdavResource;
+    protected String owner;
+    protected int timeout;
+
+    public WebDAVLocalTransaction(WebdavResource webdavResource, String owner, int timeout) {
+        this.webdavResource = webdavResource;
+        this.owner = owner;
+        this.timeout = timeout;
+    }
+
+    public void begin() throws ResourceException {
+        try {
+            webdavResource.startTransaction(owner, timeout);
+        } catch (IOException e) {
+            throw new ResourceException("Could not start transaction", e);
+        }
+    }
+
+    public void commit() throws ResourceException {
+        try {
+            if (!webdavResource.commitTransaction()) {
+                throw new ResourceException("Could not commit transaction");
+            }
+        } catch (IOException e) {
+            throw new ResourceException("Could not commit transaction", e);
+        }
+    }
+
+    public void rollback() throws ResourceException {
+        try {
+            if (!webdavResource.abortTransaction()) {
+                throw new ResourceException("Could not roll back transaction");
+            }
+        } catch (IOException e) {
+            throw new ResourceException("Could not roll back transaction", e);
+        }
+    }
+
+}

Added: branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnection.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnection.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnection.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,227 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnection.java,v 1.2.2.1 2004/09/20 08:07:29 ozeigermann Exp $
+ * $Revision: 1.2.2.1 $
+ * $Date: 2004/09/20 08:07:29 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2004 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.connector;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.URIException;
+import org.apache.webdav.lib.WebdavResource;
+
+/**
+ * 
+ * @version $Revision: 1.2.2.1 $
+ *  
+ */
+public class WebDAVManagedConnection implements ManagedConnection {
+
+    protected WebDAVXAResource xares = null;
+
+    protected WebDAVLocalTransaction tx = null;
+
+    protected String name = null;
+
+    protected WebdavResource webdavResource;
+
+    protected WebDAVConnectionSpec webDAVConnectionSpec;
+
+    protected WebDAVConnection connection = null;
+
+    protected List listeners = new ArrayList();
+
+    protected PrintWriter out;
+
+    public WebDAVManagedConnection(ConnectionRequestInfo cxRequestInfo) throws HttpException, IOException {
+        open((WebDAVConnectionSpec) cxRequestInfo);
+    }
+
+    public WebdavResource getWebdavResource() {
+        return webdavResource;
+    }
+
+    public void close() {
+        ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
+        event.setConnectionHandle(connection);
+        for (Iterator it = listeners.iterator(); it.hasNext();) {
+            ((ConnectionEventListener) it.next()).connectionClosed(event);
+        }
+    }
+
+    /**
+     * @see ManagedConnection#getConnection(Subject, ConnectionRequestInfo)
+     */
+    public Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
+
+        if (connection == null) {
+            connection = new WebDAVConnection(this);
+        }
+        return connection;
+    }
+
+    /**
+     * @see ManagedConnection#destroy()
+     */
+    public void destroy() throws ResourceException {
+
+        if (connection != null) {
+            connection.invalidate();
+            connection = null;
+        }
+
+        listeners = null;
+        name = null;
+        xares = null;
+        tx = null;
+        try {
+            webdavResource.close();
+        } catch (IOException e) {
+            throw new ResourceException(e);
+        }
+    }
+
+    /**
+     * @see ManagedConnection#cleanup()
+     */
+    public void cleanup() throws ResourceException {
+        // XXX We should only reset internal state to put our
+        // physical connection back to the pool. As I have
+        // no idea how to recycle a WebdavResource a have to
+        // fully destroy it (Olli Z.)
+
+        if (connection != null) {
+            connection.invalidate();
+            connection = null;
+        }
+
+        name = null;
+        xares = null;
+        tx = null;
+        try {
+            webdavResource.close();
+        } catch (IOException e) {
+            throw new ResourceException(e);
+        }
+    }
+
+    /**
+     * @see ManagedConnection#associateConnection(Object)
+     */
+    public void associateConnection(Object connection) throws ResourceException {
+        if (!(connection instanceof WebDAVConnection)) {
+            throw new ResourceException("Connection is not of type WebDAVConnection");
+        }
+
+        this.connection = (WebDAVConnection) connection;
+        try {
+            open(this.connection.mc.webDAVConnectionSpec);
+        } catch (URIException e) {
+            throw new ResourceException("Could not associate connection", e);
+        } catch (IOException e) {
+            throw new ResourceException("Could not associate connection", e);
+        }
+        this.connection.mc = this;
+    }
+
+    /**
+     * @see ManagedConnection#addConnectionEventListener(ConnectionEventListener)
+     */
+    public void addConnectionEventListener(ConnectionEventListener listener) {
+
+        listeners.add(listener);
+    }
+
+    /**
+     * @see ManagedConnection#removeConnectionEventListener(ConnectionEventListener)
+     */
+    public void removeConnectionEventListener(ConnectionEventListener listener) {
+
+        listeners.remove(listener);
+    }
+
+    /**
+     * @see ManagedConnection#getXAResource()
+     */
+    public XAResource getXAResource() throws ResourceException {
+        return xares;
+    }
+
+    /**
+     * @see ManagedConnection#getLocalTransaction()
+     */
+    public LocalTransaction getLocalTransaction() throws ResourceException {
+        return tx;
+    }
+
+    /**
+     * @see ManagedConnection#getMetaData()
+     */
+    public ManagedConnectionMetaData getMetaData() throws ResourceException {
+
+        return null;
+    }
+
+    /**
+     * @see ManagedConnection#setLogWriter(PrintWriter)
+     */
+    public void setLogWriter(PrintWriter out) throws ResourceException {
+        this.out = out;
+        xares.setLoggerFacade(out);
+    }
+
+    /**
+     * @see ManagedConnection#getLogWriter()
+     */
+    public PrintWriter getLogWriter() throws ResourceException {
+
+        return out;
+    }
+
+    protected void open(WebDAVConnectionSpec webDAVConnectionSpec) throws IOException, URIException {
+        this.webDAVConnectionSpec = webDAVConnectionSpec;
+        System.out.println("Opening: "+webDAVConnectionSpec.getHttpURL()); // FIXME
+        webdavResource = new WebdavResource(webDAVConnectionSpec.getHttpURL());
+        System.out.println("Opened"); // FIXME
+        String owner = webDAVConnectionSpec.getHttpURL().getUser();
+        if (owner == null)
+            owner = "WebDAV Connector";
+
+        tx = new WebDAVLocalTransaction(webdavResource, owner, webDAVConnectionSpec.getTimeout());
+        xares = new WebDAVXAResource(webdavResource, owner);
+    }
+
+}
\ No newline at end of file

Added: branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnectionFactory.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnectionFactory.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnectionFactory.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,137 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnectionFactory.java,v 1.4 2004/07/15 12:37:36 ozeigermann Exp $
+ * $Revision: 1.4 $
+ * $Date: 2004/07/15 12:37:36 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2004 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.connector;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.security.auth.Subject;
+
+import org.apache.commons.httpclient.HttpException;
+
+/**
+ * 
+ * @version $Revision: 1.4 $
+ *  
+ */
+public class WebDAVManagedConnectionFactory implements ManagedConnectionFactory {
+
+    protected PrintWriter writer;
+
+    /**
+     * @see ManagedConnectionFactory#createConnectionFactory(ConnectionManager)
+     */
+    public Object createConnectionFactory(ConnectionManager cm) throws ResourceException {
+
+        return new WebDAVConnectionFactory(this, cm);
+    }
+
+    /**
+     * @see ManagedConnectionFactory#createConnectionFactory()
+     */
+    public Object createConnectionFactory() throws ResourceException {
+
+        return new WebDAVConnectionFactory(this, null);
+    }
+
+    /**
+     * @see ManagedConnectionFactory#createManagedConnection(Subject,
+     *      ConnectionRequestInfo)
+     */
+    public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
+            throws ResourceException {
+
+        try {
+            return new WebDAVManagedConnection(cxRequestInfo);
+        } catch (HttpException e) {
+            if (writer != null) {
+                writer.println("Exception: " + e);
+                e.printStackTrace(writer);
+            }
+            // XXX only in 1.4
+//            throw new ResourceException("Could not create managed connection", e);
+            throw new ResourceException("Could not create managed connection", e.toString());
+        } catch (IOException e) {
+            if (writer != null) {
+                writer.println("Exception: " + e);
+                e.printStackTrace(writer);
+            }
+            // XXX only in 1.4
+//          throw new ResourceException("Could not create managed connection", e);
+            throw new ResourceException("Could not create managed connection", e.toString());
+        }
+    }
+
+    /**
+     * @see ManagedConnectionFactory#matchManagedConnections(Set, Subject,
+     *      ConnectionRequestInfo)
+     */
+    public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject,
+            ConnectionRequestInfo cxRequestInfo) throws ResourceException {
+
+        ManagedConnection match = null;
+        Iterator iterator = connectionSet.iterator();
+        if (iterator.hasNext()) {
+            match = (ManagedConnection) iterator.next();
+        }
+
+        return match;
+    }
+
+    /**
+     * @see ManagedConnectionFactory#setLogWriter(PrintWriter)
+     */
+    public void setLogWriter(PrintWriter writer) throws ResourceException {
+
+        this.writer = writer;
+    }
+
+    /**
+     * @see ManagedConnectionFactory#getLogWriter()
+     */
+    public PrintWriter getLogWriter() throws ResourceException {
+
+        return writer;
+    }
+
+    public boolean equals(Object other) {
+
+        if (other instanceof WebDAVManagedConnectionFactory) {
+            return true;
+        }
+        return false;
+    }
+
+    public int hashCode() {
+
+        return 0;
+    }
+}
\ No newline at end of file

Added: branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVXAResource.java
===================================================================
--- branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVXAResource.java	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/connector/src/java/org/apache/webdav/connector/WebDAVXAResource.java	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,141 @@
+/*
+ * $Header: /home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVXAResource.java,v 1.3 2004/07/27 15:27:23 luetzkendorf Exp $
+ * $Revision: 1.3 $
+ * $Date: 2004/07/27 15:27:23 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2004 The Apache Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.webdav.connector;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.apache.commons.transaction.util.PrintWriterLogger;
+import org.apache.commons.transaction.util.xa.AbstractTransactionalResource;
+import org.apache.commons.transaction.util.xa.AbstractXAResource;
+import org.apache.commons.transaction.util.xa.TransactionalResource;
+import org.apache.webdav.lib.WebdavResource;
+
+/**
+ * 
+ * @version $Revision: 1.3 $
+ *  
+ */
+public class WebDAVXAResource extends AbstractXAResource {
+
+    protected WebdavResource webdavResource;
+
+    protected String owner;
+
+    protected int timeout = 10;
+
+    protected LoggerFacade loggerFacade;
+
+    public WebDAVXAResource(WebdavResource webdavResource, String owner) {
+        this.webdavResource = webdavResource;
+        this.owner = owner;
+        // log important stuff to standard out as long as nothing else is configured
+        this.loggerFacade = new PrintWriterLogger(new PrintWriter(System.out), "WebDAVXAResource", false);
+    }
+
+    protected LoggerFacade getLoggerFacade() {
+        return loggerFacade;
+    }
+
+    protected void setLoggerFacade(PrintWriter out) {
+        loggerFacade = new PrintWriterLogger(out, "WebDAVXAResource", true);
+    }
+
+    public int getTransactionTimeout() throws XAException {
+        return timeout;
+    }
+
+    public boolean setTransactionTimeout(int seconds) throws XAException {
+        timeout = seconds;
+        return true;
+    }
+
+    public boolean isSameRM(XAResource xares) throws XAException {
+        return (xares != null && xares instanceof WebDAVXAResource && webdavResource
+                .equals(((WebDAVXAResource) xares).webdavResource));
+    }
+
+    public Xid[] recover(int flag) throws XAException {
+        // FIXME no idea how to recover anything here
+        return null;
+    }
+
+    protected TransactionalResource createTransactionResource(Xid xid) throws Exception {
+        return new TransactionalWebDAVResource(xid, webdavResource, owner, timeout, getLoggerFacade());
+    }
+
+    protected boolean includeBranchInXid() {
+        return true;
+    }
+
+    protected static class TransactionalWebDAVResource extends AbstractTransactionalResource {
+
+        WebdavResource webdavResource;
+        LoggerFacade loggerFacade;
+        
+        public TransactionalWebDAVResource(Xid xid, WebdavResource webdavResource, String owner, int timeout, LoggerFacade loggerFacade) throws IOException {
+            super(xid);
+            this.webdavResource = webdavResource;
+            System.out.println("Statring "+webdavResource);
+            webdavResource.startTransaction(owner, timeout);
+            this.loggerFacade = loggerFacade;  
+        }
+
+        public void commit() throws XAException {
+            try {
+                webdavResource.commitTransaction();
+            } catch (IOException e) {
+                loggerFacade.logWarning("Could not commit transaction", e);
+                throw new XAException("Could not commit transaction");
+            }
+        }
+
+        public void rollback() throws XAException {
+            try {
+                webdavResource.abortTransaction();
+            } catch (IOException e) {
+                loggerFacade.logWarning("Could not roll back transaction", e);
+                throw new XAException("Could not roll back transaction");
+            }
+        }
+
+        public int prepare() throws XAException {
+            return XA_OK;
+        }
+        
+        public void begin() throws XAException {
+        }
+
+        public void resume() throws XAException {
+        }
+        
+        public void suspend() throws XAException {
+        }
+    }
+}
\ No newline at end of file

Added: branches/slide-webdavclient/upstream/2.1/etc/MANIFEST.MF
===================================================================
--- branches/slide-webdavclient/upstream/2.1/etc/MANIFEST.MF	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/etc/MANIFEST.MF	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Extension-Name: webdavclient
+Specification-Title: Slide
+Specification-Version: 2.0
+Specification-Vendor: Apache Software Foundation
+Implementation-Title: Slide
+Implementation-Version: @VERSION@
+Implementation-Vendor: Apache Software Foundation

Added: branches/slide-webdavclient/upstream/2.1/etc/conf/connector/jboss/webdav-connector-ds.xml
===================================================================
--- branches/slide-webdavclient/upstream/2.1/etc/conf/connector/jboss/webdav-connector-ds.xml	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/etc/conf/connector/jboss/webdav-connector-ds.xml	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connection-factories>
+
+  <tx-connection-factory>
+     <jndi-name>WebDAV-Connector</jndi-name>
+     <xa-transaction/>
+     <track-connection-by-tx/> 
+     <adapter-display-name>WebDAV-Connector</adapter-display-name>
+  </tx-connection-factory>
+
+
+</connection-factories>

Added: branches/slide-webdavclient/upstream/2.1/etc/conf/connector/ra.xml
===================================================================
--- branches/slide-webdavclient/upstream/2.1/etc/conf/connector/ra.xml	                        (rev 0)
+++ branches/slide-webdavclient/upstream/2.1/etc/conf/connector/ra.xml	2006-09-05 16:06:12 UTC (rev 2358)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE connector PUBLIC '-//Sun Microsystems, Inc.//DTD Connector 1.0//EN' 'http://java.sun.com/dtd/connector_1_0.dtd'>
+
+<connector>
+    <display-name>WebDAV-Connector</display-name>
+    <vendor-name>Apache Software Foundation</vendor-name>
+    <spec-version>1.0</spec-version>
+    <eis-type>WebDAV</eis-type>
+    <version>1.0</version>
+    <resourceadapter>
+        <managedconnectionfactory-class>org.apache.webdav.connector.WebDAVManagedConnectionFactory</managedconnectionfactory-class>
+        <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
+        <connectionfactory-impl-class>org.apache.webdav.connector.WebDAVConnectionFactory</connectionfactory-impl-class>
+        <connection-interface>javax.resource.cci.Connection</connection-interface>
+        <connection-impl-class>org.apache.webdav.connector.WebDAVConnection</connection-impl-class>
+        <transaction-support>XATransaction</transaction-support>
+        <reauthentication-support>false</reauthentication-support>
+    </resourceadapter>
+</connector>




More information about the pkg-java-commits mailing list