final StandardEngine engine = new StandardEngine(); engine.setName(config.engineName()); engine.setDefaultHost(hostname); engine.setRealm(config.realm()); engine.setBackgroundProcessorDelay(-1); StandardHost host = (StandardHost) engine.findChild(hostname); if (host == null) { host = new StandardHost(); host.setName(hostname); engine.addChild(host);
public String getDomain() { if (domain!=null) { return domain; } else { return getName(); } }
public static StandardContext createContext() { final StandardEngine engine = new StandardEngine(); engine.setService( new StandardService() ); final StandardContext context = new StandardContext(); context.setPath( "/" ); context.setSessionCookiePath( "/" ); final WebappLoader webappLoader = new WebappLoader() { @Override public ClassLoader getClassLoader() { return Thread.currentThread().getContextClassLoader(); } }; context.setLoader( webappLoader ); final StandardHost host = new StandardHost(); engine.addChild( host ); host.addChild( context ); return context; }
/** * Creates a new StandardService and StandardEngine. * * @param domain Domain name for the container instance * @param defaultHost Name of the default host to be used in the Engine * @param baseDir Base directory value for Engine * * @exception Exception if an MBean cannot be created or registered */ public String createStandardServiceEngine(String domain, String defaultHost, String baseDir) throws Exception{ if (!(container instanceof Server)) { throw new Exception("Container not Server"); } StandardEngine engine = new StandardEngine(); engine.setDomain(domain); engine.setName(domain); engine.setDefaultHost(defaultHost); engine.setBaseDir(baseDir); Service service = new StandardService(); service.setContainer(engine); service.setName(domain); ((Server) container).addService(service); return engine.getObjectName().toString(); }
/** * Create, configure, and return an Engine that will process all * HTTP requests received from one of the associated Connectors, * based on the specified properties. */ public Engine createEngine() { if( log.isDebugEnabled() ) log.debug("Creating engine"); StandardEngine engine = new StandardEngine(); // Default host will be set to the first host added engine.setRealm(realm); // Inherited by all children return (engine); }
/** * Create a new StandardEngine component with the default basic Valve. */ public StandardEngine() { super(); pipeline.setBasic(new StandardEngineValve()); /* Set the jmvRoute using the system property jvmRoute */ try { setJvmRoute(System.getProperty("jvmRoute")); } catch(Exception ex) { } // By default, the engine will hold the reloading thread backgroundProcessorDelay = 10; }
service.setName(serviceName); StandardEngine engine = new StandardEngine(); engine.setName(engineName); engine.setDefaultHost(defaultHost);
String hostName = name.substring(0,i); String path = name.substring(i); Container host = engine.findChild(hostName); String pathStr = getPathStr(path); Container context = host.findChild(pathStr); } else if (type.equals("Host")) { String hostName = pname.getKeyProperty("host"); Container host = engine.findChild(hostName); return host;
/** * Create, configure, and return an Engine that will process all * HTTP requests received from one of the associated Connectors, * based on the specified properties. */ public Engine createEngine() { if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Creating engine"); StandardEngine engine = new StandardEngine(); engine.setDebug(debug); // Default host will be set to the first host added engine.setLogger(logger); // Inherited by all children engine.setRealm(realm); // Inherited by all children return (engine); }
/** * Return a File object representing the base directory for the * entire servlet container (i.e. the Engine container if present). */ protected File engineBase() { String base=System.getProperty("catalina.base"); if( base == null ) { StandardEngine eng=(StandardEngine)this.getParent().getParent(); base=eng.getBaseDir(); } return (new File(base)); }
/** * 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; }
/** Provide a default in case no explicit configuration is set * * @return configured realm, or a JAAS realm by default */ public Realm getRealm() { Realm configured=super.getRealm(); // If no set realm has been called - default to JAAS // This can be overriden at engine, context and host level if( configured==null ) { configured=new JAASRealm(); this.setRealm( configured ); } return configured; }
public void install() { engine.addPropertyChangeListener(this); if (host != null) { host.addContainerListener(this); host.addLifecycleListener(this); } if (context != null) { context.addLifecycleListener(this); } }
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { super.preRegister(server,name); this.setName( name.getDomain()); return name; }
engine.setParentClassLoader(EmbeddedWebContainer.class.getClassLoader()); _embedded.addEngine(engine); ((StandardEngine) engine).setDomain(_serverContext.getDefaultDomainName()); engine.setName(_serverContext.getDefaultDomainName());
/** * Creates a new StandardService and StandardEngine. * * @param domain Domain name for the container instance * @param defaultHost Name of the default host to be used in the Engine * @param baseDir Base directory value for Engine * * @exception Exception if an MBean cannot be created or registered */ public String createStandardServiceEngine(String domain, String defaultHost, String baseDir) throws Exception{ if (!(container instanceof Server)) { throw new Exception("Container not Server"); } StandardEngine engine = new StandardEngine(); engine.setDomain(domain); engine.setName(domain); engine.setDefaultHost(defaultHost); engine.setBaseDir(baseDir); Service service = new StandardService(); service.setContainer(engine); service.setName(domain); ((Server) container).addService(service); return engine.getObjectName().toString(); }
/** * Create, configure, and return an Engine that will process all * HTTP requests received from one of the associated Connectors, * based on the specified properties. */ public Engine createEngine() { if( log.isDebugEnabled() ) log.debug("Creating engine"); StandardEngine engine = new StandardEngine(); // Default host will be set to the first host added engine.setRealm(realm); // Inherited by all children return (engine); }
/** * Create a new StandardEngine component with the default basic Valve. */ public StandardEngine() { super(); pipeline.setBasic(new StandardEngineValve()); /* Set the jmvRoute using the system property jvmRoute */ try { setJvmRoute(System.getProperty("jvmRoute")); } catch(Exception ex) { } // By default, the engine will hold the reloading thread backgroundProcessorDelay = 10; }
String hostName = name.substring(0,i); String path = name.substring(i); Host host = (Host) engine.findChild(hostName); String pathStr = getPathStr(path); StandardContext context = (StandardContext)host.findChild(pathStr); } else if (type.equals("Host")) { String hostName = pname.getKeyProperty("host"); StandardHost host = (StandardHost) engine.findChild(hostName); return host;
/** * Return a File object representing the base directory for the * entire servlet container (i.e. the Engine container if present). */ protected File engineBase() { String base=System.getProperty("catalina.base"); if( base == null ) { StandardEngine eng=(StandardEngine)this.getParent().getParent(); base=eng.getBaseDir(); } return (new File(base)); }