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


Java StandardServer.findServices方法代码示例

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


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

示例1: RealmAuthentication

import org.apache.catalina.core.StandardServer; //导入方法依赖的package包/类
public RealmAuthentication()
  {
  	// TODO: Fix this! 
  	// For now, log in to the Realm
realms = new HashMap<String, VistaAccessVerifyRealm>();
  	StandardServer server = (StandardServer)ServerFactory.getServer();
  	for (Service service : server.findServices())
  	{
  		addVistaRealmsToList(service);
  	}
  }
 
开发者ID:VHAINNOVATIONS,项目名称:Telepathology,代码行数:12,代码来源:RealmAuthentication.java

示例2: getRealms

import org.apache.catalina.core.StandardServer; //导入方法依赖的package包/类
private synchronized static List<Realm> getRealms()
{
	if(realms == null)
	{
		realms = new ArrayList<Realm>();
    	StandardServer server = (StandardServer)ServerFactory.getServer();
    	for (Service service : server.findServices())
    	{
    		addVistaRealmsToList(service);
    	}
	}
	return realms;
}
 
开发者ID:VHAINNOVATIONS,项目名称:Telepathology,代码行数:14,代码来源:SpecificRealmAuthentication.java

示例3: initializeRealms

import org.apache.catalina.core.StandardServer; //导入方法依赖的package包/类
/**
 * 
 * @return
 */
private SortedSet<Realm> initializeRealms()
{
	SortedSet<Realm> realms = new TreeSet<Realm>( new RealmHierarchyComparator() );
   	StandardServer server = (StandardServer)ServerFactory.getServer();
   	for (Service service : server.findServices())
   		recurseContainers(service.getContainer(), realms);
   	
   	return realms;
}
 
开发者ID:VHAINNOVATIONS,项目名称:Telepathology,代码行数:14,代码来源:TomcatRealmAuthentication.java

示例4: TomcatWsRegistry

