Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
Mittal Patoliya
How to get the document url in the ModelListener of DLFileEntry
11 gennaio 2013 19.49

Mittal Patoliya

Punteggio: Junior Member

Messaggi: 25

Data di Iscrizione: 14 dicembre 2011

Messaggi recenti

I have implemented the ModelListener for DLFileEntry so that whenever anything is changed in the documentliberary it will call the listener.
Now in Listener I want to access the document URL to view the document which I am going to send with the notification mail.
Could anybody suggest how to create or retrieve the document view URL.

I have checked view_file_entry.jsp in that they are creating URL like this.

url='<%= themeDisplay.getPortalURL() + themeDisplay.getPathContext() + "/documents/" + themeDisplay.getScopeGroupId() + StringPool.SLASH + fileEntry.getUuid() %>'

but in my listener I do not have themDisplay object so not able to replicate that in my listener please help me out with this. Its very urgent.
Jelmer Kuperus
RE: How to get the document url in the ModelListener of DLFileEntry
13 gennaio 2013 1.29

Jelmer Kuperus

Punteggio: Liferay Legend

Messaggi: 1192

Data di Iscrizione: 10 marzo 2010

Messaggi recenti

You have to understand that in Liferay content is not tied to a specific page. The same DLFileEntry could be featured on multiple pages, in multiple groups, belonging to multiple virtual hosts.

When browsing a page on a site themeDisplay gives you the groupId of the page you are viewing now, the portalURL for the current page etc.
So you'll have to be explicit about what you want and hardcode a bunch of things