@Override public List<Servlet> getServlets() { initiateContext(); return context.getServlets(); }
public Servlet getServletByName(String name) { for (Servlet servlet : getServlets()) { if (servlet.getName().equals(name)) { return servlet; } } return null; }
@Override public List<Servlet> getServlets() { initiateContext(); return context.getServlets(); }
public Servlet getServletByName(String name) { for (Servlet servlet : getServlets()) { if (servlet.getName().equals(name)) { return servlet; } } return null; }
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"); }
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); } } } }
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); } } } }
private URI locateCommandEventBusURI(HTTPContext context) { List<Servlet> contextServlets = context.getServlets(); if (contextServlets == null) { throw new IllegalArgumentException("Could not determine URI for WarpFilter in context " + context URI baseURI = context.getServlets().get(0).getBaseURI(); String path = baseURI.getPath(); if (path.endsWith("/")) { return new URI("http", null, baseURI.getHost(), baseURI.getPort(), path, null, null); } catch (URISyntaxException e) { throw new RuntimeException("Could not convert Servlet to URL, " + context.getServlets().get(0), e);
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"); }
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(); }
else if (allInSameContext(context.getServlets())) { return toURL(context.getServlets().get(0)); } else { return toURL(context);
else if (allInSameContext(context.getServlets())) { return toURL(context.getServlets().get(0)); } else { return toURL(context);
@Override protected HTTPContext locateHTTPContext(Method method) { HTTPContext previous = null; if (httpContexts != null && httpContexts.size() > 0) { previous = super.locateHTTPContext(method); } final ModuleContext mc = locateModuleContext(method); HTTPContext context; if (previous == null) { context = new HTTPContext(mc.getHost(), mc.getPort()); addArquillianServlet(context); } else { context = new HTTPContext(previous.getName(), mc.getHost(), mc.getPort()); boolean foundArqServlet = false; for (Servlet servlet : previous.getServlets()) { if (foundArqServlet == false && ServletMethodExecutor.ARQUILLIAN_SERVLET_NAME.equals(servlet.getName())) { foundArqServlet = true; } context.add(servlet); } if (foundArqServlet == false) { addArquillianServlet(context); } } return context; }
for (Servlet servlet : context.getServlets()) { newContext.add(servlet);
for (Servlet servlet : context.getServlets()) { newContext.add(servlet);