org.wildfly.extension.undertow.Host.getDeployments()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(132)

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

Host.getDeployments介绍

暂无

代码示例

代码示例来源:origin: org.jboss.eap/wildfly-mod_cluster-undertow

@Override
public Iterable<Context> getContexts() {
  List<Context> contexts = new ArrayList<>();
  for (Deployment deployment : this.host.getDeployments()) {
    contexts.add(new UndertowContext(deployment, this));
  }
  for (String path : this.host.getLocations()) {
    contexts.add(new LocationContext(path, this));
  }
  return contexts;
}

代码示例来源:origin: org.jboss.eap/wildfly-mod_cluster-undertow

@Override
public Context findContext(String path) {
  String findPath = "".equals(path) ? "/" : path;
  for (Deployment deployment : this.host.getDeployments()) {
    if (deployment.getDeploymentInfo().getContextPath().equals(findPath)) {
      return new UndertowContext(deployment, this);
    }
  }
  return null;
}

代码示例来源:origin: org.jboss.eap/wildfly-clustering-web-undertow

@Override
public void start(StartContext context) {
  this.service.get().registerListener(this);
  for (Deployment deployment : this.host.get().getDeployments()) {
    this.addDeployment(deployment);
  }
  this.registry.accept(this);
}

代码示例来源:origin: org.jboss.eap/wildfly-clustering-web-undertow

@Override
public void stop(StopContext context) {
  for (Deployment deployment : this.host.get().getDeployments()) {
    this.removeDeployment(deployment);
  }
  this.service.get().unregisterListener(this);
}

代码示例来源:origin: wildfly-extras/wildfly-camel

private void validateEndpointContextPath(URI httpURI) {
  String undertowEndpointPath = getContextPath(httpURI);
  Set<Deployment> deployments = defaultHost.getDeployments();
  for (Deployment deployment : deployments) {
    DeploymentInfo depInfo = deployment.getDeploymentInfo();
    String contextPath = depInfo.getContextPath();
    if (contextPath.equals(undertowEndpointPath)) {
      final HttpHandler handler = deployment.getHandler();
      if (handler instanceof CamelEndpointDeployerHandler && ((CamelEndpointDeployerHandler)handler).getRoutingHandler() instanceof DelegatingRoutingHandler) {
        final ModuleClassLoader oldCl = ((DelegatingRoutingHandler)((CamelEndpointDeployerHandler)handler).getRoutingHandler()).classLoader;
        final ModuleClassLoader tccl = checkTccl();
        if (tccl != oldCl) {
          /* Avoid allowing handlers from distict apps to handle the same path */
          throw new IllegalStateException("Cannot add "+ HttpHandler.class.getName() +" for path " + contextPath + " defined in " + tccl.getName() + " because that path is already served by "+ oldCl.getName());
        }
      } else {
        /* Another application already serves this path */
        throw new IllegalStateException("Cannot overwrite context path " + contextPath + " owned by " + depInfo.getDeploymentName());
      }
    }
  }
}

代码示例来源:origin: wildfly-extras/wildfly-camel

/**
 * Exposes an HTTP endpoint that will be served by the given {@link HttpHandler} under the given {@link URI}'s path.
 *
 * @param uri determines the path and protocol under which the HTTP endpoint should be exposed
 * @param routingHandler an {@link HttpHandler} to use for handling HTTP requests sent to the given
 *        {@link URI}'s path
 */
public void deploy(URI uri, final HttpHandler routingHandler) {
  final Set<Deployment> availableDeployments = hostSupplier.getValue().getDeployments();
  if (!availableDeployments.stream().anyMatch(
          deployment -> deployment.getHandler() instanceof CamelEndpointDeployerHandler
        && ((CamelEndpointDeployerHandler) deployment.getHandler()).getRoutingHandler() == routingHandler)) {
    /* deploy only if the routing handler is not there already */
    doDeploy(
        uri,
        servletInstance -> servletInstance.setEndpointHttpHandler(new DelegatingEndpointHttpHandler(routingHandler)), // plug the endpointHttpHandler into the servlet
        deploymentInfo -> deploymentInfo.addInnerHandlerChainWrapper(exchangeStoringHandlerWrapper), // add the handler to the chain
        deployment -> { // wrap the initial handler with our custom class so that we can recognize it at other places
          final HttpHandler servletHandler = new CamelEndpointDeployerHandler(deployment.getHandler(), routingHandler);
          deployment.setInitialHandler(servletHandler);
        });
  }
}

代码示例来源:origin: org.wildfly.camel/wildfly-camel-subsystem-core

/**
 * Exposes an HTTP endpoint that will be served by the given {@link HttpHandler} under the given {@link URI}'s path.
 *
 * @param uri determines the path and protocol under which the HTTP endpoint should be exposed
 * @param routingHandler an {@link HttpHandler} to use for handling HTTP requests sent to the given
 *        {@link URI}'s path
 */
public void deploy(URI uri, final HttpHandler routingHandler) {
  final Set<Deployment> availableDeployments = hostSupplier.getValue().getDeployments();
  if (!availableDeployments.stream().anyMatch(
          deployment -> deployment.getHandler() instanceof CamelEndpointDeployerHandler
        && ((CamelEndpointDeployerHandler) deployment.getHandler()).getRoutingHandler() == routingHandler)) {
    /* deploy only if the routing handler is not there already */
    doDeploy(
        uri,
        servletInstance -> servletInstance.setEndpointHttpHandler(new DelegatingEndpointHttpHandler(routingHandler)), // plug the endpointHttpHandler into the servlet
        deploymentInfo -> deploymentInfo.addInnerHandlerChainWrapper(exchangeStoringHandlerWrapper), // add the handler to the chain
        deployment -> { // wrap the initial handler with our custom class so that we can recognize it at other places
          final HttpHandler servletHandler = new CamelEndpointDeployerHandler(deployment.getHandler(), routingHandler);
          deployment.setInitialHandler(servletHandler);
        });
  }
}

相关文章