I’ve asked the same question in Liferay community but with no answers so I try here 🙂
I need to perform an action/call a method everytime a user download a file from the document library, for simplicity I’d say a System.out.println(“a file has been downloaded”) everytime the user click on the direct file link.
Do you have any idea on how I can achieve this?
I’m using LR 6.0.6 CE and would really try to avoid the EXT environment… any idea on how to achieve this with a hook would be much appreciated!!
I was thinking about adding some javascript on the JSP (onClick) that calls the System.out.println() function, but not sure if it’s possible.
I thought about action hooks, model listeners, override a service… what do you think would be the best way?
I’ve found a way to achieve this creating a model Listener for the DLFileEntry model and overriding the method “onAfterUpdate”, which is triggered every time a document is downloaded because it changes the value of the readcount variable.