Search in sources :

Example 46 with Container

use of org.apache.catalina.Container in project tomcat by apache.

the class SimpleTcpCluster method setContainer.

/**
     * Set the Container associated with our Cluster
     *
     * @param container
     *            The Container to use
     */
@Override
public void setContainer(Container container) {
    Container oldContainer = this.container;
    this.container = container;
    support.firePropertyChange("container", oldContainer, this.container);
}
Also used : Container(org.apache.catalina.Container)

Example 47 with Container

use of org.apache.catalina.Container in project tomcat by apache.

the class ContextConfig method getServer.

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();
}
Also used : Container(org.apache.catalina.Container) ContextService(org.apache.tomcat.util.descriptor.web.ContextService) Service(org.apache.catalina.Service) Engine(org.apache.catalina.Engine)

Example 48 with Container

use of org.apache.catalina.Container in project tomcat by apache.

the class HostConfig method undeploy.

private void undeploy(DeployedApplication app) {
    if (log.isInfoEnabled())
        log.info(sm.getString("hostConfig.undeploy", app.name));
    Container context = host.findChild(app.name);
    try {
        host.removeChild(context);
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log.warn(sm.getString("hostConfig.context.remove", app.name), t);
    }
    deployed.remove(app.name);
}
Also used : Container(org.apache.catalina.Container)

Example 49 with Container

use of org.apache.catalina.Container in project tomcat by apache.

the class ValveBase method getObjectNameKeyProperties.

// -------------------- JMX and Registration  --------------------
@Override
public String getObjectNameKeyProperties() {
    StringBuilder name = new StringBuilder("type=Valve");
    Container container = getContainer();
    name.append(container.getMBeanKeyProperties());
    int seq = 0;
    // Pipeline may not be present in unit testing
    Pipeline p = container.getPipeline();
    if (p != null) {
        for (Valve valve : p.getValves()) {
            // Skip null valves
            if (valve == null) {
                continue;
            }
            // Only compare valves in pipeline until we find this valve
            if (valve == this) {
                break;
            }
            if (valve.getClass() == this.getClass()) {
                // Duplicate valve earlier in pipeline
                // increment sequence number
                seq++;
            }
        }
    }
    if (seq > 0) {
        name.append(",seq=");
        name.append(seq);
    }
    String className = this.getClass().getName();
    int period = className.lastIndexOf('.');
    if (period >= 0) {
        className = className.substring(period + 1);
    }
    name.append(",name=");
    name.append(className);
    return name.toString();
}
Also used : Container(org.apache.catalina.Container) Valve(org.apache.catalina.Valve) Pipeline(org.apache.catalina.Pipeline)

Example 50 with Container

use of org.apache.catalina.Container in project spring-boot by spring-projects.

the class LocalDevToolsAutoConfigurationTests method devToolsSwitchesJspServletToDevelopmentMode.

@Test
public void devToolsSwitchesJspServletToDevelopmentMode() {
    this.context = initializeAndRun(Config.class);
    TomcatWebServer tomcatContainer = (TomcatWebServer) ((ServletWebServerApplicationContext) this.context).getWebServer();
    Container context = tomcatContainer.getTomcat().getHost().findChildren()[0];
    StandardWrapper jspServletWrapper = (StandardWrapper) context.findChild("jsp");
    EmbeddedServletOptions options = (EmbeddedServletOptions) ReflectionTestUtils.getField(jspServletWrapper.getServlet(), "options");
    assertThat(options.getDevelopment()).isEqualTo(true);
}
Also used : Container(org.apache.catalina.Container) TomcatWebServer(org.springframework.boot.web.embedded.tomcat.TomcatWebServer) EmbeddedServletOptions(org.apache.jasper.EmbeddedServletOptions) StandardWrapper(org.apache.catalina.core.StandardWrapper) Test(org.junit.Test)

Aggregations

Container (org.apache.catalina.Container)163 Context (org.apache.catalina.Context)28 IOException (java.io.IOException)24 Host (org.apache.catalina.Host)22 StandardContext (org.apache.catalina.core.StandardContext)21 Engine (org.apache.catalina.Engine)18 LifecycleException (org.apache.catalina.LifecycleException)17 File (java.io.File)15 ObjectName (javax.management.ObjectName)15 Wrapper (org.apache.catalina.Wrapper)13 StandardHost (org.apache.catalina.core.StandardHost)13 ArrayList (java.util.ArrayList)12 ServletException (javax.servlet.ServletException)11 MalformedURLException (java.net.MalformedURLException)10 Valve (org.apache.catalina.Valve)10 StandardWrapper (org.apache.catalina.core.StandardWrapper)10 SecurityConstraint (org.apache.tomcat.util.descriptor.web.SecurityConstraint)10 NamingException (javax.naming.NamingException)9 Lifecycle (org.apache.catalina.Lifecycle)9 Realm (org.apache.catalina.Realm)9