user1700945
user1700945

Reputation: 125

PortletRequest Vaadin 7 and Liferay

In Vaadin 6, you could override onRequestStart to obtain the PortletRequest object like so

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

In Vaadin 7, due to the portlet class change to com.vaadin.server.VaadinPortlet, there is no more onRequestStart to get the PortletReqeust object, just their new VaadinRequest object.

 @Override
    protected void init(VaadinRequest request)

Issue is getting this to a PortletRequest to be used. Anyone found a way to retrieve PortletRequest from Vaadin 7 and liferay?

Upvotes: 1

Views: 717

Answers (2)

mstahv
mstahv

Reputation: 1934

This will do as well

PortletRequest currentPortlet = VaadinPortletService.getCurrentPortletRequest();

Upvotes: 0

user1700945
user1700945

Reputation: 125

Once you find the information that a VaadinRequest is both VaadinPortletRequest and VaadinServletRequest, you can retrieve PortletRequest and HttpServletRequest as so:

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

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

Upvotes: 1

Related Questions