protected LegacyApplication getNewApplication(HttpServletRequest request) throws ServletException { try { Class<? extends LegacyApplication> applicationClass = getApplicationClass(); return ReflectTools.createInstance(applicationClass); } catch (Exception e) { throw new ServletException(e); } }
protected Class<? extends LegacyApplication> getApplicationClass() throws ClassNotFoundException { try { return ServletPortletHelper.getLegacyApplicationClass(getService()); } catch (ServiceException e) { throw new RuntimeException(e); } }
@Override protected LegacyApplication createApplication() { VaadinServlet servlet = VaadinServlet.getCurrent(); if (servlet instanceof LegacyVaadinServlet) { LegacyVaadinServlet legacyServlet = (LegacyVaadinServlet) servlet; HttpServletRequest request = VaadinServletService .getCurrentServletRequest(); try { if (legacyServlet.shouldCreateApplication(request)) { return legacyServlet.getNewApplication(request); } } catch (ServletException e) { throw new RuntimeException(e); } } return null; } };
@Override public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); getService().addSessionInitListener((SessionInitEvent event) -> { try { onVaadinSessionStarted(event.getRequest(), event.getSession()); } catch (ServletException e) { throw new ServiceException(e); } }); }