/** * Gets the currently processed portlet request. The current portlet request * is automatically defined when the request is started. The current portlet * request can not be used in e.g. background threads because of the way * server implementations reuse request instances. * * @return the current portlet request instance if available, otherwise * <code>null</code> * @since 7.3 */ public static PortletRequest getCurrentPortletRequest() { return VaadinPortletService.getCurrentPortletRequest(); }
@Override protected LegacyApplication createApplication() { VaadinPortlet portlet = VaadinPortlet.getCurrent(); if (portlet instanceof LegacyVaadinPortlet) { LegacyVaadinPortlet legacyPortlet = (LegacyVaadinPortlet) portlet; PortletRequest request = VaadinPortletService .getCurrentPortletRequest(); if (legacyPortlet.shouldCreateApplication(request)) { try { return legacyPortlet.getNewApplication(request); } catch (PortletException e) { throw new RuntimeException(e); } } } return null; } };