当前位置: 首页>>代码示例>>Java>>正文


Java StandardHost.findChildren方法代码示例

本文整理汇总了Java中org.apache.catalina.core.StandardHost.findChildren方法的典型用法代码示例。如果您正苦于以下问题:Java StandardHost.findChildren方法的具体用法?Java StandardHost.findChildren怎么用?Java StandardHost.findChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.core.StandardHost的用法示例。


在下文中一共展示了StandardHost.findChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findOpenEjbWar

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
private static File findOpenEjbWar(final StandardHost standardHost) {
    //look for openejb war in a Tomcat context
    for (final Container container : standardHost.findChildren()) {
        if (container instanceof StandardContext) {
            final StandardContext standardContext = (StandardContext) container;
            File contextDocBase = new File(standardContext.getDocBase());
            if (!contextDocBase.isDirectory() && standardContext.getOriginalDocBase() != null) {
                contextDocBase = new File(standardContext.getOriginalDocBase());
            }
            if (contextDocBase.isDirectory()) {
                final File openEjbWar = findOpenEjbWarInContext(contextDocBase);
                if (openEjbWar != null) {
                    return openEjbWar;
                }
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:tomee,代码行数:20,代码来源:OpenEJBListener.java

示例2: hasChild

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
private static boolean hasChild(final StandardHost host, final String name) {
    for (final Container child : host.findChildren()) {
        // the TomEERemoteWebapp path = "/" + name
        if (name.equals(child.getName())
            || (StandardContext.class.isInstance(child) && ("/" + name).equals(StandardContext.class.cast(child).getPath()))) {
            return true;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:tomee,代码行数:11,代码来源:GlobalListenerSupport.java

示例3: hostAdded

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
/**
 * Host is added.
 *
 * @param host tomcat host.
 */
private void hostAdded(final StandardHost host) {
    addContextListener(host);
    host.addLifecycleListener(this);
    for (final Container child : host.findChildren()) {
        if (child instanceof StandardContext) {
            final StandardContext context = (StandardContext) child;
            contextAdded(context);
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:16,代码来源:GlobalListenerSupport.java

示例4: hostRemoved

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
/**
 * Host is removed.
 *
 * @param host tomcat host
 */
private void hostRemoved(final StandardHost host) {
    for (final Container child : host.findChildren()) {
        if (child instanceof StandardContext) {
            final StandardContext context = (StandardContext) child;
            contextRemoved(context);
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:14,代码来源:GlobalListenerSupport.java

示例5: getContexts

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
/**
 * Gets the list of contexts.
 *
 * @param host the host name.
 * @return the list of context corresponding to the host name.
 */
private static Container[] getContexts(Service service, String host) {
    Container[] result = null;
    StandardHost hostContainer = getHost(service, host);
    if (hostContainer != null) {
        result = hostContainer.findChildren();
    } else {
        LOGGER.log(Level.SEVERE, "No host {0} found", new Object[]{host});
    }
    return result;
}
 
开发者ID:lorislab,项目名称:smonitor,代码行数:17,代码来源:TomcatUtil.java

示例6: checkConfiguration

import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
private void checkConfiguration(StandardServer server,
                                Service expectedService, Connector expectedConnector,
                                Engine expectedEngine, StandardHost expectedHost, Context expectedContext) {

    // Check if Catalina base and home directories have not been changed.
    final File expectedBaseDir = config.baseDir().toFile();
    if (!Objects.equals(server.getCatalinaBase(), expectedBaseDir) ||
        !Objects.equals(server.getCatalinaHome(), expectedBaseDir)) {
        throw new TomcatServiceException("A configurator should never change the Catalina base and home.");
    }

    // Check if the server's port has not been changed.
    if (server.getPort() != EMBEDDED_TOMCAT_PORT) {
        throw new TomcatServiceException("A configurator should never change the port of the server.");
    }

    // Check if the default service has not been removed and a new service has not been added.
    final Service[] services = server.findServices();
    if (services == null || services.length != 1 || services[0] != expectedService) {
        throw new TomcatServiceException(
                "A configurator should never remove the default service or add a new service.");
    }

    // Check if the name of the default service has not been changed.
    if (!config.serviceName().equals(expectedService.getName())) {
        throw new TomcatServiceException(
                "A configurator should never change the name of the default service.");
    }

    // Check if the default connector has not been removed
    final Connector[] connectors = expectedService.findConnectors();
    if (connectors == null || Arrays.stream(connectors).noneMatch(c -> c == expectedConnector)) {
        throw new TomcatServiceException("A configurator should never remove the default connector.");
    }

    // Check if the engine has not been changed.
    final Container actualEngine = TomcatUtil.engine(expectedService);
    if (actualEngine != expectedEngine) {
        throw new TomcatServiceException(
                "A configurator should never change the engine of the default service.");
    }

    // Check if the engine's name has not been changed.
    if (!config.engineName().equals(expectedEngine.getName())) {
        throw new TomcatServiceException(
                "A configurator should never change the name of the default engine.");
    }

    // Check if the default realm has not been changed.
    if (expectedEngine.getRealm() != config.realm()) {
        throw new TomcatServiceException("A configurator should never change the default realm.");
    }

    // Check if the default host has not been removed.
    final Container[] engineChildren = expectedEngine.findChildren();
    if (engineChildren == null || Arrays.stream(engineChildren).noneMatch(c -> c == expectedHost)) {
        throw new TomcatServiceException("A configurator should never remove the default host.");
    }

    // Check if the default context has not been removed.
    final Container[] contextChildren = expectedHost.findChildren();
    if (contextChildren == null || Arrays.stream(contextChildren).noneMatch(c -> c == expectedContext)) {
        throw new TomcatServiceException("A configurator should never remove the default context.");
    }

    // Check if the docBase of the default context has not been changed.
    if (!config.docBase().toString().equals(expectedContext.getDocBase())) {
        throw new TomcatServiceException(
                "A configurator should never change the docBase of the default context.");
    }
}
 
开发者ID:line,项目名称:armeria,代码行数:72,代码来源:ManagedConnectorFactory.java


注:本文中的org.apache.catalina.core.StandardHost.findChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。