daemon: Allow httpd.listenUrl to end with unnecessary '/'

Jetty refuses to allow a context path to end with '/', so if the
current httpd.listenUrl that we are building a context for happens
to have that, drop it off.

Change-Id: I893e8d65b3381e3bfde92e490456a32d0fb3d33d
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-12-14 14:43:20 -08:00
parent 2c8652e04b
commit 4691f2f6cf

View File

@@ -252,7 +252,14 @@ public class JettyServer {
throws MalformedURLException, IOException {
final Set<String> paths = new HashSet<String>();
for (URI u : listenURLs(cfg)) {
paths.add(u.getPath() != null ? u.getPath() : "/");
String p = u.getPath();
if (p == null || p.isEmpty()) {
p = "/";
}
while (1 < p.length() && p.endsWith("/")) {
p = p.substring(p.length() - 1);
}
paths.add(p);
}
final List<ContextHandler> all = new ArrayList<ContextHandler>();