本文整理汇总了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类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(final Archive<?> archive) throws DeploymentException {
final DeploymentInfo info;
try {
final Closeables cl = new Closeables();
closeablesProducer.set(cl);
info = quickDeploy(archive, testClass.get(), cl);
// try to switch module context jndi to let test use java:module naming
// we could put the managed bean in the war but then test class should respect all the
// container rules (CDI) which is not the case with this solution
if (archive.getName().endsWith(".war")) {
final List<BeanContext> beanContexts = info.appCtx.getBeanContexts();
if (beanContexts.size() > 1) {
final Iterator<BeanContext> it = beanContexts.iterator();
while (it.hasNext()) {
final BeanContext next = it.next();
if (ModuleTestContext.class.isInstance(next.getModuleContext()) && BeanContext.Comp.class != next.getBeanClass()) {
for (final BeanContext b : beanContexts) {
if (b.getModuleContext() != next.getModuleContext()) {
ModuleTestContext.class.cast(next.getModuleContext())
.setModuleJndiContextOverride(b.getModuleContext().getModuleJndiContext());
break;
}
}
break;
}
}
}
}
servletContextProducer.set(info.appServletContext);
sessionProducer.set(info.appSession);
appInfoProducer.set(info.appInfo);
appContextProducer.set(info.appCtx);
final ClassLoader loader = info.appCtx.getWebContexts().isEmpty() ? info.appCtx.getClassLoader() : info.appCtx.getWebContexts().iterator().next().getClassLoader();
final ClassLoader classLoader = loader == null ? info.appCtx.getClassLoader() : loader;
TestObserver.ClassLoaders classLoaders = this.classLoader.get();
if (classLoaders == null) {
classLoaders = new TestObserver.ClassLoaders();
this.classLoader.set(classLoaders);
}
classLoaders.register(archive.getName(), classLoader);
} catch (final Exception e) {
throw new DeploymentException("can't deploy " + archive.getName(), e);
}
// if service manager is started allow @ArquillianResource URL injection
if (PROPERTIES.containsKey(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE)) {
final ProtocolMetaData metaData = ServiceManagers.protocolMetaData(appInfoProducer.get());
HTTPContext http = null;
for (final WebAppInfo webapp : info.appInfo.webApps) {
for (final ServletInfo servletInfo : webapp.servlets) {
if (http == null) {
http = HTTPContext.class.cast(metaData.getContexts().iterator().next());
http.add(new Servlet(servletInfo.servletName, webapp.contextRoot));
}
}
for (final ClassListInfo classListInfo : webapp.webAnnotatedClasses) {
for (final String path : classListInfo.list) {
if (!path.contains("!")) {
continue;
}
if (http == null) {
http = HTTPContext.class.cast(metaData.getContexts().iterator().next());
}
http.add(new Servlet(path.substring(path.lastIndexOf('!') + 2).replace(".class", "").replace("/", "."), webapp.contextRoot));
}
}
}
if (metaData != null) {
return metaData;
}
}
return new ProtocolMetaData();
}
开发者ID:apache,项目名称:tomee,代码行数:78,代码来源:OpenEJBDeployableContainer.java
示例17: newHttpProtocolMetaData
import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
private static ProtocolMetaData newHttpProtocolMetaData(final ServerService ss, final String contextRoot) {
final HTTPContext httpContext = new HTTPContext(ss.getIP(), ss.getPort());
httpContext.add(new Servlet("ArquillianServletRunner", contextRoot));
return new ProtocolMetaData().addContext(httpContext);
}
开发者ID:apache,项目名称:tomee,代码行数:6,代码来源:ServiceManagers.java
示例18: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(final Archive<?> archive) throws DeploymentException {
try {
/* don't do it since it should be configurable
final File tempDir = Files.createTempDir();
final File file = new File(tempDir, name);
*/
final String name = archive.getName();
final Dump dump = this.dumpFile(archive);
final File file = dump.getFile();
if (dump.isCreated() || !configuration.isSingleDeploymentByArchiveName(name)) {
ARCHIVES.put(archive, file);
final Thread current = Thread.currentThread();
final ClassLoader loader = current.getContextClassLoader();
current.setContextClassLoader(ParentClassLoaderFinder.Helper.get()); // multiple deployments, don't leak a loader
try {
this.container.deploy(name, file);
} finally {
current.setContextClassLoader(loader);
}
}
final AppInfo info = this.container.getInfo(name);
final String context = this.getArchiveNameWithoutExtension(archive);
final HTTPContext httpContext = new HTTPContext(this.configuration.getHost(), this.configuration.getHttpPort());
httpContext.add(new Servlet("ArquillianServletRunner", "/" + context));
this.addServlets(httpContext, info);
startCdiContexts(name); // ensure tests can use request/session scopes even if we don't have a request
TestObserver.ClassLoaders classLoaders = this.classLoader.get();
if (classLoaders == null) {
classLoaders = new TestObserver.ClassLoaders();
this.classLoader.set(classLoaders);
}
classLoaders.register(archive.getName(), SystemInstance.get().getComponent(ContainerSystem.class).getAppContext(info.appId).getClassLoader());
return new ProtocolMetaData().addContext(httpContext);
} catch (final Exception e) {
throw new DeploymentException("Unable to deploy", e);
}
}
开发者ID:apache,项目名称:tomee,代码行数:45,代码来源:EmbeddedTomEEContainer.java
注:本文中的org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论