cancel
Showing results for 
Search instead for 
Did you mean: 

get full path for a content

friedman30
Champ in-the-making
Champ in-the-making
Hi,

I need to get the full file system path for a content.  :idea:
How do i do that?

Thanks,

Dror
4 REPLIES 4

tfornoville
Champ in-the-making
Champ in-the-making
Do you mean the exact path on your filesystem or a url to download the file through your web-app?

In the latter case you can use this

      String contextPath = getHttpServletRequest().getContextPath();
      String path = Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.HTTP_DOWNLOAD);
      return contextPath + path;

Cheers,
Tom

friedman30
Champ in-the-making
Champ in-the-making
thanks Tom.

I do need the exact path on my filesystem.
any idea how to do that?

:roll:

Dror

tfornoville
Champ in-the-making
Champ in-the-making
I've never done that but you should have a look at the content property.
It should contain a content Url looking a bit like this: contentUrl=store://2007/11/7/14/45/ac49af93-8d37-11dc-a48f-a7d7cc5a9ba6.bin

I suppose you know how to get the content property from a noderef but I'll paste the code just in case  :wink:

NodeService nodeService = serviceRegistry.getNodeService();
nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT);

Cheers,
Tom

friedman30
Champ in-the-making
Champ in-the-making
thanks  Smiley Happy