You already guessed it. The main problem is that the different methods
return different results depending on which signature you use, and
what gets returned in each case is not even documented.
When you call reportMethod(URL, properties) and omit the depth you get
an Enumeration of raw ResponseEntity objects.
Try the following code snippet:
Vector properties = new Vector();
properties.addElement("label-name-set");
properties.addElement("version-name");
Enumeration e = resource.reportMethod(resource.getHttpURL(),
properties);
while (e.hasMoreElements()) {
ResponseEntity entity = (ResponseEntity) e.nextElement();
int status = entity.getStatusCode();
if (status < 200 || status >= 300) {
// error
continue;
}
Enumeration props = entity.getProperties();
while (props.hasMoreElements()) {
BaseProperty baseProp =
(BaseProperty) props.nextElement();
String propName = baseProp.getLocalName();
if (propName.equals("version-name")) {
System.out.println(
"version name: " + baseProp.getPropertyAsString());
} else if (propName.equals("label-name-set")) {
NodeList labels =
baseProp.getElement().getElementsByTagNameNS(
"DAV:", "label-name");
numLabels = labels.getLength();
for (int i = 0; i < numLabels; i++) {
System.out.println("label " + i + ": "
labels.item(i).getFirstChild().getNodeValue());
}
}
}
}
Regards,
Ingo
> The reportMethod(URL, properties, depth) gets the correct XML response back,
> however the enumeration class that is returned only has strings in it and
> shows up blank for the label-name-set prop. I'm not sure if the bug is in
> the method or in the underlying ReportMethod class at this point, but I'm
> sure it is a bug. I'm implementing a workaround by subclassing
> WebdavResouce. Perhaps I could submit that after I get it to work properly?
>
> ----- Original Message -----
> From: "Michael Smith" <[EMAIL PROTECTED]>
> To: "Slide Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Wednesday, June 16, 2004 9:00 PM
> Subject: Re: How can I determine what version has a given label
>
>
> > Ingo Brunberg wrote:
> > >>kranga wrote:
> > >>
> > >>>I've tried using propfind <path> label-name-set and this returns blank.
> The
> > >>>label property holds a set of labels as a revision can have multiple
> labels.
> > >>>How do I query the labels out? Someone please help!
> > >>
> > >>You need to do your propfind (for label-name-set) on the version paths.
> > >>There's no simple/quick way to say 'give me a list of all the labels
> > >>that are set on any version of this resource' (an argument could
> > >>certainly be made that this would be a useful thing, though) as far as I
> > >>know.
> > >
> > >
> > > No, there is a way of doing this. Just use the REPORT method on your
> > > version controlled resource and ask for the label-name-set.
> >
> > Ah. My mistake - I was using the RFC as my reference (since I have a
> > helpful printed out copy sitting next to me). The relevant REPORT (and
> > the deprecation of the Label header) was added in the errata, which I
> > hadn't read.
> >
> > >
> > >
> > >>Fetching a particular version with a label set is, of course, much
> > >>simpler - just set the Label header appropriately.
> > >>
> > >>Mike
> > >
> > >
> > > The Label header is deprecated. I'm not sure if it is supported by
> > > Slide anyway. You have to find out (from the results of the REPORT
> > > method) which version has a given label set. Then you request exactly
> > > that version by a simple GET.
> >
> > Label header is supported by slide - it's quite useful. The REPORT
> > approach is sensible too, of course, but I haven't checked if slide
> > supports it.
> >
> > Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]