cancel
Showing results for 
Search instead for 
Did you mean: 

document view url

ucf
Champ on-the-rise
Champ on-the-rise
Hi everybody,
I'm a beginner in alfresco and I'm really stuck on an issue, I want to retrieve view url (using java)of a document in order to make it available to the user to read it before approval, if anyone can help that'll be great
thank you,
5 REPLIES 5

afaust
Legendary Innovator
Legendary Innovator
Hello,

what do you consider a "view URL" - a URL to the details page of Alfresco Share or a URL to the actual document. For the latter, please have a look at ScriptNode.getDownloadUrl() to see how you could generate a (standard) URL. For the details page of Alfresco Share it is a bit uncommon to do this in Java. If your Java is intended to run in the Repository, use the SysAdminParams to retrieve the host, port and context of Share, and suffix that with the page URL (which can be considered standard / stable), i.e. /page/document-details?nodeRef= - and then add the NodeRef as an URL-encoded String.

Since the concept of "view URL" really depends on what you want to provide to your users, there is no standard service that you can simply query to give you a one-fits-all URL…

Regards
Axel

ucf
Champ on-the-rise
Champ on-the-rise
thank you, I want to get the url of the actual doncument so that the recipient could read it

romschn
Star Collaborator
Star Collaborator
If your whole purpose is to render the content to the user than you can use out-of-the-box webscript api/node and pass the required parameters to it as shown in the example here - http://localhost:8080/alfresco/service/api/node/content/workspace/SpacesStore/node-id

ucf
Champ on-the-rise
Champ on-the-rise
thanks but the problem is how to get those parameters that come after: "http://127.0.0.1:8090/share/proxy/alfresco/api/node/content/workspace/SpacesStore/" here's an example of the url I want to provide to the user 127.0.0.1:8090/share/proxy/alfresco/api/node/content/workspace/SpacesStore/bf1d499c-98f0-478a-8d12-957b8cd6cabb/somedoc.pdf

afaust
Legendary Innovator
Legendary Innovator
Hello,

these parameters come from the document. workspace/SpacesStore/bf1d499c-98f0-478a-8d12-957b8cd6cabb is the unique / stable reference to that document derived from the so-called NodeRef (which is workspace://SpacesStore/bf1d499c-98f0-478a-8d12-957b8cd6cabb).
The somedoc.pdf is simply the name of the document. You can actually put anything in here as the name is not used to locate the document in Alfresco - it is "only" a hint for the browser so that when a user downloads the document, it is downloaded with the correct name.

You need to have the NodeRef / id to the document in order to generate any URL to it. If you only have the path, you could use a WebDAV link instead (e.g. /alfresco/webdav/path/to/document.pdf).

Regards
Axel