Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Mittal Patoliya
How to get the document url in the ModelListener of DLFileEntry
January 11, 2013 7:49 PM

Mittal Patoliya

Rank: Junior Member

Posts: 25

Join Date: December 14, 2011

Recent Posts

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
January 13, 2013 1:29 AM

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

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

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!