Refine search
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); }
private static Collection<HTTPContext> getHTTPContext(ProtocolMetaData protocolMetaData) { Collection<HTTPContext> contexts = protocolMetaData.getContexts(HTTPContext.class); if (contexts != null && contexts.size() > 0) { return contexts; } else { return Collections.singleton(null); // push non-empty http contexts } }
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); } }
ProtocolMetaData updatedMetaData = new ProtocolMetaData(); boolean updated = false; 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; HTTPContext newContext = new HTTPContext(ip, port); for (Servlet servlet : context.getServlets()) { newContext.add(servlet); updatedMetaData.addContext(newContext); updatedMetaData.addContext(contextObj);
@Test public void shouldBeAbleToInjectBaseContextURLQualified() throws Exception { URLBaseContextClassQualified test = execute( URLBaseContextClassQualified.class, ProtocolMetaData.class, new ProtocolMetaData() .addContext(new HTTPContext("TEST-Y", 8080)), new ProtocolMetaData() .addContext(new HTTPContext("TEST-X", 8080))); Assert.assertEquals("http://TEST-X:8080", test.url.toExternalForm()); }
return new ProtocolMetaData();
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)); http = HTTPContext.class.cast(metaData.getContexts().iterator().next()); http.add(new Servlet(path.substring(path.lastIndexOf('!') + 2).replace(".class", "").replace("/", "."), webapp.contextRoot)); return new ProtocolMetaData();
return null; if (metaData.hasContext(HTTPContext.class)) { HTTPContext context = null; if (targets != null) { context = locateNamedHttpContext(metaData, targets.value()); } else { context = metaData.getContexts(HTTPContext.class).iterator().next(); Servlet servlet = context.getServletByName(resource.value().getSimpleName()); if (servlet == null) { servlet = context.getServletByName(resource.value().getName()); else if (allInSameContext(context.getServlets())) { return toURL(context.getServlets().get(0)); } else {
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"); }
private HTTPContext locateNamedHttpContext(ProtocolMetaData metaData, String value) { for (HTTPContext context : metaData.getContexts(HTTPContext.class)) { if (value.equals(context.getName())) { return context; } } throw new IllegalArgumentException( "Could not find named context " + value + " in metadata. " + "Please verify your @" + TargetsContainer.class.getName() + " definition"); }
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"); }
HTTPContext httpContext = pmd.getContext(HTTPContext.class); if (httpContext != null) { return httpContext.getHost(); RMIContext rmiContext = pmd.getContext(RMIContext.class); if (rmiContext != null) { return rmiContext.getIp(); JMXContext jmxContext = pmd.getContext(JMXContext.class); if (jmxContext != null) { try {
@Override public ContainerMethodExecutor getExecutor(T config, ProtocolMetaData metaData, CommandCallback callback) { if (metaData.hasContext(JMXContext.class)) { MBeanServerConnection mbeanServer = metaData.getContext(JMXContext.class).getConnection(); Map<String, String> protocolProps = new HashMap<String, String>(); try { BeanInfo beanInfo = Introspector.getBeanInfo(config.getClass()); for (PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors()) { String key = propertyDescriptor.getName(); Object value = propertyDescriptor.getReadMethod().invoke(config); if (value != null) { protocolProps.put(key, "" + value); } } } catch (Exception ex) { throw new IllegalStateException("Cannot obtain protocol config"); } return new JMXMethodExecutor(mbeanServer, callback, JMXTestRunnerMBean.OBJECT_NAME, protocolProps); } else { throw new IllegalStateException( "No " + JMXContext.class.getName() + " was found in " + ProtocolMetaData.class.getName() + ". The JMX Protocol can not be used without a connection, " + "please verify your protocol configuration or contact the DeployableContainer developer"); } } }
public static ProtocolMetaData protocolMetaData(final AppInfo info) { final org.apache.openejb.server.ServiceManager smp = org.apache.openejb.server.ServiceManager.get(); if (smp != null && SimpleServiceManager.class.isInstance(smp)) { final ServerService[] daemons = SimpleServiceManager.class.cast(smp).getDaemons(); for (final ServerService ss : daemons) { if ("httpejbd".equals(ss.getName())) { final HTTPContext httpContext = new HTTPContext(ss.getIP(), ss.getPort()); httpContext.add(new Servlet("ArquillianServletRunner", info.appId)); return new ProtocolMetaData().addContext(httpContext); } } } return null; } }
ProtocolMetaData updatedMetaData = new ProtocolMetaData(); boolean updated = false; 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; HTTPContext newContext = new HTTPContext(ip, port); for (Servlet servlet : context.getServlets()) { newContext.add(servlet); updatedMetaData.addContext(newContext); updatedMetaData.addContext(contextObj);
@Test public void shouldBeAbleToInjectBaseContextURLQualified() throws Exception { URLBaseContextClassQualified test = execute( URLBaseContextClassQualified.class, ProtocolMetaData.class, new ProtocolMetaData() .addContext(new HTTPContext("TEST-Y", 8080)), new ProtocolMetaData() .addContext(new HTTPContext("TEST-X", 8080))); Assert.assertEquals("http://TEST-X:8080", test.url.toExternalForm()); }
@Override public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException { androidDeploy.fire(new AndroidDeploy(archive)); return new ProtocolMetaData(); }
return null; if (metaData.hasContext(HTTPContext.class)) { HTTPContext context = null; if (targets != null) { context = locateNamedHttpContext(metaData, targets.value()); } else { context = metaData.getContexts(HTTPContext.class).iterator().next(); Servlet servlet = context.getServletByName(resource.value().getSimpleName()); if (servlet == null) { servlet = context.getServletByName(resource.value().getName()); else if (allInSameContext(context.getServlets())) { return toURL(context.getServlets().get(0)); } else {
private HTTPContext locateNamedHttpContext(ProtocolMetaData metaData, String value) { for (HTTPContext context : metaData.getContexts(HTTPContext.class)) { if (value.equals(context.getName())) { return context; } } throw new IllegalArgumentException( "Could not find named context " + value + " in metadata. " + "Please verify your @" + TargetsContainer.class.getName() + " definition"); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionOnUnKnownTargetInDeployment() throws Exception { execute( URLBaseContextClassQualifiedTargetedMissing.class, ProtocolMetaData.class, new ProtocolMetaData() .addContext(new HTTPContext("TEST-Y", 8080) .add(new Servlet(URLServletContextClass.class.getSimpleName(), "/test-Y"))), new ProtocolMetaData() .addContext(new HTTPContext("TEST-X", 8080) .add(new Servlet(URLServletContextClass.class.getSimpleName(), "/test-X")))); }