import org.apache.catalina.core.StandardServer; //导入方法依赖的package包/类
public TomcatWsRegistry() {
    final StandardServer standardServer = TomcatHelper.getServer();
    for (final Service service : standardServer.findServices()) {
        if (service.getContainer() instanceof Engine) {
            connectors = Arrays.asList(service.findConnectors());
            engine = (Engine) service.getContainer();
            break;
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:11,代码来源:TomcatWsRegistry.java

示例5: processRunningApplications

import org.apache.catalina.core.StandardServer; //导入方法依赖的package包/类
/**
 * Process running web applications for ejb deployments.
 *
 * @param tomcatWebAppBuilder tomcat web app builder instance
 * @param standardServer      tomcat server instance
 */
private void processRunningApplications(final TomcatWebAppBuilder tomcatWebAppBuilder, final StandardServer standardServer) {
    for (final org.apache.catalina.Service service : standardServer.findServices()) {
        if (service.getContainer() instanceof Engine) {
            final Engine engine = (Engine) service.getContainer();
            for (final Container engineChild : engine.findChildren()) {
                if (engineChild instanceof Host) {
                    final Host host = (Host) engineChild;
                    for (final Container hostChild : host.findChildren()) {
                        if (hostChild instanceof StandardContext) {
                            final StandardContext standardContext = (StandardContext) hostChild;
                            final int state = TomcatHelper.getContextState(standardContext);
                            if (state == 0) {
                                // context only initialized
                                tomcatWebAppBuilder.init(standardContext);
                            } else if (state == 1) {
                                // context already started
                                standardContext.addParameter("openejb.start.late", "true");
                                final ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
                                Thread.currentThread().setContextClassLoader(standardContext.getLoader().getClassLoader());
                                try {
                                    tomcatWebAppBuilder.init(standardContext);
                                    tomcatWebAppBuilder.beforeStart(standardContext);
                                    tomcatWebAppBuilder.start(standardContext);
                                    tomcatWebAppBuilder.afterStart(standardContext);
                                } finally {
                                    Thread.currentThread().setContextClassLoader(oldCL);
                                }
                                standardContext.removeParameter("openejb.start.late");
                            }
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:43,代码来源:TomcatLoader.java

示例6: tryToFindAndExtractWar

import org.apache.catalina.core.StandardServer; //导入方法依赖的package包/类
private static File tryToFindAndExtractWar(final StandardServer source) {
    if (System.getProperties().containsKey("openejb.war")) {
        return new File(System.getProperty("openejb.war"));
    }

    for (final Service service : source.findServices()) {
        final Container container = service.getContainer();
        if (container instanceof StandardEngine) {
            final StandardEngine engine = (StandardEngine) container;
            for (final Container child : engine.findChildren()) {
                if (child instanceof StandardHost) {
                    final StandardHost host = (StandardHost) child;
                    final File base = hostDir(System.getProperty("catalina.base"), host.getAppBase());

                    final File[] files = base.listFiles();
                    if (files != null) {
                        for (final File file : files) {
                            if (isTomEEWar(file)) {
                                return file;
                            }
                        }
                    }
                }
            }
        }
    }

    return null;
}
 
开发者ID:apache,项目名称:tomee,代码行数:30,代码来源:OpenEJBListener.java

示例7: check

import org.apache.catalina.core.StandardServer; //导入方法依赖的package包/类
private void check() {
	final StandardServer server = TomcatHelper.getServer();
	for (final Service service : server.findServices()) {
		if (service.getContainer() instanceof Engine) {
			final Engine engine = (Engine) service.getContainer();
			for (final Container engineChild : engine.findChildren()) {
				if (engineChild instanceof StandardHost) {
					final StandardHost host = (StandardHost) engineChild;
					webappBuilder.checkHost(host);
				}
			}
           }
	}
}
 
开发者ID:apache,项目名称:tomee,代码行数:15,代码来源:WebappDeployer.java

示例8: TomcatHessianRegistry

import org.apache.catalina.core.StandardServer; //导入方法依赖的package包/类
public TomcatHessianRegistry() {
    final StandardServer standardServer = TomcatHelper.getServer();
    for (final Service service : standardServer.findServices()) {
        if (Engine.class.isInstance(service.getContainer())) {
            connectors = Arrays.asList(service.findConnectors());
            engine = Engine.class.cast(service.getContainer());
            break;
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:11,代码来源:TomcatHessianRegistry.java

示例9: checkConfiguration

import org.apache.catalina.core.StandardServer; //导入方法依赖的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

示例10: TomcatWebAppBuilder

import org.apache.catalina.core.StandardServer; //导入方法依赖的package包/类
/**
 * Creates a new web application builder
 * instance.
 */
public TomcatWebAppBuilder() {
    SystemInstance.get().setComponent(WebAppBuilder.class, this);
    SystemInstance.get().setComponent(TomcatWebAppBuilder.class, this);
    initJEEInfo = "true".equalsIgnoreCase(SystemInstance.get().getProperty(TOMEE_INIT_J2EE_INFO, "true"));

    // TODO: re-write this bit, so this becomes part of the listener, and we register this with the mbean server.

    final StandardServer standardServer = TomcatHelper.getServer();
    globalListenerSupport = new GlobalListenerSupport(standardServer, this);

    //Getting host config listeners
    hosts = new Hosts();
    SystemInstance.get().setComponent(Hosts.class, hosts);
    for (final Service service : standardServer.findServices()) {
        if (service.getContainer() instanceof Engine) {
            final Engine engine = service.getContainer();

            // add the global router if relevant
            final URL globalRouterConf = RouterValve.serverRouterConfigurationURL();
            if (globalRouterConf != null) {
                final RouterValve routerValve = new RouterValve();
                routerValve.setConfigurationPath(globalRouterConf);
                engine.getPipeline().addValve(routerValve);
            }

            parentClassLoader = engine.getParentClassLoader();

            manageCluster(engine.getCluster());
            hosts.setDefault(engine.getDefaultHost());
            addTomEERealm(engine);

            for (final Container engineChild : engine.findChildren()) {
                if (engineChild instanceof StandardHost) {
                    final StandardHost host = (StandardHost) engineChild;
                    manageCluster(host.getCluster());
                    addTomEERealm(host);
                    host.getPipeline().addValve(new OpenEJBSecurityListener.RequestCapturer());
                    hosts.add(host);
                    for (final LifecycleListener listener : host.findLifecycleListeners()) {
                        if (listener instanceof HostConfig) {
                            final HostConfig hostConfig = (HostConfig) listener;
                            deployers.put(host.getName(), hostConfig);
                        }
                    }
                }
            }
        }
    }

    SystemInstance.get().addObserver(new ClusterObserver(clusters));

    final OpenEjbConfigurationFactory component = SystemInstance.get().getComponent(OpenEjbConfigurationFactory.class);
    ConfigurationFactory configurationFactory = ConfigurationFactory.class.isInstance(component) ?
            ConfigurationFactory.class.cast(component) : SystemInstance.get().getComponent(ConfigurationFactory.class);
    if (configurationFactory == null) {
        configurationFactory = new ConfigurationFactory();
    }
    this.configurationFactory = configurationFactory;
    deploymentLoader = new DeploymentLoader();

    servletContextHandler = new ServletContextHandler();
    setComponentsUsedByCDI();

    try { // before tomcat was using ServiceLoader or manually instantiation, now it uses SL for itself so we can be in conflict
        WebSockets.setConfigurator();
    } catch (final Throwable th) {
        // no-op: can be another API impl, normally we are ok, this is really just a safe belt
    }

    noHostCheck = !Boolean.parseBoolean(SystemInstance.get().getProperty("tomee.host.check", "true"));
}
 
开发者ID:apache,项目名称:tomee,代码行数:76,代码来源:TomcatWebAppBuilder.java


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