本文整理汇总了Java中org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext类的典型用法代码示例。如果您正苦于以下问题:Java HTTPContext类的具体用法?Java HTTPContext怎么用?Java HTTPContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTTPContext类属于org.jboss.arquillian.container.spi.client.protocol.metadata包,在下文中一共展示了HTTPContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: resolve
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
private URL resolve(String portletId) {
ProtocolMetaData metaData = protocolMetadata.get();
if (metaData == null) {
return null;
}
if (metaData.hasContext(HTTPContext.class)) {
HTTPContext context = metaData.getContexts(
HTTPContext.class).iterator().next();
try {
URL url = new URI(
"http", null, context.getHost(), context.getPort(), null,
null, null).toURL();
return new URL(
url, "/o/install-portlet-servlet?portlet-id="+portletId);
}
catch (Exception e) {
throw new RuntimeException("Can't obtain URL, " + context, e);
}
}
return null;
}
开发者ID:liferay-labs,项目名称:arquillian-liferay,代码行数:27,代码来源:PortalURLTestEnricher.java
示例2: shouldUpdateWithPortFromDocker
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
@Test // equal ip, different ports
public void shouldUpdateWithPortFromDocker() throws Exception {
Binding binding = new Binding(LOCALHOST);
binding.addPortBinding(EXPOSED_PORT, BOUND_PORT);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(new TestPortBindings(binding));
bind(ContainerScoped.class,
Container.class,
new ContainerImpl(CUBE_CONTAINER_NAME, deployableContainer, new ContainerDefImpl("arquillian.xml")));
ProtocolMetaData metadata = new ProtocolMetaData();
metadata.addContext(new HTTPContext(LOCALHOST, EXPOSED_PORT).add(new Servlet("A", "B")));
bind(DeploymentScoped.class, ProtocolMetaData.class, metadata);
fire(metadata);
ProtocolMetaData updated = getManager().getContext(DeploymentContext.class)
.getObjectStore().get(ProtocolMetaData.class);
Assert.assertEquals(BOUND_PORT.intValue(), updated.getContexts(HTTPContext.class).iterator().next().getPort());
Assert.assertEquals(LOCALHOST, updated.getContexts(HTTPContext.class).iterator().next().getHost());
assertEventFired(ProtocolMetaData.class, 1); // twice, but original fire is intercepted and never hit the Counter
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:25,代码来源:ProtocolMetaDataUpdaterTestCase.java
示例3: shouldUpdateWithIPFromDocker
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
@Test // equal ports, different ip
public void shouldUpdateWithIPFromDocker() throws Exception {
Binding binding = new Binding(GATEWAY_IP);
binding.addPortBinding(EXPOSED_PORT, EXPOSED_PORT);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(new TestPortBindings(binding));
bind(ContainerScoped.class,
Container.class,
new ContainerImpl(CUBE_CONTAINER_NAME, deployableContainer, new ContainerDefImpl("arquillian.xml")));
ProtocolMetaData metadata = new ProtocolMetaData();
metadata.addContext(new HTTPContext(LOCALHOST, EXPOSED_PORT).add(new Servlet("A", "B")));
bind(DeploymentScoped.class, ProtocolMetaData.class, metadata);
fire(metadata);
ProtocolMetaData updated = getManager().getContext(DeploymentContext.class)
.getObjectStore().get(ProtocolMetaData.class);
Assert.assertEquals(EXPOSED_PORT.intValue(), updated.getContexts(HTTPContext.class).iterator().next().getPort());
Assert.assertEquals(GATEWAY_IP, updated.getContexts(HTTPContext.class).iterator().next().getHost());
assertEventFired(ProtocolMetaData.class, 1); // twice, but original fire is intercepted and never hit the Counter
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:25,代码来源:ProtocolMetaDataUpdaterTestCase.java
示例4: shouldNotUpdateIfContainerNotMapped
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
@Test
public void shouldNotUpdateIfContainerNotMapped() throws Exception {
Binding binding = new Binding(GATEWAY_IP);
binding.addPortBinding(EXPOSED_PORT, EXPOSED_PORT);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(new TestPortBindings(binding));
bind(ContainerScoped.class,
Container.class,
new ContainerImpl("_UNMAPPED_", deployableContainer, new ContainerDefImpl("arquillian.xml")));
ProtocolMetaData metadata = new ProtocolMetaData();
metadata.addContext(new HTTPContext(LOCALHOST, EXPOSED_PORT).add(new Servlet("A", "B")));
bind(DeploymentScoped.class, ProtocolMetaData.class, metadata);
fire(metadata);
ProtocolMetaData updated = getManager().getContext(DeploymentContext.class)
.getObjectStore().get(ProtocolMetaData.class);
Assert.assertEquals(metadata.getContexts(HTTPContext.class).iterator().next(),
updated.getContexts(HTTPContext.class).iterator().next());
assertEventFired(ProtocolMetaData.class, 1);
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:24,代码来源:ProtocolMetaDataUpdaterTestCase.java
示例5: getHTTPDeploymentMetaData
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
public HTTPContext getHTTPDeploymentMetaData(Server server, String uniqueDeploymentName) {
URI webURI = getProtocolURI(server, PROTOCOL_HTTP);
HTTPContext context = new HTTPContext(webURI.getHost(), webURI.getPort());
try {
ModelNode deploymentNode = readResource(createHostServerDeploymentAddress(
server.getHost(), server.getName(), uniqueDeploymentName), false); // don't include runtime information, workaround for bug in web statistics
if (isWebArchive(uniqueDeploymentName)) {
extractWebArchiveContexts(context, deploymentNode);
} else if (isEnterpriseArchive(uniqueDeploymentName)) {
extractEnterpriseArchiveContexts(context, deploymentNode);
}
} catch (Exception e) {
throw new RuntimeException("Could not extract deployment information for server: " + server + " on deployment: "
+ uniqueDeploymentName, e);
}
return context;
}
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:21,代码来源:ManagementClient.java
示例6: extractWebArchiveContexts
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
private void extractWebArchiveContexts(HTTPContext context, String deploymentName, ModelNode deploymentNode) {
if (deploymentNode.hasDefined(SUBSYSTEM)) {
ModelNode subsystem = deploymentNode.get(SUBSYSTEM);
if (subsystem.hasDefined(UNDERTOW)) {
ModelNode webSubSystem = subsystem.get(UNDERTOW);
if (webSubSystem.isDefined() && webSubSystem.hasDefined("context-root")) {
final String contextName = webSubSystem.get("context-root").asString();
if (webSubSystem.hasDefined(SERVLET)) {
for (final ModelNode servletNode : webSubSystem.get(SERVLET).asList()) {
for (final String servletName : servletNode.keys()) {
context.add(new Servlet(servletName, toContextName(contextName)));
}
}
}
/*
* This is a WebApp, it has some form of webcontext whether it has a Servlet or not. AS7 does not expose jsp
* / default servlet in mgm api
*/
context.add(new Servlet("default", toContextName(contextName)));
}
}
}
}
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:24,代码来源:ManagementClient.java
示例7: extractWebArchiveContexts
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
private void extractWebArchiveContexts(HTTPContext context, ModelNode deploymentNode) {
if (deploymentNode.hasDefined(SUBSYSTEM)) {
ModelNode subsystem = deploymentNode.get(SUBSYSTEM);
if (subsystem.hasDefined(UNDERTOW)) {
ModelNode webSubSystem = subsystem.get(UNDERTOW);
if (webSubSystem.isDefined() && webSubSystem.hasDefined("context-root")) {
final String contextName = toContextName(webSubSystem.get("context-root").asString());
if (webSubSystem.hasDefined(SERVLET)) {
for (final ModelNode servletNode : webSubSystem.get(SERVLET).asList()) {
for (final String servletName : servletNode.keys()) {
context.add(new Servlet(servletName, contextName));
}
}
}
/*
* This is a WebApp, it has some form of webcontext whether it has a
* Servlet or not. AS7 does not expose jsp / default servlet in mgm api
*/
context.add(new Servlet("default", contextName));
}
}
}
}
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:24,代码来源:ManagementClient.java
示例8: addArquillianServlet
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
protected void addArquillianServlet(final Archive<?> archive, final AppInfo appInfo,
final String archiveName, final HTTPContext httpContext) {
// Avoids "inconvertible types" error in windows build
if (archiveName.endsWith(".war")) {
httpContext.add(new Servlet("ArquillianServletRunner", "/" + getArchiveNameWithoutExtension(archive)));
} else if (archiveName.endsWith(".ear") && appInfo.webApps.size() > 0) {
final String contextRoot = System.getProperty("tomee.arquillian.ear.context", configuration.getWebContextToUseWithEars());
if (contextRoot != null) {
httpContext.add(new Servlet("ArquillianServletRunner", ("/" + contextRoot).replace("//", "/")));
} else {
for (final WebAppInfo web : appInfo.webApps) { // normally a single webapp is supported cause of arquillian resolution
httpContext.add(new Servlet("ArquillianServletRunner", ("/" + web.contextRoot).replace("//", "/")));
}
}
} else {
httpContext.add(new Servlet("ArquillianServletRunner", "/arquillian-protocol")); // needs another jar to add the fake webapp
}
}
开发者ID:apache,项目名称:tomee,代码行数:19,代码来源:TomEEContainer.java
示例9: addServlets
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
public void addServlets(final HTTPContext httpContext, final AppInfo appInfo) {
for (final WebAppInfo webApps : appInfo.webApps) {
for (final ServletInfo servlet : webApps.servlets) {
// weird but arquillian url doesn't match the servlet url but its context
String clazz = servlet.servletClass;
if (clazz == null) {
clazz = servlet.servletName;
if (clazz == null) {
continue;
}
}
httpContext.add(new Servlet(clazz, webApps.contextRoot));
/*
for (String mapping : servlet.mappings) {
httpContext.add(new Servlet(servlet.servletClass, startWithSlash(uniqueSlash(webApps.contextRoot, mapping))));
}
*/
}
}
}
开发者ID:apache,项目名称:tomee,代码行数:23,代码来源:TomEEContainer.java
示例10: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive)
throws DeploymentException {
LiferayRemoteContainerConfiguration config =
_configurationInstance.get();
ProtocolMetaData protocolMetaData = super.deploy(archive);
protocolMetaData.addContext(
new HTTPContext(config.getHttpHost(), config.getHttpPort()));
return protocolMetaData;
}
开发者ID:liferay-labs,项目名称:arquillian-liferay,代码行数:15,代码来源:LiferayRemoteDeployableContainer.java
示例11: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive)
throws DeploymentException {
ProtocolMetaData protocolMetaData = super.deploy(archive);
protocolMetaData.addContext(
new HTTPContext(config.getHttpHost(), config.getHttpPort()));
return protocolMetaData;
}
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:12,代码来源:LiferayRemoteDeployableContainer.java
示例12: getBaseURL
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
private 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");
}
开发者ID:windup,项目名称:windup-rulesets,代码行数:10,代码来源:RestInvoker.java
示例13: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
public ProtocolMetaData deploy(Archive<?> archive)
throws DeploymentException {
HTTPContext httpContext = null;
if (archive instanceof UndertowWebArchive) {
httpContext = registerDeploymentInfo(archive);
} else {
if (archive instanceof UndertowHttpHandlerArchive) {
httpContext = registerHandler(archive);
}
}
return new ProtocolMetaData().addContext(httpContext);
}
开发者ID:arquillian,项目名称:arquillian-container-undertow,代码行数:16,代码来源:EmbeddedUndertowContainer.java
示例14: registerHandler
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
private HTTPContext registerHandler(Archive<?> archive) {
UndertowHttpHandlerArchive handler = (UndertowHttpHandlerArchive) archive;
this.undertow = createUndertow(handler.getHttpHandler());
this.undertow.start();
HTTPContext httpContext = new HTTPContext(
configuration.getBindAddress(), configuration.getBindHttpPort());
return httpContext;
}
开发者ID:arquillian,项目名称:arquillian-container-undertow,代码行数:12,代码来源:EmbeddedUndertowContainer.java
示例15: registerDeploymentInfo
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
private HTTPContext registerDeploymentInfo(Archive<?> archive) {
UndertowWebArchive servletBuilder = (UndertowWebArchive) archive;
final DeploymentInfo deploymentInfo = servletBuilder
.getDeploymentInfo();
deploymentManager = defaultContainer().addDeployment(
deploymentInfo);
deploymentManager.deploy();
try {
this.undertow = createUndertow(deploymentManager.start());
this.undertow.start();
} catch (ServletException e) {
throw new IllegalArgumentException(e);
}
HTTPContext httpContext = new HTTPContext(
configuration.getBindAddress(), configuration.getBindHttpPort());
final Map<String, ServletInfo> servlets = deploymentInfo.getServlets();
final Collection<ServletInfo> servletsInfo = servlets.values();
for (ServletInfo servletInfo : servletsInfo) {
httpContext.add(new Servlet(servletInfo.getName(),
deploymentManager.getDeployment().getDeploymentInfo()
.getContextPath()));
}
return httpContext;
}
开发者ID:arquillian,项目名称:arquillian-container-undertow,代码行数:31,代码来源:EmbeddedUndertowContainer.java
示例16: extractEnterpriseArchiveContexts
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
private void extractEnterpriseArchiveContexts(HTTPContext context, ModelNode deploymentNode) {
if (deploymentNode.hasDefined(SUBDEPLOYMENT)) {
for (ModelNode subdeployment : deploymentNode.get(SUBDEPLOYMENT).asList()) {
String deploymentName = subdeployment.keys().iterator().next();
if (isWebArchive(deploymentName)) {
extractWebArchiveContexts(context, deploymentName, subdeployment.get(deploymentName));
}
}
}
}
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:11,代码来源:ManagementClient.java
示例17: getProtocolMetaData
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
/**
* Gets the meta-data.
*
* @return the meta-data
*
* @throws IllegalStateException if this has been {@linkplain #close() closed}
*/
public ProtocolMetaData getProtocolMetaData(String deploymentName) {
init();
ProtocolMetaData metaData = new ProtocolMetaData();
metaData.addContext(new JMXContext(getConnection()));
if (undertowSubsystemPresent) {
URI webURI = getWebUri();
HTTPContext context = new HTTPContext(webURI.getHost(), webURI.getPort());
metaData.addContext(context);
try {
final ModelNode operation = new ModelNode();
operation.get(OP).set(READ_RESOURCE_OPERATION);
operation.get(RECURSIVE_DEPTH).set(3); // /deployment=x/subdeployment=y/subsystem=undertow/servlet=*
operation.get(INCLUDE_RUNTIME).set(true);
ModelNode address = new ModelNode();
address.add(DEPLOYMENT, deploymentName);
operation.get(OP_ADDR).set(address);
ModelNode deploymentNode = executeForResult(operation);
if (isWebArchive(deploymentName)) {
extractWebArchiveContexts(context, deploymentNode);
} else if (isEnterpriseArchive(deploymentName)) {
extractEnterpriseArchiveContexts(context, deploymentNode);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return metaData;
}
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:39,代码来源:ManagementClient.java
示例18: extractEnterpriseArchiveContexts
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
private void extractEnterpriseArchiveContexts(HTTPContext context, ModelNode deploymentNode) {
if (deploymentNode.hasDefined(SUBDEPLOYMENT)) {
for (ModelNode subdeployment : deploymentNode.get(SUBDEPLOYMENT).asList()) {
String deploymentName = subdeployment.keys().iterator().next();
if (isWebArchive(deploymentName)) {
extractWebArchiveContexts(context, subdeployment.get(deploymentName));
}
}
}
}
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:11,代码来源:ManagementClient.java
示例19: beforeSuite
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
public void beforeSuite(@Observes final BeforeEnrichment event) {
final ProtocolMetaData metaData = protocolMetadata.get();
if(metaData == null || !metaData.hasContext(HTTPContext.class)) {
return;
}
try {
Thread.currentThread().getContextClassLoader().loadClass(REMOTE_INITIAL_CONTEXT_FACTORY);
final HTTPContext httpContext = metaData.getContexts(HTTPContext.class).iterator().next();
final Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, REMOTE_INITIAL_CONTEXT_FACTORY);
props.setProperty(Context.PROVIDER_URL, "http://" + httpContext.getHost() + ":" + httpContext.getPort() + "/tomee/ejb");
Context existing = null;
try {
existing = existingContext.get();
} catch (final Throwable t) {
// no-op
}
final Context proxyInstance = (Context) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[]{Context.class}, new MultipleContextHandler(props, existing));
context.set(new InitialContextWrapper(proxyInstance)); // cause ContextProducer of arquillian supports InitialContext
} catch (final ClassNotFoundException | NamingException e) {
// no-op
}
}
开发者ID:apache,项目名称:tomee,代码行数:28,代码来源:RemoteInitialContextObserver.java
示例20: getBaseURL
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext; //导入依赖的package包/类
private URI getBaseURL() {
Collection<HTTPContext> contexts = metaDataInst.get().getContexts(HTTPContext.class);
HTTPContext context = contexts.iterator().next();
if (allInSameContext(context.getServlets())) {
return context.getServlets().get(0).getBaseURI();
}
throw new IllegalStateException("No baseURL found in HTTPContext");
}
开发者ID:searchisko,项目名称:searchisko,代码行数:11,代码来源:SearchiskoWarmupExecutor.java
注:本文中的org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论