Java 类org.apache.catalina.Container 实例源码

项目:jerrydog    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this
 * <code>Valve</code> object.
 *
 * @param valve The Valve to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
public static void destroyMBean(Valve valve, Container container)
    throws Exception {

    ((Contained)valve).setContainer(container);
    String mname = createManagedName(valve);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, valve);
    try {
        ((Contained)valve).setContainer(null);
    } catch (Throwable t) {
    ;
    }
    mserver.unregisterMBean(oname);

}
项目:apache-tomcat-7.0.73-with-comment    文件:RealmBase.java   
/**
 * Return the Server object that is the ultimate parent for the container
 * with which this Realm is associated. If the server cannot be found (eg
 * because the container hierarchy is not complete), <code>null</code> is
 * returned.
 */
protected Server getServer() {
    Container c = container;
    if (c instanceof Context) {
        c = c.getParent();
    }
    if (c instanceof Host) {
        c = c.getParent();
    }
    if (c instanceof Engine) {
        Service s = ((Engine)c).getService();
        if (s != null) {
            return s.getServer();
        }
    }
    return null;
}
项目:tomcat7    文件:WebappLoader.java   
/**
 * Set the Container with which this Logger has been associated.
 *
 * @param container The associated Container
 */
@Override
public void setContainer(Container container) {

    // Deregister from the old Container (if any)
    if ((this.container != null) && (this.container instanceof Context))
        ((Context) this.container).removePropertyChangeListener(this);

    // Process this property change
    Container oldContainer = this.container;
    this.container = container;
    support.firePropertyChange("container", oldContainer, this.container);

    // Register with the new Container (if any)
    if ((this.container != null) && (this.container instanceof Context)) {
        setReloadable( ((Context) this.container).getReloadable() );
        ((Context) this.container).addPropertyChangeListener(this);
    }

}
项目:lazycat    文件:JDBCStore.java   
/**
 * @return the name for this instance (built from container name)
 */
public String getName() {
    if (name == null) {
        Container container = manager.getContainer();
        String contextName = container.getName();
        if (!contextName.startsWith("/")) {
            contextName = "/" + contextName;
        }
        String hostName = "";
        String engineName = "";

        if (container.getParent() != null) {
            Container host = container.getParent();
            hostName = host.getName();
            if (host.getParent() != null) {
                engineName = host.getParent().getName();
            }
        }
        name = "/" + engineName + "/" + hostName + contextName;
    }
    return name;
}
项目:jerrydog    文件:ServerLifecycleListener.java   
/**
 * Process the addition of a new Valve to a Container.
 *
 * @param container The affected Container
 * @param valve The new Valve
 */
protected void processContainerAddValve(Container container,
                                        Valve valve)
    throws Exception {

    if (debug >= 1) {
        log("Process addValve[container=" + container + ",valve=" +
            valve + "]");
    }

    if (debug >= 4) {
        log("Creating MBean for Valve " + valve);
    }
    MBeanUtils.createMBean(valve);

}
项目:tomcat7    文件:CopyParentClassLoaderRule.java   
/**
 * Handle the beginning of an XML element.
 *
 * @param attributes The attributes of this element
 *
 * @exception Exception if a processing error occurs
 */
@Override
public void begin(String namespace, String name, Attributes attributes)
    throws Exception {

    if (digester.getLogger().isDebugEnabled())
        digester.getLogger().debug("Copying parent class loader");
    Container child = (Container) digester.peek(0);
    Object parent = digester.peek(1);
    Method method =
        parent.getClass().getMethod("getParentClassLoader", new Class[0]);
    ClassLoader classLoader =
        (ClassLoader) method.invoke(parent, new Object[0]);
    child.setParentClassLoader(classLoader);

}
项目:jerrydog    文件:ServerLifecycleListener.java   
/**
 * Handle a <code>ContainerEvent</code> from one of the Containers we are
 * interested in.
 *
 * @param event The event that has occurred
 */
