void start() { // '%2F' (slash /) and '%5C' (backslash \) are permitted as path delimiters in URLs System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true"); System.setProperty("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE", "true"); tomcat = new Tomcat(); // Initialize directories String basedir = tomcatBasedir().getAbsolutePath(); tomcat.setBaseDir(basedir); tomcat.getHost().setAppBase(basedir); tomcat.getHost().setAutoDeploy(false); tomcat.getHost().setCreateDirs(false); tomcat.getHost().setDeployOnStartup(true); new TomcatAccessLog().configure(tomcat, props); TomcatConnectors.configure(tomcat, props); webappContext = new TomcatContexts().configure(tomcat, props); try { tomcat.start(); new TomcatStartupLogs(Loggers.get(getClass())).log(tomcat); } catch (LifecycleException e) { Loggers.get(EmbeddedTomcat.class).error("Fail to start web server", e); Throwables.propagate(e); } }
localHost.addChild(rootContext); localHost.setDeployOnStartup(true);
tomcat.getHost().setDeployOnStartup(true);
protected void run() { System.setProperty("java.naming.factory.url", "org.eclipse.jetty.jndi"); System.setProperty("java.naming.factory.initial", "org.eclipse.jetty.jndi.InitialContextFactory"); server = new Tomcat(); server.setPort(port); try { final File base = createTemporaryDirectory(); server.setBaseDir(base.getAbsolutePath()); server.getHost().setAppBase(base.getAbsolutePath()); server.getHost().setAutoDeploy(true); server.getHost().setDeployOnStartup(true); server.addWebapp(contextPath, getClass().getResource(resourcePath).toURI().getPath().toString()); server.start(); } catch (final Exception ex) { ex.printStackTrace(); fail(ex.getMessage()); } }
protected void run() { System.setProperty("java.naming.factory.url", "org.eclipse.jetty.jndi"); System.setProperty("java.naming.factory.initial", "org.eclipse.jetty.jndi.InitialContextFactory"); server = new Tomcat(); server.setPort(port); try { final File base = createTemporaryDirectory(); server.setBaseDir(base.getAbsolutePath()); server.getHost().setAppBase(base.getAbsolutePath()); server.getHost().setAutoDeploy(true); server.getHost().setDeployOnStartup(true); server.addWebapp(contextPath, getClass().getResource(resourcePath).toURI().getPath().toString()); server.start(); } catch (final Exception ex) { ex.printStackTrace(); fail(ex.getMessage()); } }
private Host prepareHost(Tomcat tomcat, List<String> virtualHosts) { Host host; if (UtilValidate.isEmpty(virtualHosts)) { host = tomcat.getHost(); } else { host = prepareVirtualHost(tomcat, virtualHosts); } host.setAppBase(System.getProperty("ofbiz.home") + "/framework/catalina/hosts"); host.setDeployOnStartup(false); host.setBackgroundProcessorDelay(5); host.setAutoDeploy(false); ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP), "work" + File.separator + host.getName()).getAbsolutePath()); return host; }
/** * Process a "start" event for this Host. */ public void start() { if (log.isDebugEnabled()) log.debug(sm.getString("hostConfig.start")); try { ObjectName hostON = host.getObjectName(); oname = new ObjectName (hostON.getDomain() + ":type=Deployer,host=" + host.getName()); Registry.getRegistry(null, null).registerComponent (this, oname, this.getClass().getName()); } catch (Exception e) { log.error(sm.getString("hostConfig.jmx.register", oname), e); } if (!host.getAppBaseFile().isDirectory()) { log.error(sm.getString("hostConfig.appBase", host.getName(), host.getAppBaseFile().getPath())); host.setDeployOnStartup(false); host.setAutoDeploy(false); } if (host.getDeployOnStartup()) deployApps(); }
tomcat.getHost().setAppBase(tempDirectory.getAbsolutePath()); tomcat.getHost().setAutoDeploy(true); tomcat.getHost().setDeployOnStartup(true); tomcat.getConnector().setURIEncoding("UTF-8"); Context context = tomcat.addWebapp(tomcat.getHost(), "/openmrs", new File(serverPath, warFile).getAbsolutePath());
/** * Process a "start" event for this Host. */ public void start() { if (log.isDebugEnabled()) log.debug(sm.getString("hostConfig.start")); try { ObjectName hostON = host.getObjectName(); oname = new ObjectName (hostON.getDomain() + ":type=Deployer,host=" + host.getName()); Registry.getRegistry(null, null).registerComponent (this, oname, this.getClass().getName()); } catch (Exception e) { log.error(sm.getString("hostConfig.jmx.register", oname), e); } if (!host.getAppBaseFile().isDirectory()) { log.error(sm.getString("hostConfig.appBase", host.getName(), host.getAppBaseFile().getPath())); host.setDeployOnStartup(false); host.setAutoDeploy(false); } if (host.getDeployOnStartup()) deployApps(); }
log.error(sm.getString( "hostConfig.appBase", host.getName(), appBase().getPath())); host.setDeployOnStartup(false); host.setAutoDeploy(false);
log.error(sm.getString( "hostConfig.appBase", host.getName(), appBase().getPath())); host.setDeployOnStartup(false); host.setAutoDeploy(false);
log.error(sm.getString("hostConfig.appBase", host.getName(), host.getAppBaseFile().getPath())); host.setDeployOnStartup(false); host.setAutoDeploy(false);
void start() { // '%2F' (slash /) and '%5C' (backslash \) are permitted as path delimiters in URLs System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true"); System.setProperty("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE", "true"); tomcat = new Tomcat(); // Initialize directories String basedir = tomcatBasedir().getAbsolutePath(); tomcat.setBaseDir(basedir); tomcat.getHost().setAppBase(basedir); tomcat.getHost().setAutoDeploy(false); tomcat.getHost().setCreateDirs(false); tomcat.getHost().setDeployOnStartup(true); new TomcatAccessLog().configure(tomcat, props); TomcatConnectors.configure(tomcat, props); webappContext = new TomcatContexts().configure(tomcat, props); try { tomcat.start(); new TomcatStartupLogs(Loggers.get(getClass())).log(tomcat); } catch (LifecycleException e) { Loggers.get(EmbeddedTomcat.class).error("Fail to start web server", e); Throwables.propagate(e); } }
host.setDeployOnStartup(false); host.setAutoDeploy(false);
private Tomcat initServer() { Tomcat tomcat = new Tomcat(); tomcat.setBaseDir(configuration.getBaseDir()); tomcat.setPort(configuration.getPort()); tomcat.getHost().setAutoDeploy(true); tomcat.getHost().setDeployOnStartup(true); if (configuration.isEnableNaming()) { tomcat.enableNaming(); } return tomcat; }
protected void run() { server = new Tomcat(); server.setPort(port); try { final File base = createTemporaryDirectory(); server.setBaseDir(base.getAbsolutePath()); if (resourcePath == null) { final Context context = server.addContext("/", base.getAbsolutePath()); final Wrapper cxfServlet = Tomcat.addServlet(context, "cxfServlet", new CXFNonSpringJaxrsServlet()); cxfServlet.addInitParameter("jaxrs.serviceClasses", BookStore.class.getName()); cxfServlet.addInitParameter("jaxrs.providers", JacksonJsonProvider.class.getName()); cxfServlet.setAsyncSupported(true); context.addServletMappingDecoded("/rest/*", "cxfServlet"); } else { server.getHost().setAppBase(base.getAbsolutePath()); server.getHost().setAutoDeploy(true); server.getHost().setDeployOnStartup(true); server.addWebapp(contextPath, getClass().getResource(resourcePath).toURI().getPath().toString()); } server.start(); } catch (final Exception ex) { ex.printStackTrace(); fail(ex.getMessage()); } }