private void addInstanceIdToEngineName() { int instanceId = containerCounter.incrementAndGet(); if (instanceId > 0) { Engine engine = this.tomcat.getEngine(); engine.setName(engine.getName() + "-" + instanceId); } }
/** * Returns the {@link Engine} of the specified Tomcat {@link Service}. If the {@link Service} has no * {@link Engine} set, a new {@link Engine} will be created and set. * * <p>The return type of {@link Service#getContainer()} has been changed from {@link Container} to * {@link Engine} since 8.5. Calling it directly will cause {@link NoSuchMethodError}. */ static Engine engine(Service service, String hostname) { final Engine engine; try { final Method m = Service.class.getDeclaredMethod("getContainer"); engine = (Engine) m.invoke(service); } catch (Exception e) { throw new Error("failed to invoke Service.getContainer()", e); } if (engine != null) { return engine; } // Create a new engine. final Engine newEngine = new StandardEngine(); newEngine.setName("Tomcat"); newEngine.setDefaultHost(hostname); newEngine.setRealm(new NullRealm()); service.setContainer(newEngine); return newEngine; }
engine.setName("localEngine"); engine.addChild(localHost); engine.setDefaultHost(localHost.getName());
engine.setName("localEngine"); engine.addChild(localHost); engine.setDefaultHost(localHost.getName());
@Override protected void configure(ServerBuilder sb) throws Exception { // Prepare Tomcat instances. tomcatWithWebApp = new Tomcat(); tomcatWithWebApp.setPort(0); tomcatWithWebApp.setBaseDir("build" + File.separatorChar + "tomcat-" + UnmanagedTomcatServiceTest.class.getSimpleName() + "-1"); tomcatWithWebApp.addWebapp("", WebAppContainerTest.webAppRoot().getAbsolutePath()); TomcatUtil.engine(tomcatWithWebApp.getService(), "foo").setName("tomcatWithWebApp"); tomcatWithoutWebApp = new Tomcat(); tomcatWithoutWebApp.setPort(0); tomcatWithoutWebApp.setBaseDir("build" + File.separatorChar + "tomcat-" + UnmanagedTomcatServiceTest.class.getSimpleName() + "-2"); assertThat(TomcatUtil.engine(tomcatWithoutWebApp.getService(), "bar")).isNotNull(); // Start the Tomcats. tomcatWithWebApp.start(); tomcatWithoutWebApp.start(); // Bind them to the Server. sb.serviceUnder("/empty/", TomcatService.forConnector("someHost", new Connector())) .serviceUnder("/some-webapp-nohostname/", TomcatService.forConnector(tomcatWithWebApp.getConnector())) .serviceUnder("/no-webapp/", TomcatService.forTomcat(tomcatWithoutWebApp)) .serviceUnder("/some-webapp/", TomcatService.forTomcat(tomcatWithWebApp)); } };
private Engine prepareTomcatEngine(Tomcat tomcat, Property engineConfig) { Engine engine = tomcat.getEngine(); engine.setName(engineConfig.name); // set the JVM Route property (JK/JK2) String jvmRoute = ContainerConfig.getPropertyValue(engineConfig, "jvm-route", null); if (jvmRoute != null) { engine.setJvmRoute(jvmRoute); } return engine; }
/** * Access to the engine, for further customization. */ public Engine getEngine() { if(engine == null ) { getServer(); engine = new StandardEngine(); engine.setName( "Tomcat" ); engine.setDefaultHost(hostname); service.setContainer(engine); } return engine; }
/** * Access to the engine, for further customization. */ public Engine getEngine() { if(engine == null ) { getServer(); engine = new StandardEngine(); engine.setName( "Tomcat" ); engine.setDefaultHost(hostname); service.setContainer(engine); } return engine; }
/** * Access to the engine, for further customization. */ public Engine getEngine() { if(engine == null ) { getServer(); engine = new StandardEngine(); engine.setName( "Tomcat" ); engine.setDefaultHost(hostname); service.setContainer(engine); } return engine; }
public TomcatWebServerEnvironment(final String catalinaHome, final int port) { container = new Embedded(); container.setCatalinaHome(catalinaHome); //container.setRealm(new MemoryRealm()); localHost = container.createHost("localHost", new File(".").getAbsolutePath()); final Engine engine = container.createEngine(); engine.setName("localEngine"); engine.addChild(localHost); engine.setDefaultHost(localHost.getName()); container.addEngine(engine); final Connector httpConnector = container.createConnector((InetAddress) null, port, false); container.addConnector(httpConnector); container.setAwait(true); webAppLoader = new WebappLoader(this.getClass().getClassLoader()); if (classesDir != null) { try { webAppLoader.addRepository(new File(classesDir).toURI().toURL().toString()); } catch (final MalformedURLException e) { e.printStackTrace(); } } }
/** * Access to the engine, for further customization. */ public Engine getEngine() { if(engine == null ) { getServer(); engine = new StandardEngine(); engine.setName( "Tomcat" ); engine.setDefaultHost(hostname); engine.setRealm(createDefaultRealm()); service.setContainer(engine); } return engine; }
/** * Access to the engine, for further customization. */ public Engine getEngine() { if(engine == null ) { getServer(); engine = new StandardEngine(); engine.setName( "Tomcat" ); engine.setDefaultHost(hostname); if (defaultRealm == null) { initSimpleAuth(); } engine.setRealm(defaultRealm); service.setContainer(engine); } return engine; }
/** * Access to the engine, for further customization. */ public Engine getEngine() { if(engine == null ) { getServer(); engine = new StandardEngine(); engine.setName( "Tomcat" ); engine.setDefaultHost(hostname); if (defaultRealm == null) { initSimpleAuth(); } engine.setRealm(defaultRealm); service.setContainer(engine); } return engine; }
tomcat.getEngine().setName(configuration.getServerName());
/** * Access to the engine, for further customization. * @return The engine */ public Engine getEngine() { Service service = getServer().findServices()[0]; if (service.getContainer() != null) { return service.getContainer(); } Engine engine = new StandardEngine(); engine.setName( "Tomcat" ); engine.setDefaultHost(hostname); engine.setRealm(createDefaultRealm()); service.setContainer(engine); return engine; }
/** * Access to the engine, for further customization. * @return The engine */ public Engine getEngine() { Service service = getServer().findServices()[0]; if (service.getContainer() != null) { return service.getContainer(); } Engine engine = new StandardEngine(); engine.setName( "Tomcat" ); engine.setDefaultHost(hostname); engine.setRealm(createDefaultRealm()); service.setContainer(engine); return engine; }
rtmptEngine.setName("red5RTMPTEngine"); rtmptEngine.setDefaultHost(host.getName()); rtmptEngine.setRealm(embedded.getEngine().getRealm());
engine.setName( "localEngine-" + port ); engine.addChild( host ); engine.setDefaultHost( host.getName() );
log.info("Loading RTMPS context"); rtmpsEngine = new StandardEngine(); rtmpsEngine.setName("red5RTMPSEngine"); rtmpsEngine.setDefaultHost(host.getName()); rtmpsEngine.setRealm(embedded.getEngine().getRealm());
_embedded.addEngine(engine); ((StandardEngine) engine).setDomain(_serverContext.getDefaultDomainName()); engine.setName(_serverContext.getDefaultDomainName());