public void containerEvent(ContainerEvent event) {

    try {
        String type = event.getType();
        if (Container.ADD_CHILD_EVENT.equals(type)) {
            processContainerAddChild(event.getContainer(),
                                     (Container) event.getData());
        } else if (Container.ADD_VALVE_EVENT.equals(type)) {
            processContainerAddValve(event.getContainer(),
                                     (Valve) event.getData());
        } else if (Container.REMOVE_CHILD_EVENT.equals(type)) {
            processContainerRemoveChild(event.getContainer(),
                                        (Container) event.getData());
        } else if (Container.REMOVE_VALVE_EVENT.equals(type)) {
            processContainerRemoveValve(event.getContainer(),
                                        (Valve) event.getData());
        }
    } catch (Exception e) {
        log("Exception processing event " + event, e);
    }

}
项目:apache-tomcat-7.0.73-with-comment    文件:JDBCStore.java   
/**
 * @return the name for this instance (built from container name)
 */
public String getName() {
    if (name == null) {
        Container container = manager.getContainer();
        String contextName = container.getName();
        if (!contextName.startsWith("/")) {
            contextName = "/" + contextName;
        }
        String hostName = "";
        String engineName = "";

        if (container.getParent() != null) {
            Container host = container.getParent();
            hostName = host.getName();
            if (host.getParent() != null) {
                engineName = host.getParent().getName();
            }
        }
        name = "/" + engineName + "/" + hostName + contextName;
    }
    return name;
}
项目:apache-tomcat-7.0.73-with-comment    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this
 * <code>Valve</code> object.
 *
 * @param valve The Valve to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 * @deprecated  Unused. Will be removed in Tomcat 8.0.x
 */
@Deprecated
static void destroyMBean(Valve valve, Container container)
    throws Exception {

    ((Contained)valve).setContainer(container);
    String mname = createManagedName(valve);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, valve);
    try {
        ((Contained)valve).setContainer(null);
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
    }
    if( mserver.isRegistered(oname) ) {
        mserver.unregisterMBean(oname);
    }

}
项目:lazycat    文件:JAASRealm.java   
@Override
public void setContainer(Container container) {
    super.setContainer(container);

    if (appName == null) {
        String name = container.getName();
        if (!name.startsWith("/")) {
            name = "/" + name;
        }
        name = makeLegalForJAAS(name);

        appName = name;

        log.info("Set JAAS app name " + appName);
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:MBeanFactory.java   
/**
 * Create a new Valve and associate it with a {@link Container}.
 *
 * @param className The fully qualified class name of the {@link Valve} to
 *                  create
 * @param parent    The MBean name of the associated parent
 *                  {@link Container}.
 *
 * @return  The MBean name of the {@link Valve} that was created or
 *          <code>null</code> if the {@link Valve} does not implement
 *          {@link LifecycleMBeanBase}.
 */
public String createValve(String className, String parent)
        throws Exception {

    // Look for the parent
    ObjectName parentName = new ObjectName(parent);
    Container container = getParentContainerFromParent(parentName);

    if (container == null) {
        // TODO
        throw new IllegalArgumentException();
    }

    Valve valve = (Valve) Class.forName(className).newInstance();

    container.getPipeline().addValve(valve);

    if (valve instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) valve).getObjectName().toString();
    } else {
        return null;
    }
}
项目:tomcat7    文件:MapperListener.java   
@Override
public void startInternal() throws LifecycleException {

    setState(LifecycleState.STARTING);

    // Find any components that have already been initialized since the
    // MBean listener won't be notified as those components will have
    // already registered their MBeans
    findDefaultHost();

    Engine engine = (Engine) connector.getService().getContainer();
    addListeners(engine);

    Container[] conHosts = engine.findChildren();
    for (Container conHost : conHosts) {
        Host host = (Host) conHost;
        if (!LifecycleState.NEW.equals(host.getState())) {
            // Registering the host will register the context and wrappers
            registerHost(host);
        }
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:TestHostConfigAutomaticDeployment.java   
private static File getConfigBaseFile(Host host) {
    String path = null;
    if (host.getXmlBase() != null) {
        path = host.getXmlBase();
    } else {
        StringBuilder xmlDir = new StringBuilder("conf");
        Container parent = host.getParent();
        if (parent instanceof Engine) {
            xmlDir.append('/');
            xmlDir.append(parent.getName());
        }
        xmlDir.append('/');
        xmlDir.append(host.getName());
        path = xmlDir.toString();
    }

    return getCanonicalPath(path);
}
项目:tomcat7    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this
 * <code>Valve</code> object.
 *
 * @param valve The Valve to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 * @deprecated  Unused. Will be removed in Tomcat 8.0.x
 */
@Deprecated
static void destroyMBean(Valve valve, Container container)
    throws Exception {

    ((Contained)valve).setContainer(container);
    String mname = createManagedName(valve);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, valve);
    try {
        ((Contained)valve).setContainer(null);
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
    }
    if( mserver.isRegistered(oname) ) {
        mserver.unregisterMBean(oname);
    }

}
项目:tomcat7    文件:MBeanUtils.java   
/**
 * Determine the name of the domain to register MBeans for from a given
 * Service.
 * 
 * @param service 
 *
 * @deprecated  To be removed since to creates a circular dependency. Will
 *              be replaced in Tomcat 8 by a new method on {@link
 *              Service}.
 */
@Deprecated
public static String getDomain(Service service) {

    // Null service -> return null
    if (service == null) {
        return null;
    }

    String domain = null;

    Container engine = service.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 = service.getName();
    }

    // No service name, use null
    return domain;
}
项目:apache-tomcat-7.0.73-with-comment    文件:MapperListener.java   
/**
 * Register host.
 */
