/** * Creates a vaadin servlet service. This method functions as a layer of * indirection between {@link #init(ServletConfig)} and * {@link #createServletService(DeploymentConfiguration)} so dependency * injection frameworks can call {@link #createDeploymentConfiguration()} * when creating a vaadin servlet service lazily. * * @return the created vaadin servlet service * * @throws ServletException * if creating a deployment configuration fails * @throws ServiceException * if creating the vaadin servlet service fails */ protected VaadinServletService createServletService() throws ServletException, ServiceException { return createServletService(createDeploymentConfiguration()); }
@Override public String getServiceName() { return getServlet().getServletName(); }
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { super.service(wrapRequest(request), response); }
/** * Creates a deployment configuration to be used for the creation of a * {@link VaadinService}. Intended to be used by dependency injection * frameworks. * * @return the created deployment configuration * * @throws ServletException * if construction of the {@link Properties} for * {@link DeploymentConfigurationFactory#createInitParameters(Class, ServletConfig)} * fails */ protected DeploymentConfiguration createDeploymentConfiguration() throws ServletException { return createDeploymentConfiguration(DeploymentConfigurationFactory .createInitParameters(getClass(), getServletConfig())); }
HttpServletResponse response) throws ServletException, IOException { if (handleContextOrServletRootWithoutSlash(request, response)) { return; if (serveStaticOrWebJarRequest(request, response)) { return; VaadinServletRequest vaadinRequest = createVaadinRequest(request); VaadinServletResponse vaadinResponse = createVaadinResponse(response); if (!ensureCookiesEnabled(vaadinRequest, vaadinResponse)) { return; getService().handleRequest(vaadinRequest, vaadinResponse); } catch (ServiceException e) { throw new ServletException(e);
@Override public boolean isActive() { VaadinServlet servlet = VaadinServlet.getCurrent(); return servlet instanceof CdiVaadinServlet || (servlet == null && CdiVaadinServlet.getCurrentServletName() != null); }
.getServletConfig(); throw new ServiceException( "Failed to initialize Atmosphere for " + service.getServlet().getServletName() + ". Push will not work.", e);
@Override protected DeploymentConfiguration createDeploymentConfiguration( Properties initParameters) { Properties properties = new Properties(initParameters); config(properties); return super.createDeploymentConfiguration(properties); }
@Override public void init(ServletConfig servletConfig) throws ServletException { try { servletName.set(servletConfig.getServletName()); super.init(servletConfig); } finally { servletName.set(null); } }
super.init(servletConfig); try { servletService = createServletService(); } catch (ServiceException e) { throw new ServletException("Could not initialize VaadinServlet", e); staticFileHandler = createStaticFileHandler(servletService); servletInitialized(); CurrentInstance.clearAll();
@Override public boolean isActive() { VaadinServlet servlet = VaadinServlet.getCurrent(); return servlet instanceof CdiVaadinServlet || (servlet == null && CdiVaadinServlet.getCurrentServletName() != null); }
@Override protected DeploymentConfiguration createDeploymentConfiguration( Properties initParameters) { Properties properties = new Properties(initParameters); config(properties); return super.createDeploymentConfiguration(properties); }
@Override public void init(ServletConfig servletConfig) throws ServletException { try { SERVLET_NAME.set(servletConfig.getServletName()); super.init(servletConfig); } finally { SERVLET_NAME.set(null); } }
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { servletName.set(getServletName()); super.service(request, response); } finally { servletName.set(null); } }
/** * Service destroy event observer. * * During application shutdown it is container specific whether * this observer being called, or not. * Application context destroy may happen earlier, and cleanup * done by {@link #destroyAll()}. * * @param event service destroy event */ private void onServiceDestroy(@Observes(notifyObserver = IF_EXISTS) ServiceDestroyEvent event) { if (!(event.getSource() instanceof VaadinServletService)) { return; } VaadinServletService service = (VaadinServletService) event.getSource(); String servletName = service.getServlet().getServletName(); destroy(servletName); }
@Override public boolean isActive() { VaadinServlet servlet = VaadinServlet.getCurrent(); return servlet instanceof CdiVaadinServlet || (servlet == null && CdiVaadinServlet.getCurrentServletName() != null); }
@Override public void init(ServletConfig servletConfig) throws ServletException { try { servletName.set(servletConfig.getServletName()); super.init(servletConfig); } finally { servletName.set(null); } }
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { servletName.set(getServletName()); super.service(request, response); } finally { servletName.set(null); } }
/** * Service destroy event observer. * * During application shutdown it is container specific whether * this observer being called, or not. * Application context destroy may happen earlier, and cleanup * done by {@link #destroyAll()}. * * @param event service destroy event */ private void onServiceDestroy(@Observes(notifyObserver = IF_EXISTS) ServiceDestroyEvent event) { if (!(event.getSource() instanceof VaadinServletService)) { return; } VaadinServletService service = (VaadinServletService) event.getSource(); String servletName = service.getServlet().getServletName(); destroy(servletName); }
@Override protected ContextualStorage getContextualStorage( Contextual<?> contextual, boolean createIfNotExist) { CdiVaadinServlet servlet = (CdiVaadinServlet) VaadinServlet.getCurrent(); String servletName; if (servlet != null) { servletName = servlet.getServletName(); } else { servletName = CdiVaadinServlet.getCurrentServletName(); } return contextManager.getContextualStorage(servletName, createIfNotExist); }