String status = new String(HTTP_VERSION + WebdavStatus.SC_OK + " "
+ WebdavStatus.getStatusText
(WebdavStatus.SC_OK));
NodeRevisionDescriptors revisionDescriptors = null;
NodeRevisionDescriptor revisionDescriptor = null;
boolean isCollection = false;
NodeLock objectLockToken = null;
try {
Element hrefElement = new Element(E_HREF, DNSP);
VersioningHelper vHelp = VersioningHelper.getVersioningHelper(
lightSToken, token, req, resp, getConfig() );
String resourcePath = object.getUri();
revisionDescriptors =
content.retrieve(lightSToken, resourcePath);
try {
revisionDescriptor = content.retrieve(lightSToken,
revisionDescriptors);
isCollection = WebdavUtils.isCollection(revisionDescriptor);
hrefElement.setText(
WebdavUtils.getAbsolutePath(object.getUri(), req,
getConfig()));
} catch (RevisionDescriptorNotFoundException e) {
// The object doesn't have any revision, we create a dummy
// NodeRevisionDescriptor object
isCollection = true;
revisionDescriptor = new NodeRevisionDescriptor(0);
if (!Configuration.useBinding(token.getUri(lightSToken, object.getUri()).getStore())) {
revisionDescriptor.setName(new UriPath(object.getUri()).lastSegment());
}
hrefElement.setText(
WebdavUtils.getAbsolutePath(object.getUri(), req,
getConfig()));
}
responseElement.addContent(hrefElement);
Enumeration lockTokens = lock.enumerateLocks(lightSToken, object.getUri(), true);
if (lockTokens.hasMoreElements()) {
objectLockToken = (NodeLock) lockTokens.nextElement();
}
} catch (AccessDeniedException e) {
if (revisionDescriptor == null) {
revisionDescriptor = new NodeRevisionDescriptor(0);
}
} catch (Exception e) {
int statusCode = getErrorCode( e );
sendError( statusCode, e );
throw new WebdavException( statusCode );