Search in sources :

Example 6 with Container

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

the class StandardContext method getMaxTime.

/**
     * Gets the maximum processing time of all servlets in this
     * StandardContext.
     *
     * @return Maximum processing time of all servlets in this
     * StandardContext
     */
public long getMaxTime() {
    long result = 0;
    long time;
    Container[] children = findChildren();
    if (children != null) {
        for (int i = 0; i < children.length; i++) {
            time = ((StandardWrapper) children[i]).getMaxTime();
            if (time > result)
                result = time;
        }
    }
    return result;
}
Also used : Container(org.apache.catalina.Container) SecurityConstraint(org.apache.tomcat.util.descriptor.web.SecurityConstraint)

Example 7 with Container

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

the class StandardContext method getRequestCount.

/**
     * Gets the cumulative request count of all servlets in this
     * StandardContext.
     *
     * @return Cumulative request count of all servlets in this
     * StandardContext
     */
public int getRequestCount() {
    int result = 0;
    Container[] children = findChildren();
    if (children != null) {
        for (int i = 0; i < children.length; i++) {
            result += ((StandardWrapper) children[i]).getRequestCount();
        }
    }
    return result;
}
Also used : Container(org.apache.catalina.Container) SecurityConstraint(org.apache.tomcat.util.descriptor.web.SecurityConstraint)

Example 8 with Container

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

the class StandardService method getDomainInternal.

@Override
protected String getDomainInternal() {
    String domain = null;
    Container engine = getContainer();
    // Use the engine name first
    if (engine != null) {
        domain = engine.getName();
    }
    // No engine or no engine name, use the service name
    if (domain == null) {
        domain = getName();
    }
    // default
    return domain;
}
Also used : Container(org.apache.catalina.Container)

Example 9 with Container

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

the class FarmWarDeployer method start.

/*--Logic---------------------------------------------------*/
@Override
public void start() throws Exception {
    if (started)
        return;
    Container hcontainer = getCluster().getContainer();
    if (!(hcontainer instanceof Host)) {
        log.error(sm.getString("farmWarDeployer.hostOnly"));
        return;
    }
    host = (Host) hcontainer;
    // Check to correct engine and host setup
    Container econtainer = host.getParent();
    if (!(econtainer instanceof Engine)) {
        log.error(sm.getString("farmWarDeployer.hostParentEngine", host.getName()));
        return;
    }
    Engine engine = (Engine) econtainer;
    String hostname = null;
    hostname = host.getName();
    try {
        oname = new ObjectName(engine.getName() + ":type=Deployer,host=" + hostname);
    } catch (Exception e) {
        log.error(sm.getString("farmWarDeployer.mbeanNameFail", engine.getName(), hostname), e);
        return;
    }
    if (watchEnabled) {
        watcher = new WarWatcher(this, getWatchDirFile());
        if (log.isInfoEnabled()) {
            log.info(sm.getString("farmWarDeployer.watchDir", getWatchDir()));
        }
    }
    configBase = host.getConfigBaseFile();
    // Retrieve the MBean server
    mBeanServer = Registry.getRegistry(null, null).getMBeanServer();
    started = true;
    count = 0;
    getCluster().addClusterListener(this);
    if (log.isInfoEnabled())
        log.info(sm.getString("farmWarDeployer.started"));
}
Also used : Container(org.apache.catalina.Container) Host(org.apache.catalina.Host) Engine(org.apache.catalina.Engine) LifecycleException(org.apache.catalina.LifecycleException) IOException(java.io.IOException) ObjectName(javax.management.ObjectName)

Example 10 with Container

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

the class RealmBase method setContainer.

/**
     * Set the Container with which this Realm has been associated.
     *
     * @param container The associated Container
     */
@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)

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