org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet.getContextRoot()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(112)

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

Servlet.getContextRoot介绍

暂无

代码示例

代码示例来源:origin: arquillian/arquillian-core

private boolean allInSameContext(List<Servlet> servlets) {
  Set<String> context = new HashSet<String>();
  for (Servlet servlet : servlets) {
    context.add(servlet.getContextRoot());
  }
  return context.size() == 1;
}

代码示例来源:origin: arquillian/arquillian-extension-rest

protected boolean allInSameContext(List<Servlet> servlets) {
  Set<String> context = new HashSet<String>();
  for (Servlet servlet : servlets) {
    context.add(servlet.getContextRoot());
  }
  return context.size() == 1;
}

代码示例来源:origin: org.jboss.arquillian.container/arquillian-container-test-impl-base

private boolean allInSameContext(List<Servlet> servlets) {
  Set<String> context = new HashSet<String>();
  for (Servlet servlet : servlets) {
    context.add(servlet.getContextRoot());
  }
  return context.size() == 1;
}

代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

private URL locateCommandEventBusURI(HTTPContext context) {
    List<Servlet> contextServlets = context.getServlets();
    if (contextServlets == null) {
      throw new IllegalArgumentException("Could not determine URI for WarpFilter in context " + context
          + ". There are no Servlets in context.");
    }

    Set<String> contextRoots = new HashSet<String>();
    for (Servlet servlet : contextServlets) {
      contextRoots.add(servlet.getContextRoot());
    }

    if (contextRoots.size() == 1) {
      try {
        URI baseURI = context.getServlets().get(0).getBaseURI();
        return new URL("http", baseURI.getHost(), baseURI.getPort(), baseURI.getPath());
      } catch (MalformedURLException e) {
        throw new RuntimeException("Could not convert Servlet to URI, " + context.getServlets().get(0), e);
      }
    } else {
      try {
        return new URL("http", context.getHost(), context.getPort(), "/");
      } catch (MalformedURLException e) {
        throw new RuntimeException("Could not convert HTTPContext to URI, " + context, e);
      }
    }
  }
}

代码示例来源:origin: arquillian/arquillian-graphene

private URL locateCommandEventBusURI(HTTPContext context) {
    List<Servlet> contextServlets = context.getServlets();
    if (contextServlets == null) {
      throw new IllegalArgumentException("Could not determine URI for WarpFilter in context " + context
          + ". There are no Servlets in context.");
    }

    Set<String> contextRoots = new HashSet<String>();
    for (Servlet servlet : contextServlets) {
      contextRoots.add(servlet.getContextRoot());
    }

    if (contextRoots.size() == 1) {
      try {
        URI baseURI = context.getServlets().get(0).getBaseURI();
        return new URL("http", baseURI.getHost(), baseURI.getPort(), baseURI.getPath());
      } catch (MalformedURLException e) {
        throw new RuntimeException("Could not convert Servlet to URI, " + context.getServlets().get(0), e);
      }
    } else {
      try {
        return new URL("http", context.getHost(), context.getPort(), "/");
      } catch (MalformedURLException e) {
        throw new RuntimeException("Could not convert HTTPContext to URI, " + context, e);
      }
    }
  }
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-warp-impl

contextRoots.add(servlet.getContextRoot());

代码示例来源:origin: org.jboss.arquillian.protocol/arquillian-protocol-servlet

public static URI determineBaseURI(ServletProtocolConfiguration config, HTTPContext context, String servletName) {
  String scheme = config.getScheme();
  String host = config.getHost();
  Integer port = config.getPort();
  // TODO: can not set contextRoot in config, change to prefixContextRoot
  String contextRoot = null; //protocolConfiguration.getContextRoot();
  Servlet servlet = context.getServletByName(servletName);
  if (servlet != null) {
    // use the context where the Arquillian servlet is found
    if (scheme == null) {
      scheme = "http";
    }
    if (host == null) {
      host = context.getHost();
    }
    if (port == null) {
      port = context.getPort();
    }
    contextRoot = servlet.getContextRoot();
  } else {
    throw new IllegalArgumentException(
      servletName + " not found. " +
        "Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.");
  }
  return URI.create(scheme + "://" + host + ":" + port + contextRoot);
}

相关文章

微信公众号

最新文章

更多