Search in sources :

Example 31 with Engine

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

the class ThreadLocalLeakPreventionListener method registerListenersForServer.

private void registerListenersForServer(Server server) {
    for (Service service : server.findServices()) {
        Engine engine = service.getContainer();
        engine.addContainerListener(this);
        registerListenersForEngine(engine);
    }
}
Also used : Service(org.apache.catalina.Service) Engine(org.apache.catalina.Engine)

Example 32 with Engine

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

the class ThreadLocalLeakPreventionListener method processContainerRemoveChild.

protected void processContainerRemoveChild(Container parent, Container child) {
    if (log.isDebugEnabled())
        log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]");
    if (child instanceof Context) {
        Context context = (Context) child;
        context.removeLifecycleListener(this);
    } else if (child instanceof Host || child instanceof Engine) {
        child.removeContainerListener(this);
    }
}
Also used : Context(org.apache.catalina.Context) Host(org.apache.catalina.Host) Engine(org.apache.catalina.Engine)

Example 33 with Engine

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

the class TesterDigestAuthenticatorPerformance method setUp.

@Before
public void setUp() throws Exception {
    ConcurrentMessageDigest.init("MD5");
    // Configure the Realm
    TesterMapRealm realm = new TesterMapRealm();
    realm.addUser(USER, PWD);
    realm.addUserRole(USER, ROLE);
    // Add the Realm to the Context
    Context context = new StandardContext();
    context.setName(CONTEXT_PATH);
    context.setRealm(realm);
    Host host = new StandardHost();
    context.setParent(host);
    Engine engine = new StandardEngine();
    host.setParent(engine);
    Service service = new StandardService();
    engine.setService(service);
    // Configure the Login config
    LoginConfig config = new LoginConfig();
    config.setRealmName(REALM);
    context.setLoginConfig(config);
    // Make the Context and Realm visible to the Authenticator
    authenticator.setContainer(context);
    authenticator.setNonceCountWindowSize(8 * 1024);
    authenticator.start();
}
Also used : Context(org.apache.catalina.Context) StandardContext(org.apache.catalina.core.StandardContext) TesterMapRealm(org.apache.catalina.startup.TesterMapRealm) StandardEngine(org.apache.catalina.core.StandardEngine) StandardHost(org.apache.catalina.core.StandardHost) StandardContext(org.apache.catalina.core.StandardContext) LoginConfig(org.apache.tomcat.util.descriptor.web.LoginConfig) StandardService(org.apache.catalina.core.StandardService) Service(org.apache.catalina.Service) StandardHost(org.apache.catalina.core.StandardHost) Host(org.apache.catalina.Host) StandardService(org.apache.catalina.core.StandardService) StandardEngine(org.apache.catalina.core.StandardEngine) Engine(org.apache.catalina.Engine) Before(org.junit.Before)

Example 34 with Engine

use of org.apache.catalina.Engine in project pinpoint by naver.

the class WebappLoaderStartInterceptor method extractContextKey.

private String extractContextKey(WebappLoader webappLoader) {
    final String defaultContextName = "";
    try {
        Container container = extractContext(webappLoader);
        // WebappLoader's associated Container should be a Context.
        if (container instanceof Context) {
            Context context = (Context) container;
            String contextName = context.getName();
            Host host = (Host) container.getParent();
            Engine engine = (Engine) host.getParent();
            StringBuilder sb = new StringBuilder();
            sb.append(engine.getName()).append("/").append(host.getName());
            if (!contextName.startsWith("/")) {
                sb.append('/');
            }
            sb.append(contextName);
            return sb.toString();
        }
    } catch (Exception e) {
        // Same action for any and all exceptions.
        logger.warn("Error extracting context name.", e);
    }
    return defaultContextName;
}
Also used : TraceContext(com.navercorp.pinpoint.bootstrap.context.TraceContext) Context(org.apache.catalina.Context) Container(org.apache.catalina.Container) Host(org.apache.catalina.Host) Engine(org.apache.catalina.Engine) URISyntaxException(java.net.URISyntaxException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 35 with Engine

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

the class TomcatWebServer method addInstanceIdToEngineName.

private void addInstanceIdToEngineName() {
    int instanceId = containerCounter.incrementAndGet();
    if (instanceId > 0) {
        Engine engine = this.tomcat.getEngine();
        engine.setName(engine.getName() + "-" + instanceId);
    }
}
Also used : Engine(org.apache.catalina.Engine)

Aggregations

Engine (org.apache.catalina.Engine)36 Container (org.apache.catalina.Container)18 Host (org.apache.catalina.Host)18 Service (org.apache.catalina.Service)12 Context (org.apache.catalina.Context)9 StandardEngine (org.apache.catalina.core.StandardEngine)8 StandardHost (org.apache.catalina.core.StandardHost)8 StandardService (org.apache.catalina.core.StandardService)7 ObjectName (javax.management.ObjectName)6 Connector (org.apache.catalina.connector.Connector)6 File (java.io.File)5 IOException (java.io.IOException)5 StandardContext (org.apache.catalina.core.StandardContext)4 ServletContext (javax.servlet.ServletContext)2 UnavailableException (javax.servlet.UnavailableException)2 LifecycleException (org.apache.catalina.LifecycleException)2 Server (org.apache.catalina.Server)2 Wrapper (org.apache.catalina.Wrapper)2 ContextName (org.apache.catalina.util.ContextName)2 TraceContext (com.navercorp.pinpoint.bootstrap.context.TraceContext)1