Is there a way to derive a WebDAV path from a DocumentModel?

As part of an operation, I need to retrieve the path to a document's file:content for a remote system to access via WebDAV.

However, the path as retrieved by getPathAsString() and getFilePath() do not match the path to the document as observed via WebDAV.

public void run(DocumentModel input) throws ClientException {
        // ...;
        BlobHolder x = input.getAdapter(BlobHolder.class);;
       // ...


/default-domain/workspaces/Publisher Content/Testing/foo bar
/default-domain/workspaces/Publisher Content/Testing/foo bar/document.pdf

But the observed path to the document is at

http://localhost:8080/nuxeo/site/dav/Publisher Content/Testing/document.pdf

(i.e. no /foo bar/ component).

In an automation operation, where should I be looking to derive a path for a DocumentModel that another system will later be able to access underneath ?

0 votes

1 answers



The WebDAV “path” is basically the the same doc.getPathAsString(), namely the sequence of doc.getName() for the doc objects (that are folderish) leading to the document, except that:

  • the first parts may be skipped depending on the WebDAV virtual roots in effect,
  • the last part, for the document, is not its doc.getName() but the filename of the doc's blob.

See org.nuxeo.ecm.platform.wi.backend.SimpleBackend.getDisplayName for the code.

1 votes

This is exactly the pointer I needed. Thanks.