You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by "Park, Sung-Gu" <je...@thinkfree.com> on 2000/11/30 19:24:41 UTC
PropFindMethod in WebDAV Client
Have you ever tried to PropFind Method with type, "BY_NAME"?
It doesn't work correctly... I fixed two part for the right answer.
TEST CODE:
PropFindMethod method = new PropFindMethod();
method.setPath(path);
method.setDepth(method.DEPTH_1);
method.setType(method.BY_NAME);
Vector property = new Vector();
property.addElement("displayname");
property.addElement("getcontentlength");
property.addElement("resourcetype");
property.addElement("getlastmodified");
method.setPropertyNames(property.elements());
client.executeMethod(method);
Enumeration urls = method.getAllResponseURLs();
while (urls.hasMoreElements()) {
sout.println(urls.nextElement());
}
FIXED CODE 1)
in the PropFindMethod.java, like this,
case BY_NAME:
printer.writeElement("D", "prop", WebdavXMLPrinter.OPENING);
while (propertyNames.hasMoreElements()) {
String propertyName = (String) propertyNames.nextElement();
printer.writeElement(null, propertyName,
//printer.writeElement("D", propertyName,
WebdavXMLPrinter.NO_CONTENT);
FIXED CODE 2)
Remy, still it doesn't work only wit builder.parse(). :-(
parseReponse() in the XMLResponseMethodBase.java
StringBuffer sb = new StringBuffer();
while (true) {
int ch = input.read();
if (ch < 0) {
if (sb.length() == 0) {
return;
} else {
break;
}
}
sb.append((char) ch);
}
responseDocument = builder.parse(new InputSource(
new StringReader(sb.toString()) ));
Then, I can get the directory & file lists correctly on IIS 5.0.
Nonetheless, not Apache with mod_dav and Zope Server.
Sung-Gu.
Re: PropFindMethod in WebDAV Client
Posted by Remy Maucherat <re...@apache.org>.
> FIXED CODE 1)
> in the PropFindMethod.java, like this,
>
> case BY_NAME:
> printer.writeElement("D", "prop", WebdavXMLPrinter.OPENING);
> while (propertyNames.hasMoreElements()) {
> String propertyName = (String)
propertyNames.nextElement();
> printer.writeElement(null, propertyName,
> //printer.writeElement("D", propertyName,
> WebdavXMLPrinter.NO_CONTENT);
Actually, the functionality to let the client specify the namespace to which
the property belongs is missing. Assigning it to the default DAV: namespace
is a quick fix which will break in a lot of cases.
BTW, although the header says I'm the author of this, actually I'm not. B.C.
just forgot to add his name.
> FIXED CODE 2)
> Remy, still it doesn't work only wit builder.parse(). :-(
> parseReponse() in the XMLResponseMethodBase.java
>
> StringBuffer sb = new StringBuffer();
> while (true) {
> int ch = input.read();
> if (ch < 0) {
> if (sb.length() == 0) {
> return;
> } else {
> break;
> }
> }
> sb.append((char) ch);
> }
> responseDocument = builder.parse(new InputSource(
> new StringReader(sb.toString()) ));
IMO, that patch is bad, so I won't apply it. Basically, if the response body
is huge (and in DAV, that can easily happens), it would be yet another big
performance hit. If other people are having problems, we will need a
workaround.
On the tests I did with TC4 as the DAV server (and now IIS 5), it works
fine.
I use JAXP 1.1 (with Crimson), perhaps that's the reason why I don't have
this bug.
> Then, I can get the directory & file lists correctly on IIS 5.0.
> Nonetheless, not Apache with mod_dav and Zope Server.
Interoperability is only a secondary goal for the library. We'll work on it
eventually, though.
IIS works fine without those two patches on my setup (which is a standard
Win2k SP1 box - with JDK 1.3). However, I had to add a content-type header
to have it working (before, it was returning 400). I'll commit that in a few
minutes.
Remy