Java Code Examples for org.apache.catalina.Container#findChildren()

The following examples show how to use org.apache.catalina.Container#findChildren() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContainerBase.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
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);
        }
    }
}
 
Example 2
Source File: TomcatRsRegistry.java    From tomee with Apache License 2.0 6 votes vote down vote up
private static Context findContext(final Container host, final String webContext) {
    final Container[] children = host.findChildren();

    for (final Container child : children) {
        if (! Context.class.isInstance(child)) {
            continue;
        }

        final Context context = (Context) child;

        if (context.getPath().equals(webContext)) {
            return context;
        }
    }

    return null;
}
 
Example 3
Source File: MapperListener.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Add this mapper to the container and all child containers
 *
 * @param container
 */
private void addListeners(Container container) {
    container.addContainerListener(this);
    container.addLifecycleListener(this);
    for (Container child : container.findChildren()) {
        addListeners(child);
    }
}
 
Example 4
Source File: MapperListener.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Remove this mapper from the container and all child containers
 *
 * @param container
 */
private void removeListeners(Container container) {
    container.removeContainerListener(this);
    container.removeLifecycleListener(this);
    for (Container child : container.findChildren()) {
        removeListeners(child);
    }
}
 
Example 5
Source File: ContainerBase.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
protected void processChildren(Container container) {
    ClassLoader originalClassLoader = null;

    try {
        if (container instanceof Context) {
            Loader loader = ((Context) container).getLoader();
            // Loader will be null for FailedContext instances
            if (loader == null) {
                return;
            }

            // Ensure background processing for Contexts and Wrappers
            // is performed under the web app's class loader
            originalClassLoader = ((Context) container).bind(false, null);
        }
        container.backgroundProcess();
        Container[] children = container.findChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i].getBackgroundProcessorDelay() <= 0) {
                processChildren(children[i]);
            }
        }
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log.error("Exception invoking periodic operation: ", t);
    } finally {
        if (container instanceof Context) {
            ((Context) container).unbind(false, originalClassLoader);
       }
    }
}
 
Example 6
Source File: TestMapperListener.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private static void populateListenersInfo(List<ListenersInfo> list,
        Container container) {
    list.add(new ListenersInfo(container, container
            .findContainerListeners(), container.findLifecycleListeners()));
    for (Container child : container.findChildren()) {
        populateListenersInfo(list, child);
    }
}
 
Example 7
Source File: MapperListener.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Add this mapper to the container and all child containers
 *
 * @param container
 */
private void addListeners(Container container) {
    container.addContainerListener(this);
    container.addLifecycleListener(this);
    for (Container child : container.findChildren()) {
        addListeners(child);
    }
}
 
Example 8
Source File: MapperListener.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Remove this mapper from the container and all child containers
 *
 * @param container
 */
private void removeListeners(Container container) {
    container.removeContainerListener(this);
    container.removeLifecycleListener(this);
    for (Container child : container.findChildren()) {
        removeListeners(child);
    }
}
 
Example 9
Source File: TestMapperListener.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
private static void populateListenersInfo(List<ListenersInfo> list,
        Container container) {
    list.add(new ListenersInfo(container, container
            .findContainerListeners(), container.findLifecycleListeners()));
    for (Container child : container.findChildren()) {
        populateListenersInfo(list, child);
    }
}
 
Example 10
Source File: MapperListener.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Add this mapper to the container and all child containers
 *
 * @param container
 */
private void addListeners(Container container) {
    container.addContainerListener(this);
    container.addLifecycleListener(this);
    for (Container child : container.findChildren()) {
        addListeners(child);
    }
}
 
Example 11
Source File: MapperListener.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Remove this mapper from the container and all child containers
 *
 * @param container
 */
private void removeListeners(Container container) {
    container.removeContainerListener(this);
    container.removeLifecycleListener(this);
    for (Container child : container.findChildren()) {
        removeListeners(child);
    }
}
 
Example 12
Source File: TestMapperListener.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
private static void populateListenersInfo(List<ListenersInfo> list,
        Container container) {
    list.add(new ListenersInfo(container, container
            .findContainerListeners(), container.findLifecycleListeners()));
    for (Container child : container.findChildren()) {
        populateListenersInfo(list, child);
    }
}