catch (SlideException e) {
return getErrorResponse(resourceUri, getErrorCode(e), null);
}
}
ObjectNode object = null;
try {
object = structure.retrieve(lightSToken, resourceUri);
}
catch (SlideException e) {
return getErrorResponse(resourceUri, getErrorCode(e), null);
}
Element responseElement = new Element(E_RESPONSE, DNSP);
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 );
}
Vector propertiesParser = null;
PropertyRetrieverImpl propertyRetriever = new PropertyRetrieverImpl(token, lightSToken, getConfig());
switch (propFindType) {
case FIND_ALL_PROP :
case FIND_BY_PROPERTY :
try {
List propstatList= propertyRetriever.getPropertiesOfObject(requestedProperties, revisionDescriptors, revisionDescriptor, req.getContextPath(), req.getServletPath(), extendedAllprop);
Iterator iterator = propstatList.iterator();
while (iterator.hasNext()) {
responseElement.addContent((Element)iterator.next());
}
} catch (ServiceAccessException e) {
int statusCode = WebdavStatus.SC_FORBIDDEN;
sendError( statusCode, e );
throw new WebdavException( statusCode );
} catch (Exception e) {
int statusCode = getErrorCode( e );
sendError( statusCode, e );
throw new WebdavException( statusCode );
}
break;
case FIND_PROPERTY_NAMES :
try {
status = new String("HTTP/1.1 " + WebdavStatus.SC_OK
+ " " + WebdavStatus.getStatusText
(WebdavStatus.SC_OK));
Element propstatElement = new Element(E_PROPSTAT, DNSP);
Element propElement = new Element(E_PROP, DNSP);
RequestedProperties propnames =
propertyRetriever.getAllPropertyNames(object.getUri(), true);
Iterator iterator = propnames.getRequestedProperties();
while (iterator.hasNext()) {
RequestedProperty p = (RequestedProperty)iterator.next();
Namespace nsp = DNSP.getURI().equals(p.getNamespace())
? DNSP