MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
if (responses.length < 1) {
throw new ItemNotFoundException("Unable to retrieve the node with id " + saveGetIdString(nodeId, sessionInfo));
}
MultiStatusResponse nodeResponse = null;
List childResponses = new ArrayList();
for (int i = 0; i < responses.length; i++) {
if (isSameResource(uri, responses[i])) {
nodeResponse = responses[i];
} else {
childResponses.add(responses[i]);
}
}
if (nodeResponse == null) {
throw new ItemNotFoundException("Unable to retrieve the node " + saveGetIdString(nodeId, sessionInfo));
}
DavPropertySet propSet = nodeResponse.getProperties(DavServletResponse.SC_OK);
Object type = propSet.get(DavPropertyName.RESOURCETYPE).getValue();
if (type == null) {
// the given id points to a Property instead of a Node
throw new ItemNotFoundException("No node for id " + saveGetIdString(nodeId, sessionInfo));
}
NamePathResolver resolver = getNamePathResolver(sessionInfo);
NodeId parentId = getParentId(propSet, sessionInfo);
NodeInfoImpl nInfo = buildNodeInfo(nodeResponse, parentId, propSet, sessionInfo, resolver);
for (Iterator it = childResponses.iterator(); it.hasNext();) {
MultiStatusResponse resp = (MultiStatusResponse) it.next();
DavPropertySet childProps = resp.getProperties(DavServletResponse.SC_OK);
if (childProps.contains(DavPropertyName.RESOURCETYPE) &&
childProps.get(DavPropertyName.RESOURCETYPE).getValue() != null) {
// any other resource type than default (empty) is represented by a node item
// --> build child info object
nInfo.addChildInfo(buildChildInfo(childProps, sessionInfo));