File URLs within JSF Context Only
The default URL pattern for downloading files from within the JSF environment is:
http://NUXEO_SERVER/nuxeo/nxfile/{repository}/{uuid}/blobholder:{blobIndex}/{fileName}http://NUXEO_SERVER/nuxeo/nxfile/{repository}/{uuid}/{propertyXPath}/{fileName}
repositoryis the identifier of the target repository,uuidis the uuid of the target document,blobIndexis the index of the Blob inside theBlobHolderadapter corresponding to the target Document Type (starting at 0),propertyXPathis the xPath of the target Blob property inside the target document,fileNameis the name of the file as it should be downloaded (this information is actually not used to do the resolution).
Here are some examples :
http://NUXEO_SERVER/nuxeo/nxfile/default/776c8640-7f19-4cf3-b4ff-546ea1d3d496/file:content/rm.pdfhttp://NUXEO_SERVER/nuxeo/nxfile/default/776c8640-7f19-4cf3-b4ff-546ea1d3d496/blobholder:0/rm.pdfhttp://NUXEO_SERVER/nuxeo/nxfile/default/776c8640-7f19-4cf3-b4ff-546ea1d3d496/files:files/0/file/SC-DM-DAM.pnghttp://NUXEO_SERVER/nuxeo/nxfile/default/776c8640-7f19-4cf3-b4ff-546ea1d3d496/blobholder:1/SC-DM-DAM.png
For Picture document type, a similar system is available to be able to get the attachments depending on the view name:
http://NUXEO_SERVER/nuxeo/nxpicsfile/{repository}/{uuid}/{viewName}:content/{fileName}
where, by default, viewName can be Original, OriginalJpeg, Medium, Thumbnail.
Producing File URLs from JSF Templates
For a single file, in schema "file", where blob field is named "file" and file name field is named "filename":
<nxh:outputLink
value="#{nxd:fileUrl('downloadFile', currentDocument, field.fullName, currentDocument.file.filename)}">
<nxh:graphicImage
value="#{nxd:fileIconPath(currentDocument[field.schemaName][field.fieldName])}"
rendered="#{! empty nxd:fileIconPath(currentDocument[field.schemaName][field.fieldName])}" />
<nxh:outputText value="#{currentDocument.file.filename}" />
</nxh:outputLink>
For a list of files, in schema "files", where list name is "files" and in each item, blob field is named "file" and file name field is named "filename":
<nxu:inputList value="#{currentDocument.files.files}" model="model"
rendered="#{not empty currentDocument.files.files}">
<nxh:outputLink
value="#{nxd:complexFileUrl('downloadFile', currentDocument, 'files:files', model.rowIndex, 'file', currentDocument.files.files[model.rowIndex].filename)}">
<nxh:graphicImage
value="#{nxd:fileIconPath(currentDocument.files.files[model.rowIndex].file)}"
rendered="#{! empty nxd:fileIconPath(currentDocument.files.files[model.rowIndex].file)}" />
<nxh:outputText value="#{currentDocument.files.files[model.rowIndex].filename}" />
</nxh:outputLink>
<t:htmlTag value="br" />
</nxu:inputList>
This gives you get URLs of the form:
http://NUXEO_SERVER/nuxeo/nxfile/default/8f5aca13-e9d9-4b7b-a1d9-a1dcd74cc709/blobholder:0/mainfile.jpg
http://NUXEO_SERVER/nuxeo/nxfile/default/47ad14f2-c7a6-4a3f-8e4b-6c2cf1458f5a/files:files/0/file/firstfile.jpg
Namespaces:
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:nxh="http://nuxeo.org/nxweb/html"
xmlns:nxl="http://nuxeo.org/nxforms/layout"
xmlns:nxu="http://nuxeo.org/nxweb/util"