org.apache.catalina.Container.addChild()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.apache.catalina.Container.addChild()方法的一些代码示例,展示了Container.addChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Container.addChild()方法的具体详情如下:
包路径:org.apache.catalina.Container
类名称:Container
方法名:addChild

Container.addChild介绍

[英]Add a new child Container to those associated with this Container, if supported. Prior to adding this Container to the set of children, the child's setParent() method must be called, with this Container as an argument. This method may thrown an IllegalArgumentException if this Container chooses not to be attached to the specified Container, in which case it is not added
[中]如果支持,将新的子容器添加到与此容器关联的子容器中。在将此容器添加到子容器集中之前,必须使用此容器作为参数调用子容器的setParent()方法。如果此容器选择不附加到指定的容器,则此方法可能会抛出IllegalArgumentException,在这种情况下,不会添加该容器

代码示例

代码示例来源:origin: org.springframework.osgi/spring-osgi-web

private void startCatalinaContext(Context context) {
  Thread currentThread = Thread.currentThread();
  ClassLoader old = currentThread.getContextClassLoader();
  try {
    // TODO: this seemed to be ignored and another TCCL used instead
    //			ClassLoader jasperTCCLLoader = createJasperClassLoader(context.getLoader().getClassLoader());
    currentThread.setContextClassLoader(null);
    getHost().addChild(context);
  }
  finally {
    currentThread.setContextClassLoader(old);
  }
}

代码示例来源:origin: org.springframework.osgi/org.springframework.osgi.web

private void startCatalinaContext(Context context) {
  Thread currentThread = Thread.currentThread();
  ClassLoader old = currentThread.getContextClassLoader();
  try {
    // TODO: this seemed to be ignored and another TCCL used instead
    //			ClassLoader jasperTCCLLoader = createJasperClassLoader(context.getLoader().getClassLoader());
    currentThread.setContextClassLoader(null);
    getHost().addChild(context);
  }
  finally {
    currentThread.setContextClassLoader(old);
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat

public void addWebService(String contextPath, String[] virtualHosts, WebServiceContainer webServiceContainer, String securityRealmName, String realmName, String transportGuarantee, String authMethod, ClassLoader classLoader) throws Exception {
  Context webServiceContext = embedded.createEJBWebServiceContext(contextPath, webServiceContainer, securityRealmName, realmName, transportGuarantee, authMethod, classLoader);
  String virtualServer;
  if (virtualHosts != null && virtualHosts.length > 0) {
    virtualServer = virtualHosts[0];
  } else {
    virtualServer = engine.getDefaultHost();
  }
  Container host = engine.findChild(virtualServer);
  if (host == null) {
    throw new IllegalArgumentException("Invalid virtual host '" + virtualServer + "'.  Do you have a matchiing Host entry in the plan?");
  }
  host.addChild(webServiceContext);
  webServices.put(contextPath, webServiceContext);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat6

public void addWebService(String contextPath, 
             String[] virtualHosts, 
             WebServiceContainer webServiceContainer,
             String policyContextId,
             ConfigurationFactory configurationFactory, 
             String realmName, 
             String authMethod,
             Properties properties,
             ClassLoader classLoader) throws Exception {
  if( log.isDebugEnabled() )
    log.debug("Creating EJBWebService context '" + contextPath + "'.");
  TomcatEJBWebServiceContext context = new TomcatEJBWebServiceContext(contextPath, webServiceContainer, classLoader);
  Subject defaultSubject = ContextManager.EMPTY;
  ContextConfig config = new EjbWsContextConfig(policyContextId,  configurationFactory, defaultSubject, authMethod, realmName);
  context.addLifecycleListener(config);
  Context webServiceContext = (context);
  String virtualServer;
  if (virtualHosts != null && virtualHosts.length > 0) {
    virtualServer = virtualHosts[0];
  } else {
    virtualServer = engine.getDefaultHost();
  }
  Container host = engine.findChild(virtualServer);
  if (host == null) {
    throw new IllegalArgumentException("Invalid virtual host '" + virtualServer + "'.  Do you have a matchiing Host entry in the plan?");
  }
  host.addChild(webServiceContext);
  webServices.put(contextPath, webServiceContext);
}

代码示例来源:origin: org.apache.openejb/tomee-webservices

host.addChild(context);
addServlet(host, context, "/*", httpListener, path, addresses);

代码示例来源:origin: com.tomitribe.tribestream/tribestream-container

private void deployWebApp(final Context app) {
  TomcatHelper.getServer().findServices()[0].getContainer().findChildren()[0].addChild(app);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat

hosts[i].addChild(defaultContext);

代码示例来源:origin: org.codehaus.fabric3.tomcat/fabric3-tomcat-extension

for (Container container : connector.getContainer().findChildren()) {
  if (container instanceof StandardHost) {
    container.addChild(context);

代码示例来源:origin: org.apache.openejb/openejb-tomcat-catalina

host.addChild(context);
webserviceContexts.put(path, context);

代码示例来源:origin: org.apache.tomee/livereload-tomee

host.addChild(liveReloadWebapp);

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat6

ctx.setServer(objName == null ? "geronimo" : objName.getKeyProperty(NameFactory.J2EE_SERVER));
host.addChild(defaultContext);

代码示例来源:origin: org.codehaus.fabric3.tomcat/fabric3-tomcat-extension

@Init
public void init() throws ServletHostException {
  connector = connectorService.getConnector();
  dispatchingServlet = new Fabric3DispatchingServlet();
  Fabric3ServletWrapper wrapper = new Fabric3ServletWrapper(dispatchingServlet);
  wrapper.setName("Fabric3Servlet");
  for (Container container : connector.getContainer().findChildren()) {
    if (container instanceof StandardHost) {
      Container child = container.findChild("");
      if (child != null) {
        container.removeChild(child);
      }
      StandardContext context = createContext("", ".");
      context.addChild(wrapper);
      context.addServletMapping("/*", "Fabric3Servlet");
      container.addChild(context);
      try {
        dispatchingServlet.init(wrapper);
      } catch (ServletException e) {
        throw new AssertionError(e);
      }
    }
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat6

host.addChild(context);
} catch (IllegalArgumentException ex) {
  log.error("Unable to add the child container: " + context.getName()

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat

host.addChild(anotherCtxObj);

相关文章

微信公众号

最新文章

更多