private void registerHost(Host host) {

    String[] aliases = host.findAliases();
    mapper.addHost(host.getName(), aliases, host);

    for (Container container : host.findChildren()) {
        if (container.getState().isAvailable()) {
            registerContext((Context) container);
        }
    }
    if(log.isDebugEnabled()) {
        log.debug(sm.getString("mapperListener.registerHost",
                host.getName(), domain, connector));
    }
}
项目:lazycat    文件:StandardContext.java   
/**
 * Get naming context full name.
 */
private String getNamingContextName() {
    if (namingContextName == null) {
        Container parent = getParent();
        if (parent == null) {
            namingContextName = getName();
        } else {
            Stack<String> stk = new Stack<String>();
            StringBuilder buff = new StringBuilder();
            while (parent != null) {
                stk.push(parent.getName());
                parent = parent.getParent();
            }
            while (!stk.empty()) {
                buff.append("/" + stk.pop());
            }
            buff.append(getName());
            namingContextName = buff.toString();
        }
    }
    return namingContextName;
}
项目:lams    文件:RewriteValve.java   
/**
 * Find the configuration path where the rewrite configuration file
 * will be stored.
 * 
 * @param resourceName
 * @return
 */
protected String getHostConfigPath(String resourceName) {
    StringBuffer result = new StringBuffer();
    Container container = getContainer();
    Container host = null;
    Container engine = null;
    while (container != null) {
        if (container instanceof Host)
            host = container;
        if (container instanceof Engine)
            engine = container;
        container = container.getParent();
    }
    if (engine != null) {
        result.append(engine.getName()).append('/');
    }
    if (host != null) {
        result.append(host.getName()).append('/');
    }
    result.append(resourceName);
    return result.toString();
}
项目:lazycat    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this <code>Valve</code> object.
 *
 * @param valve
 *            The Valve to be managed
 *
 * @exception Exception
 *                if an MBean cannot be deregistered
 * @deprecated Unused. Will be removed in Tomcat 8.0.x
 */
@Deprecated
static void destroyMBean(Valve valve, Container container) throws Exception {

    ((Contained) valve).setContainer(container);
    String mname = createManagedName(valve);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, valve);
    try {
        ((Contained) valve).setContainer(null);
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
    }
    if (mserver.isRegistered(oname)) {
        mserver.unregisterMBean(oname);
    }

}
项目:tomcat7    文件:ContainerBase.java   
protected void processChildren(Container container, ClassLoader cl) {
    try {
        if (container.getLoader() != null) {
            Thread.currentThread().setContextClassLoader
                (container.getLoader().getClassLoader());
        }
        container.backgroundProcess();
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log.error("Exception invoking periodic operation: ", t);
    } finally {
        Thread.currentThread().setContextClassLoader(cl);
    }
    Container[] children = container.findChildren();
    for (int i = 0; i < children.length; i++) {
        if (children[i].getBackgroundProcessorDelay() <= 0) {
            processChildren(children[i], cl);
        }
    }
}
项目:jerrydog    文件:FastEngineMapper.java   
/**
 * Prepare for active use of the public methods of this Component.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents it from being started
 */
