@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; } };
protected Class<? extends LegacyApplication> getApplicationClass() throws ClassNotFoundException { try { return ServletPortletHelper.getLegacyApplicationClass(getService()); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override public void init(PortletConfig portletConfig) throws PortletException { super.init(portletConfig); getService().addSessionInitListener((SessionInitEvent event) -> { try { onVaadinSessionStarted( (VaadinPortletRequest) event.getRequest(), (VaadinPortletSession) event.getSession()); } catch (PortletException e) { throw new ServiceException(e); } }); }
protected LegacyApplication getNewApplication(PortletRequest request) throws PortletException { try { Class<? extends LegacyApplication> applicationClass = getApplicationClass(); return ReflectTools.createInstance(applicationClass); } catch (Exception e) { throw new PortletException(e); } }