2

I am building a notification system and need to store the last time a given user visited a private (or separately public) page for a given group.

Is there a way to build a listener that will be triggered every time a new page is loaded ?

Thanks, Alain

4

1 回答 1

2

你在正确的轨道上!

首先在您的插件中创建/WEB-INF/liferay-hook.xml. 写:

<hook>
    <portal-properties>portal.properties</portal-properties>
</hook>

接下来,创建/WEB-INF/src/portal.properties. servlet.service.events.pre用监听器类定义:

servlet.service.events.pre=com.example.hook.events.ServicePreAction

接下来,创建该类:

package com.example.hook.events;

import com.liferay.portal.kernel.events.Action;
import com.liferay.portal.kernel.events.ActionException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ServicePreAction extends Action {

    @Override
    public void run(HttpServletRequest request, HttpServletResponse response)
        throws ActionException {
    }

}

从那里您可以ThemeDisplay从请求中获取对象,该对象将包含您需要的所有信息。

于 2013-10-09T21:30:03.337 回答