public synchronized void start() throws LifecycleException {

    // Validate and update our current component state
    if (started)
        throw new LifecycleException
            (sm.getString("fastEngineMapper.alreadyStarted",
                          engine.getName()));
    started = true;

    // Configure based on our associated Engine properties
    engine.addContainerListener(this);
    engine.addPropertyChangeListener(this);
    setDefaultHost(engine.getDefaultHost());

    // Cache mappings for our child hosts
    Container children[] = engine.findChildren();
    for (int i = 0; i < children.length; i++) {
        addHost((Host) children[i]);
    }

    // Notify our interested LifecycleListeners
    lifecycle.fireLifecycleEvent(START_EVENT, null);

}
项目:apache-tomcat-7.0.73-with-comment    文件:JAASRealm.java   
@Override
public void setContainer(Container container) {
    super.setContainer(container);

    if( appName==null  ) {
        String name = container.getName();
        if (!name.startsWith("/")) {
            name = "/" + name;
        }
        name = makeLegalForJAAS(name);

        appName=name;

        log.info("Set JAAS app name " + appName);
    }
}
项目:tomcat7    文件:ThreadLocalLeakPreventionListener.java   
@Override
public void containerEvent(ContainerEvent event) {
    try {
        String type = event.getType();
        if (Container.ADD_CHILD_EVENT.equals(type)) {
            processContainerAddChild(event.getContainer(),
                (Container) event.getData());
        } else if (Container.REMOVE_CHILD_EVENT.equals(type)) {
            processContainerRemoveChild(event.getContainer(),
                (Container) event.getData());
        }
    } catch (Exception e) {
        String msg =
            sm.getString(
                "threadLocalLeakPreventionListener.containerEvent.error",
                event);
        log.error(msg, e);
    }

}
项目:lazycat    文件:ManagerServlet.java   
/**
 * Render a list of the currently active Contexts in our virtual host.
 *
 * @param writer
 *            Writer to render to
 */
protected void list(PrintWriter writer, StringManager smClient) {

    if (debug >= 1)
        log("list: Listing contexts for virtual host '" + host.getName() + "'");

    writer.println(smClient.getString("managerServlet.listed", host.getName()));
    Container[] contexts = host.findChildren();
    for (int i = 0; i < contexts.length; i++) {
        Context context = (Context) contexts[i];
        if (context != null) {
            String displayPath = context.getPath();
            if (displayPath.equals(""))
                displayPath = "/";
            if (context.getState().isAvailable()) {
                writer.println(smClient.getString("managerServlet.listitem", displayPath, "running",
                        "" + context.getManager().findSessions().length, context.getDocBase()));
            } else {
                writer.println(smClient.getString("managerServlet.listitem", displayPath, "stopped", "0",
                        context.getDocBase()));
            }
        }
    }
}
项目:jerrydog    文件:StandardContext.java   
/**
    * Get naming context full name.
    */
   private String getNamingContextName() {
if (namingContextName == null) {
    Container parent = getParent();
    if (parent == null) {
    namingContextName = getName();
    } else {
    Stack stk = new Stack();
    StringBuffer buff = new StringBuffer();
    while (parent != null) {
        stk.push(parent.getName());
        parent = parent.getParent();
    }
    while (!stk.empty()) {
        buff.append("/" + stk.pop());
    }
    buff.append(getName());
    namingContextName = buff.toString();
    }
}
return namingContextName;
   }
项目:jerrydog    文件:CopyParentClassLoaderRule.java   
/**
 * Handle the beginning of an XML element.
 *
 * @param attributes The attributes of this element
 *
 * @exception Exception if a processing error occurs
 */
