remm 01/07/21 21:41:55
Modified: src/webdav/client/src/org/apache/webdav/lib/methods
PropFindMethod.java
Log:
- Add namespace support to properties in PROPFIND. An alternate, cleaner
alternate method call will be added eventually, but this should be useful in
simple cases.
Patch submitted by Derek Libby <derekl at mediaone.net>, with ideas by Dirk
Verbeek,
and tweaks by me.
- I believe that Character.isUnicodeIdentifierPart is the right call to use
in that case. Am I right ?
Revision Changes Path
1.26 +27 -5
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropFindMethod.java
Index: PropFindMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropFindMethod.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- PropFindMethod.java 2001/05/01 21:28:01 1.25
+++ PropFindMethod.java 2001/07/22 04:41:55 1.26
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropFindMethod.java,v
1.25 2001/05/01 21:28:01 remm Exp $
- * $Revision: 1.25 $
- * $Date: 2001/05/01 21:28:01 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropFindMethod.java,v
1.26 2001/07/22 04:41:55 remm Exp $
+ * $Revision: 1.26 $
+ * $Date: 2001/07/22 04:41:55 $
*
* ====================================================================
*
@@ -368,9 +368,31 @@
case BY_NAME:
printer.writeElement("D", "prop", XMLPrinter.OPENING);
while (propertyNames.hasMoreElements()) {
+
String propertyName = (String) propertyNames.nextElement();
- printer.writeElement("D", propertyName,
- XMLPrinter.NO_CONTENT);
+
+ int length = propertyName.length();
+ boolean found = false;
+ int i = 1;
+ while (!found && (i <= length)) {
+ char chr = propertyName.charAt(length - i);
+ if (!Character.isUnicodeIdentifierPart(chr)) {
+ found = true;
+ } else {
+ i++;
+ }
+ }
+
+ if ((i == 1) || (i >= length)) {
+ printer.writeElement("D", propertyName,
+ XMLPrinter.NO_CONTENT);
+ } else {
+ String prefix = propertyName.substring(0, length + 1 - i);
+ String local = propertyName.substring(length + 1 - i);
+ printer.writeElement("ZZ", prefix, local,
+ XMLPrinter.NO_CONTENT);
+ }
+
}
printer.writeElement("D", "prop", XMLPrinter.CLOSING);
break;