PortletRequest Vaadin 7和Liferay

时间:2014-05-21 14:30:59

标签: liferay vaadin liferay-6 vaadin7

在Vaadin 6中, 您可以覆盖onRequestStart以获取PortletRequest对象,如此

@Override
    public void onRequestStart(PortletRequest request, PortletResponse response)

在Vaadin 7中,由于portlet类更改为com.vaadin.server.VaadinPortlet,因此不再需要onRequestStart来获取PortletReqeust对象,只需获取新的VaadinRequest对象。

 @Override
    protected void init(VaadinRequest request)

问题是将此问题转移到要使用的PortletRequest。有人找到了从Vaadin 7和liferay中检索PortletRequest的方法吗?

2 个答案:

答案 0 :(得分:1)

一旦你发现VaadinRequest既是VaadinPortletRequest又是VaadinServletRequest的信息,你可以检索PortletRequest和HttpServletRequest:

        VaadinPortletRequest vprRequest = (VaadinPortletRequest) request;
        PortletRequest pRequest = vprRequest.getPortletRequest();

        VaadinServletRequest vsRequest = (VaadinServletRequest)request;
        HttpServletRequest hsRequest = vsRequest.getHttpServletRequest();

答案 1 :(得分:0)

这也可以

PortletRequest currentPortlet = VaadinPortletService.getCurrentPortletRequest();