public void begin(Attributes attributes) throws Exception {

    if (digester.getDebug() >= 1)
        digester.log("Copying parent class loader");
    Container child = (Container) digester.peek(0);
    Object parent = digester.peek(1);
    Method method =
        parent.getClass().getMethod("getParentClassLoader", new Class[0]);
    ClassLoader classLoader =
        (ClassLoader) method.invoke(parent, new Object[0]);
    child.setParentClassLoader(classLoader);

}
项目:tomcat7    文件:ClusterManagerBase.java   
public static ClassLoader[] getClassLoaders(Container container) {
    Loader loader = null;
    ClassLoader classLoader = null;
    if (container != null) loader = container.getLoader();
    if (loader != null) classLoader = loader.getClassLoader();
    else classLoader = Thread.currentThread().getContextClassLoader();
    if ( classLoader == Thread.currentThread().getContextClassLoader() ) {
        return new ClassLoader[] {classLoader};
    } else {
        return new ClassLoader[] {classLoader,Thread.currentThread().getContextClassLoader()};
    }
}
项目:tomcat7    文件:SimpleTcpCluster.java   
/**
 * @param name
 * @param manager
 * @return TODO
 */
@Override
public String getManagerName(String name, Manager manager) {
    String clusterName = name ;
    if (clusterName == null) clusterName = manager.getContainer().getName();
    if (getContainer() instanceof Engine) {
        Context context = (Context) manager.getContainer() ;
        Container host = context.getParent();
        if (host instanceof Host && clusterName != null && 
                !(clusterName.startsWith(host.getName() +"#"))) {
            clusterName = host.getName() +"#" + clusterName ;
        }
    }
    return clusterName;
}
项目:lams    文件:StandardHost.java   
public void destroy() throws Exception {
    // destroy our child containers, if any
    Container children[] = findChildren();
    super.destroy();
    for (int i = 0; i < children.length; i++) {
        if(children[i] instanceof StandardContext)
            ((StandardContext)children[i]).destroy();
    }

}
项目:apache-tomcat-7.0.73-with-comment    文件:SimpleTcpCluster.java   
@SuppressWarnings("deprecation")
private void registerMember(Member member) {
    // JMX registration
    StringBuilder name = new StringBuilder("type=Cluster");
    Container container = getContainer();
    if (container != null) {
        name.append(MBeanUtils.getContainerKeyProperties(container));
    }
    name.append(",component=Member,name=");
    name.append(ObjectName.quote(member.getName()));

    ObjectName oname = register(member, name.toString());
    memberOnameMap.put(member, oname);
}
项目:apache-tomcat-7.0.73-with-comment    文件:ManagerBase.java   
@Override
public void setContainer(Container container) {
    if (this.container == container) {
        // NO-OP
        return;
    }
    if (!getState().equals(LifecycleState.NEW)) {
        throw new IllegalStateException(sm.getString("managerBase.setContextNotNew"));
    }
    Container oldContainer = this.container;
    this.container = container;
    // TODO - delete the line below in Tomcat 9 onwards
    support.firePropertyChange("container", oldContainer, this.container);
}
项目:apache-tomcat-7.0.73-with-comment    文件:Embedded.java   
/**
 * Remove the specified Host, along with all of its related Contexts,
 * from the set of defined Hosts for its associated Engine.  If this is
 * the last Host for this Engine, the Engine will also be removed.
 *
 * @param host The Host to be removed
 */
public synchronized void removeHost(Host host) {

    if( log.isDebugEnabled() )
        log.debug("Removing host[" + host.getName() + "]");

    // Is this Host actually among those that are defined?
    boolean found = false;
    for (int i = 0; i < engines.length; i++) {
        Container hosts[] = engines[i].findChildren();
        for (int j = 0; j < hosts.length; j++) {
            if (host == (Host) hosts[j]) {
                found = true;
                break;

            }
        }
        if (found)
            break;
    }
    if (!found)
        return;

    // Remove this Host from the associated Engine
    if( log.isDebugEnabled() )
        log.debug(" Removing this Host");
    host.getParent().removeChild(host);

}
项目:lazycat    文件:ContainerBase.java   
/**
 * Return the child Container, associated with this Container, with the
 * specified name (if any); otherwise, return <code>null</code>
 *
 * @param name
 *            Name of the child Container to be retrieved
 */
