public Deployment getDeployment(){ return deploymentManager.getDeployment(); }
@Override public ServletContext getServletContext() { return this.manager.getDeployment().getServletContext(); }
@Override public void start() throws Exception { HttpHandler handler = manager.start(); host.getValue().registerDeployment(manager.getDeployment(), handler); }
@Override public void stop() throws Exception { host.getValue().unregisterDeployment(manager.getDeployment()); manager.stop(); }
public void startContext() throws ServletException { final ClassLoader old = Thread.currentThread().getContextClassLoader(); DeploymentInfo deploymentInfo = deploymentInfoInjectedValue.getValue(); Thread.currentThread().setContextClassLoader(deploymentInfo.getClassLoader()); try { StartupContext.setInjectionContainer(webInjectionContainer); try { deploymentManager = container.getValue().getServletContainer().addDeployment(deploymentInfo); deploymentManager.deploy(); HttpHandler handler = deploymentManager.start(); Deployment deployment = deploymentManager.getDeployment(); host.getValue().registerDeployment(deployment, handler); } finally { StartupContext.setInjectionContainer(null); } } finally { Thread.currentThread().setContextClassLoader(old); } }
public void stopContext() { final ClassLoader old = Thread.currentThread().getContextClassLoader(); DeploymentInfo deploymentInfo = deploymentInfoInjectedValue.getValue(); Thread.currentThread().setContextClassLoader(deploymentInfo.getClassLoader()); try { if (deploymentManager != null) { Deployment deployment = deploymentManager.getDeployment(); try { host.getValue().unregisterDeployment(deployment); deploymentManager.stop(); } catch (ServletException e) { throw new RuntimeException(e); } deploymentManager.undeploy(); container.getValue().getServletContainer().removeDeployment(deploymentInfoInjectedValue.getValue()); } recursiveDelete(deploymentInfoInjectedValue.getValue().getTempDir()); } finally { Thread.currentThread().setContextClassLoader(old); } }
DeploymentManager manager = Servlets.newContainer().addDeployment(deployment); manager.deploy(); SessionManager sessionManager = manager.getDeployment().getSessionManager(); Duration timeoutDuration = getSession().getTimeout(); int sessionTimeout = (isZeroOrLess(timeoutDuration) ? -1
void initializeServlet(String name) { try { this.webServer.getDeploymentManager().getDeployment().getServlets() .getManagedServlet(name).forceInit(); } catch (ServletException ex) { // Continue } }
public Deployment getDeployment(){ return deploymentManager.getDeployment(); }
public Deployment getDeployment(){ return deploymentManager.getDeployment(); }
@Override public ServletContext getContext(final String uripath) { DeploymentManager deploymentByPath = servletContainer.getDeploymentByPath(uripath); if (deploymentByPath == null) { return null; } return deploymentByPath.getDeployment().getServletContext(); }
@Override public void stop() throws Exception { host.getValue().unregisterDeployment(manager.getDeployment()); manager.stop(); }
@Override public void stop() throws Exception { host.getValue().unregisterDeployment(manager.getDeployment()); manager.stop(); }
@Override public void start() throws Exception { HttpHandler handler = manager.start(); host.getValue().registerDeployment(manager.getDeployment(), handler); }
@Override public void start() throws Exception { HttpHandler handler = manager.start(); host.getValue().registerDeployment(manager.getDeployment(), handler); }
private void undeploy(DeploymentManager deploymentManager) { final Deployment deployment = deploymentManager.getDeployment(); CamelLogger.LOGGER.debug("Undeploying endpoint {}", deployment.getDeploymentInfo().getDeploymentName()); final ClassLoader old = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(deployment.getDeploymentInfo().getClassLoader()); try { try { hostSupplier.getValue().unregisterDeployment(deployment); deploymentManager.stop(); } catch (ServletException e) { throw new RuntimeException(e); } deploymentManager.undeploy(); servletContainerServiceSupplier.getValue().getServletContainer().removeDeployment(deployment.getDeploymentInfo()); } finally { Thread.currentThread().setContextClassLoader(old); } }
public Injector getInjector() { for (ListenerInfo listener : fathomDeploymentManager.getDeployment().getDeploymentInfo().getListeners()) { if (ServletContextListener.class == listener.getListenerClass()) { try { ServletContextListener servletContextListener = (ServletContextListener) listener .getInstanceFactory().createInstance().getInstance(); Injector injector = servletContextListener.getInjector(); return injector; } catch (Exception e) { log.error("Failed to get Guice injector!", e); return null; } } } return null; }
private ServletContext buildServletContext(String contextName) throws ServletException { ServletContainer servletContainer = new ServletContainerImpl(); DeploymentInfo deploymentInfo = new DeploymentInfo(); deploymentInfo.setClassLoader(Thread.currentThread().getContextClassLoader()); deploymentInfo.setDeploymentName("cxf-undertow"); deploymentInfo.setContextPath(contextName); ServletInfo asyncServlet = new ServletInfo(ServletPathMatches.DEFAULT_SERVLET_NAME, CxfUndertowServlet.class); deploymentInfo.addServlet(asyncServlet); servletContainer.addDeployment(deploymentInfo); DeploymentManager deploymentManager = servletContainer.getDeployment(deploymentInfo.getDeploymentName()); deploymentManager.deploy(); deploymentManager.start(); return deploymentManager.getDeployment().getServletContext(); }
private ServletContext buildServletContext(String contextName) throws ServletException { ServletContainer servletContainer = new ServletContainerImpl(); DeploymentInfo deploymentInfo = new DeploymentInfo(); deploymentInfo.setClassLoader(Thread.currentThread().getContextClassLoader()); deploymentInfo.setDeploymentName("cxf-undertow"); deploymentInfo.setContextPath(contextName); ServletInfo asyncServlet = new ServletInfo(ServletPathMatches.DEFAULT_SERVLET_NAME, CxfUndertowServlet.class); deploymentInfo.addServlet(asyncServlet); servletContainer.addDeployment(deploymentInfo); DeploymentManager deploymentManager = servletContainer.getDeployment(deploymentInfo.getDeploymentName()); deploymentManager.deploy(); deploymentManager.start(); return deploymentManager.getDeployment().getServletContext(); }
protected void deployServlet(final DeploymentInfo deploymentInfo) { DeploymentManager manager = ServletContainer.Factory.newInstance().addDeployment(deploymentInfo); manager.deploy(); deployment = manager.getDeployment(); try { injectedHost.getValue().registerDeployment(deployment, manager.start()); } catch (ServletException e) { RTSLogger.ROOT_LOGGER.warn(e.getMessage(), e); deployment = null; } }