Forward PolyGerrit paths to their GWT equivalents if PG is off

Change-Id: I1a57a1d1c345487b8eb491e0a9e66d3352f690c1
This commit is contained in:
Andrew Bonventre
2016-05-10 12:39:06 -04:00
parent 03df6feb6a
commit 7f632f31fe

View File

@@ -87,6 +87,9 @@ class UrlModule extends ServletModule {
serve("/watched").with(query("is:watched status:open"));
serve("/starred").with(query("is:starred"));
// Forward PolyGerrit URLs to their respective GWT equivalents.
serveRegex("^/(c|q|x|admin|dashboard|settings)/(.*)").with(gerritUrl());
serveRegex("^/settings/?$").with(screen(PageLinks.SETTINGS));
serveRegex("^/register/?$").with(screen(PageLinks.REGISTER + "/"));
serveRegex("^/([1-9][0-9]*)/?$").with(directChangeById());
@@ -117,6 +120,18 @@ class UrlModule extends ServletModule {
});
}
private Key<HttpServlet> gerritUrl() {
return key(new HttpServlet() {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException {
toGerrit(req.getRequestURI(), req, rsp);
}
});
}
private Key<HttpServlet> screen(final String target) {
return key(new HttpServlet() {
private static final long serialVersionUID = 1L;