Index: jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java =================================================================== --- jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java (revision 695483) +++ jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java (working copy) @@ -49,6 +49,9 @@ public static final DavPropertyName SOURCE = DavPropertyName.create(PROPERTY_SOURCE); public static final DavPropertyName SUPPORTEDLOCK = DavPropertyName.create(PROPERTY_SUPPORTEDLOCK); + /* webdav properties defined by the BIND specification */ + public static final DavPropertyName RESOURCEID = DavPropertyName.create(PROPERTY_RESOURCEID); + /* property use by microsoft that are not specified in the RFC 2518 */ public static final DavPropertyName ISCOLLECTION = DavPropertyName.create("iscollection"); Index: jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java =================================================================== --- jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java (revision 695483) +++ jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavConstants.java (working copy) @@ -122,6 +122,11 @@ public static final String PROPERTY_SOURCE = "source"; public static final String PROPERTY_SUPPORTEDLOCK = "supportedlock"; + /* + * Webdav property names as defined by the BIND specification. + */ + public static final String PROPERTY_RESOURCEID = "resource-id"; + //-------------------------------------------------< PropFind Constants >--- public static final int PROPFIND_BY_PROPERTY = 0; public static final int PROPFIND_ALL_PROP = 1; Index: jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java =================================================================== --- jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java (revision 695483) +++ jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java (working copy) @@ -17,6 +17,7 @@ package org.apache.jackrabbit.webdav.simple; import org.apache.jackrabbit.JcrConstants; +import org.apache.jackrabbit.uuid.UUID; import org.apache.jackrabbit.server.io.AbstractExportContext; import org.apache.jackrabbit.server.io.DefaultIOListener; import org.apache.jackrabbit.server.io.ExportContext; @@ -76,6 +77,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.StringTokenizer; /** * DavResourceImpl implements a DavResource. @@ -96,6 +98,7 @@ protected DavPropertySet properties = new DavPropertySet(); protected boolean propsInitialized = false; private boolean isCollection = true; + private String rfc4122Uri; private ResourceConfig config; private long modificationTime = IOUtil.UNDEFINED_TIME; @@ -123,6 +126,7 @@ node = (Node) item; // define what is a collection in webdav isCollection = config.isCollectionResource(node); + this.initRfc4122Uri(); } } catch (PathNotFoundException e) { // ignore: exists field evaluates to false @@ -178,6 +182,7 @@ this.node = node; // define what is a collection in webdav isCollection = config.isCollectionResource(node); + this.initRfc4122Uri(); } } else { throw new DavException(DavServletResponse.SC_NOT_FOUND); @@ -185,6 +190,27 @@ } /** + * If the Node associated with this DavResource has a UUID that allows for the creation of a rfc4122 compliant + * URI, we use it as the value of the protected DAV property DAV:resource-id, which is defined by the BIND + * specification. + */ + private void initRfc4122Uri() { + try { + if (node.isNodeType("mix:referenceable")) { + String uuid = node.getUUID(); + try { + UUID.fromString(uuid); + this.rfc4122Uri = "urn:uuid:" + uuid; + } catch (IllegalArgumentException e) { + //no, this is not a UUID + } + } + } catch (RepositoryException e) { + log.warn("Error while detecting UUID", e); + } + } + + /** * @return DavResource#COMPLIANCE_CLASS * @see org.apache.jackrabbit.webdav.DavResource#getComplianceClass() */ @@ -342,6 +368,10 @@ properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "0")); } + if (rfc4122Uri != null) { + properties.add(new DefaultDavProperty(DavPropertyName.RESOURCEID, rfc4122Uri, true)); + } + /* set current lock information. If no lock is set to this resource, an empty lockdiscovery will be returned in the response. */ properties.add(new LockDiscovery(getLock(Type.WRITE, Scope.EXCLUSIVE)));