@Override
public Container findChild(String name) {

    if (name == null)
        return (null);
    synchronized (children) {
        return children.get(name);
    }

}
项目:tomcat7    文件:Embedded.java   
/**
 * Remove the specified Host, along with all of its related Contexts,
 * from the set of defined Hosts for its associated Engine.  If this is
 * the last Host for this Engine, the Engine will also be removed.
 *
 * @param host The Host to be removed
 */
public synchronized void removeHost(Host host) {

    if( log.isDebugEnabled() )
        log.debug("Removing host[" + host.getName() + "]");

    // Is this Host actually among those that are defined?
    boolean found = false;
    for (int i = 0; i < engines.length; i++) {
        Container hosts[] = engines[i].findChildren();
        for (int j = 0; j < hosts.length; j++) {
            if (host == (Host) hosts[j]) {
                found = true;
                break;

            }
        }
        if (found)
            break;
    }
    if (!found)
        return;

    // Remove this Host from the associated Engine
    if( log.isDebugEnabled() )
        log.debug(" Removing this Host");
    host.getParent().removeChild(host);

}
项目:lams    文件:AuthenticatorBase.java   
/**
 * Set the Container to which this Valve is attached.
 *
 * @param container The container to which we are attached
 */
public void setContainer(Container container) {

    if (!(container instanceof Context))
        throw new IllegalArgumentException
            (sm.getString("authenticator.notContext"));

    super.setContainer(container);
    this.context = (Context) container;

}
项目:jerrydog    文件:NamingContextListener.java   
/**
 * Log the specified message to our current Logger (if any).
 *
 * @param message Message to be logged
 */
protected void log(String message) {

    if (!(container instanceof Container)) {
        System.out.println(logName() + ": " + message);
        return;
    }

    Logger logger = ((Container) container).getLogger();
    if (logger != null)
        logger.log(logName() + ": " + message);
    else
        System.out.println(logName() + ": " + message);

}
项目:lams    文件:Embedded.java   
/**
 * Remove the specified Context from the set of defined Contexts for its
 * associated Host.  If this is the last Context for this Host, the Host
 * will also be removed.
 *
 * @param context The Context to be removed
 */
public synchronized void removeContext(Context context) {

    if( log.isDebugEnabled() )
        log.debug("Removing context[" + context.getPath() + "]");

    // Is this Context actually among those that are defined?
    boolean found = false;
    for (int i = 0; i < engines.length; i++) {
        Container hosts[] = engines[i].findChildren();
        for (int j = 0; j < hosts.length; j++) {
            Container contexts[] = hosts[j].findChildren();
            for (int k = 0; k < contexts.length; k++) {
                if (context == (Context) contexts[k]) {
                    found = true;
                    break;
                }
            }
            if (found)
                break;
        }
        if (found)
            break;
    }
    if (!found)
        return;

    // Remove this Context from the associated Host
    if( log.isDebugEnabled() )
        log.debug(" Removing this Context");
    context.getParent().removeChild(context);

}
项目:tomcat7    文件:HostConfig.java   
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);
}
项目:tomcat7    文件:ContextConfig.java   
protected String getBaseDir() {
    Container engineC=context.getParent().getParent();
    if( engineC instanceof StandardEngine ) {
        return ((StandardEngine)engineC).getBaseDir();
    }
    return System.getProperty(Globals.CATALINA_BASE_PROP);
}
项目:apache-tomcat-7.0.73-with-comment    文件:StandardContext.java   
/**
 * Get app base.
 */
protected String getAppBase() {
    String appBase = null;
    Container container = this;
    while (container != null) {
        if (container instanceof Host)
            break;
        container = container.getParent();
    }
    if (container != null) {
        appBase = ((Host) container).getAppBase();
    }
    return appBase;
}