本文整理了Java中org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet.getBaseURI()
方法的一些代码示例,展示了Servlet.getBaseURI()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Servlet.getBaseURI()
方法的具体详情如下:
包路径:org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet
类名称:Servlet
方法名:getBaseURI
[英]Get the URI to the Servlet's context.
[中]获取Servlet上下文的URI。
代码示例来源:origin: arquillian/arquillian-core
private URL toURL(Servlet servlet) {
try {
return servlet.getBaseURI().toURL();
} catch (Exception e) {
throw new RuntimeException("Could not convert Servlet to URL, " + servlet, e);
}
}
代码示例来源:origin: org.jboss.arquillian.container/arquillian-container-test-impl-base
private URL toURL(Servlet servlet) {
try {
return servlet.getBaseURI().toURL();
} catch (Exception e) {
throw new RuntimeException("Could not convert Servlet to URL, " + servlet, e);
}
}
代码示例来源: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
URI baseURI = context.getServlets().get(0).getBaseURI();
String path = baseURI.getPath();
if (path.endsWith("/")) {
代码示例来源:origin: arquillian/arquillian-extension-rest
protected URI getBaseURL() {
HTTPContext context = metaDataInst.get().getContext(HTTPContext.class);
if (allInSameContext(context.getServlets())) {
return context.getServlets().get(0).getBaseURI();
}
throw new IllegalStateException("No baseURL found in HTTPContext");
}
代码示例来源:origin: arquillian/continuous-enterprise-development
private URI locateAuthURI(ProtocolMetaData data) {
Collection<HTTPContext> contexts = data.getContexts(HTTPContext.class);
if(contexts == null || contexts.size() == 0 || contexts.size() > 1) {
throw new RuntimeException("Could not determine auth URL: " + contexts);
}
HTTPContext context = contexts.iterator().next();
return URI.create(context.getServlets().get(0).getBaseURI()+ "auth");
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
protected URI getBaseURI(Method method) throws Exception {
ProtocolDefinition definition = registry.get().getProtocol(ProtocolDescription.DEFAULT);
ModulesProtocolConfiguration configuration = (ModulesProtocolConfiguration) definition.createProtocolConfiguration();
HTTPContext context = ModulesApi.findHTTPContext(configuration, protocolMetaData, method);
return context.getServlets().get(0).getBaseURI();
}
代码示例来源:origin: org.jboss.arquillian.container/arquillian-container-spi
@Test
public void testGetBaseURIForTestContext() {
final String actualBaseUri = servletWithParent.getBaseURI().toString();
assertEquals(TEST_CONTEXT_ROOT_BASE_URI, actualBaseUri);
}
代码示例来源:origin: arquillian/arquillian-core
@Test
public void testGetBaseURIForTestContext() {
final String actualBaseUri = servletWithParent.getBaseURI().toString();
assertEquals(TEST_CONTEXT_ROOT_BASE_URI, actualBaseUri);
}
代码示例来源:origin: arquillian/arquillian-core
/**
* ARQ-554
*/
@Test
public void testGetBaseURIForRootContext() {
final String actualBaseUri = rootContextServletWithParent.getBaseURI().toString();
assertEquals(ROOT_CONTEXT_ROOT_BASE_URI, actualBaseUri);
}
代码示例来源:origin: org.jboss.arquillian.container/arquillian-container-spi
/**
* ARQ-554
*/
@Test
public void testGetBaseURIForRootContext() {
final String actualBaseUri = rootContextServletWithParent.getBaseURI().toString();
assertEquals(ROOT_CONTEXT_ROOT_BASE_URI, actualBaseUri);
}
内容来源于网络,如有侵权,请联系作者删除!