HttpConductorImpl implements HttpConductor, Service { static String getContextPathPrefix(String contextPath) { if (!contextPath.startsWith("/")) throw new IllegalPathRequest("registered paths must start with '/'"); int contextBaseEnd = contextPath.indexOf("/", 1); if (contextBaseEnd < 0) contextBaseEnd = contextPath.length(); String result = contextPath.substring(1, contextBaseEnd); if (result.contains("*")) throw new IllegalPathRequest("can't ask for a glob within the first URL segment"); return result; } @Inject  HttpConductorImpl(ConfigurationService configurationService,
                             SecurityService securityService,
                             MonitorService monitor,
                             SessionService session); @Override void registerHandler(ServletHolder servlet, String path); @Override void unregisterHandler(ServletHolder servlet); @Override int getPort(); @Override void start(); @Override void stop(); @Override void crash(); static final String SERVER_TYPE; }
@Test(expected = IllegalPathRequest.class) public void badStart() { HttpConductorImpl.getContextPathPrefix("no-dash"); }
@Test(expected = IllegalPathRequest.class) public void empty() { HttpConductorImpl.getContextPathPrefix(""); }
@Test(expected = IllegalPathRequest.class) public void slashAll() { HttpConductorImpl.getContextPathPrefix("/*"); }