Forward PolyGerrit paths to their GWT equivalents if PG is off
Change-Id: I1a57a1d1c345487b8eb491e0a9e66d3352f690c1
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/UrlModule.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/UrlModule.java
index 3083edd..45e5615 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/UrlModule.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/UrlModule.java
@@ -87,6 +87,9 @@
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 @@
});
}
+ 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;