当前位置: 首页>>代码示例>>Java>>正文


Java Servlet类代码示例

本文整理汇总了Java中org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet的典型用法代码示例。如果您正苦于以下问题:Java Servlet类的具体用法?Java Servlet怎么用?Java Servlet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Servlet类属于org.jboss.arquillian.container.spi.client.protocol.metadata包,在下文中一共展示了Servlet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldUpdateWithPortFromDocker

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的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

示例2: shouldUpdateWithIPFromDocker

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的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

示例3: shouldNotUpdateIfContainerNotMapped

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的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

示例4: extractWebArchiveContexts

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的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

示例5: extractWebArchiveContexts

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的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

示例6: addArquillianServlet

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的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

示例7: addServlets

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的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

示例8: allInSameContext

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
private boolean allInSameContext(List<Servlet> servlets)
{
    Set<String> context = new HashSet<String>();
    for (Servlet servlet : servlets)
    {
        context.add(servlet.getContextRoot());
    }
    return context.size() == 1;
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:10,代码来源:RestInvoker.java

示例9: registerDeploymentInfo

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的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

示例10: allInSameContext

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
private boolean allInSameContext(List<Servlet> servlets) {
	Set<String> context = new HashSet<>();
	for (Servlet servlet : servlets) {
		context.add(servlet.getContextRoot());
	}
	return context.size() == 1;
}
 
开发者ID:searchisko,项目名称:searchisko,代码行数:8,代码来源:SearchiskoWarmupExecutor.java

示例11: addArquillianTestServlet

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
private void addArquillianTestServlet(Archive<?> deployment, HTTPContext httpContext) {
    httpContext.add(new Servlet("ArquillianServletRunner", extractContextName(deployment)));
}
 
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:4,代码来源:ContainerlessDockerDeployableContainer.java

示例12: update

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
public void update(@Observes EventContext<ProtocolMetaData> eventContext, Container container,
    CubeRegistry registry) {

    ProtocolMetaData originalMetaData = eventContext.getEvent();
    ProtocolMetaData updatedMetaData = new ProtocolMetaData();
    boolean updated = false;

    try {
        Cube<?> cube = registry.getCube(ContainerUtil.getCubeIDForContainer(container));
        if (cube == null) {
            return;
        }
        HasPortBindings portBindings = cube.getMetadata(HasPortBindings.class);
        if (portBindings == null) {
            return;
        }
        for (Object contextObj : originalMetaData.getContexts()) {
            if (contextObj instanceof HTTPContext) {
                HTTPContext context = (HTTPContext) contextObj;
                String ip = context.getHost();
                int port = context.getPort();
                final PortAddress mappedPort = portBindings.getMappedAddress(port);
                final String bindingIp;
                final Integer bindingPort;
                if (mappedPort != null) {
                    bindingIp = mappedPort.getIP();
                    bindingPort = mappedPort.getPort();
                } else {
                    continue;
                }
                if (bindingPort != null && port != bindingPort) {
                    updated = true;
                    port = bindingPort;
                }
                if (bindingIp != null && !bindingIp.equals(ip)) {
                    updated = true;
                    ip = bindingIp;
                }
                if (updated) {
                    HTTPContext newContext = new HTTPContext(ip, port);
                    for (Servlet servlet : context.getServlets()) {
                        newContext.add(servlet);
                    }
                    updatedMetaData.addContext(newContext);
                }
            } else {
                updatedMetaData.addContext(contextObj);
            }
        }
    } finally {
        if (updated) {
            protocolMetaDataProducer.set(updatedMetaData);
        } else {
            eventContext.proceed();
        }
    }
}
 
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:58,代码来源:ProtocolMetadataUpdater.java

示例13: add

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
@Override
public HTTPContext add(Servlet servlet) {
    initiateContext();
    return context.add(servlet);
}
 
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:6,代码来源:LazyHttpContext.java

示例14: getServlets

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
@Override
public List<Servlet> getServlets() {
    initiateContext();
    return context.getServlets();
}
 
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:6,代码来源:LazyHttpContext.java

示例15: getServletByName

import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
@Override
public Servlet getServletByName(String name) {
    initiateContext();
    return context.getServletByName(name);
}
 
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:6,代码来源:LazyHttpContext.java


注:本文中的org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。