@Test public void verifySingleConnector() { // Relevant to Tomcat 9.0 assertThat(applicationContext).isInstanceOf(WebServerApplicationContext.class); WebServer webServer = ((WebServerApplicationContext) applicationContext).getWebServer(); assertThat(webServer).isInstanceOf(TomcatWebServer.class); assertThat(((TomcatWebServer) webServer).getTomcat() .getEngine() .getService() .findConnectors()).hasSize(1); }
@Override public void setWrapper(Wrapper wrapper) { Valve valve = createValve(); if (wrapper != null) { host = (Host) wrapper.getParent().getParent(); Engine engine = (Engine) host.getParent(); Service service = engine.getService(); connectors = service.findConnectors(); try { deployerOName = new ObjectName(host.getParent().getName() + ":type=Deployer,host=" + host.getName()); } catch (MalformedObjectNameException e) { logger.trace("", e); } host.getPipeline().addValve(valve); mbeanServer = ManagementFactory.getPlatformMBeanServer(); } else if (host != null) { host.getPipeline().removeValve(valve); } }
/** * Return the Service to which this container belongs. * @param container The container to start from * @return the Service, or null if not found */ public static Service getService(Container container) { while (container != null && !(container instanceof Engine)) { container = container.getParent(); } if (container == null) { return null; } return ((Engine) container).getService(); }
private Connector[] getConnectors() { Engine e = (Engine) host.getParent(); Service s = e.getService(); return s.findConnectors(); } }
/** * Constructs a new CatalinaEngine that wraps the specified catalina engine * @param engine a catalina engine */ public CatalinaEngine(org.apache.catalina.Engine engine, MBeanServer mbeanServer) { this(engine, new CatalinaServer(engine.getService().getServer(), mbeanServer)); }
private Connector[] getConnectors() { Engine e = (Engine) host.getParent(); Service s = e.getService(); return s.findConnectors(); } }
private Server getServer() { Container c = context; while (c != null && !(c instanceof Engine)) { c = c.getParent(); } if (c == null) { return null; } Service s = ((Engine)c).getService(); if (s == null) { return null; } return s.getServer(); }
private Server getServer() { if (container instanceof Server) { return (Server) container; } if (container instanceof Context) { // Could do this in one go. Lots of casts so split out for clarity Engine engine = (Engine) ((Context) container).getParent().getParent(); return engine.getService().getServer(); } return null; }
private Server getServer() { if (container instanceof Server) { return (Server) container; } if (container instanceof Context) { // Could do this in one go. Lots of casts so split out for clarity Engine engine = (Engine) ((Context) container).getParent().getParent(); return engine.getService().getServer(); } return null; }
private Server getServer() { if (container instanceof Server) { return (Server) container; } if (container instanceof Context) { // Could do this in one go. Lots of casts so split out for clarity Engine engine = (Engine) ((Context) container).getParent().getParent(); return engine.getService().getServer(); } return null; }
private Server getServer() { if (container instanceof Server) { return (Server) container; } if (container instanceof Context) { // Could do this in one go. Lots of casts so split out for clarity Engine engine = (Engine) ((Context) container).getParent().getParent(); return engine.getService().getServer(); } return null; }
private Server getServer() { if (container instanceof Server) { return (Server) container; } if (container instanceof Context) { // Could do this in one go. Lots of casts so split out for clarity Engine engine = (Engine) ((Context) container).getParent().getParent(); return engine.getService().getServer(); } return null; }
private Server getServer() { if (container instanceof Server) { return (Server) container; } if (container instanceof Context) { // Could do this in one go. Lots of casts so split out for clarity Engine engine = (Engine) ((Context) container).getParent().getParent(); return engine.getService().getServer(); } return null; }
private Server getServer() { if (container instanceof Server) { return (Server) container; } if (container instanceof Context) { // Could do this in one go. Lots of casts so split out for clarity Engine engine = (Engine) ((Context) container).getParent().getParent(); return engine.getService().getServer(); } return null; }
private Server getServer() { if (container instanceof Server) { return (Server) container; } if (container instanceof Context) { // Could do this in one go. Lots of casts so split out for clarity Engine engine = (Engine) ((Context) container).getParent().getParent(); return engine.getService().getServer(); } return null; }
@Override public Engine createEngine(org.apache.catalina.Engine engine) { return this.engineFactory.createEngine(this, engine, this.createServer(engine.getService().getServer())); }
private javax.naming.Context getGlobalNamingContext() { if (container instanceof Context) { Engine e = (Engine) ((Context) container).getParent().getParent(); return e.getService().getServer().getGlobalNamingContext(); } return null; }
private javax.naming.Context getGlobalNamingContext() { if (container instanceof Context) { Engine e = (Engine) ((Context) container).getParent().getParent(); return e.getService().getServer().getGlobalNamingContext(); } return null; }
/** * Construct a new instance of this class, associated with the specified * Context instance. * * @param context The associated Context instance */ public ApplicationContext(StandardContext context) { super(); this.context = context; this.service = ((Engine) context.getParent().getParent()).getService(); this.sessionCookieConfig = new ApplicationSessionCookieConfig(context); // Populate session tracking modes populateSessionTrackingModes(); }
/** * Construct a new instance of this class, associated with the specified * Context instance. * * @param context The associated Context instance */ public ApplicationContext(StandardContext context) { super(); this.context = context; this.service = ((Engine) context.getParent().getParent()).getService(); this.sessionCookieConfig = new ApplicationSessionCookieConfig(context); // Populate session tracking modes populateSessionTrackingModes(); }