Implement a redirector for gitweb-style URLs.

Add a filter to the host index chain to redirect in the presence of
gitweb-style query parameters. Only handles gitweb URLs using the query
parameter flavor; see gitweb(1) for details.

The intent of this filter is to provide compatibility for preexisting
links to old gitweb URLs to be migrated to Gitiles; of course Gitiles
itself does not create such URLs. For this reason, use HTTP 301 (Moved
Permanently) for the redirect rather than 302 Found.

Include simple but not exhaustive tests; the code block in question is
far more concise than exhaustive tests would be.

Change-Id: Ief7022b7cd419fc0380992071ad6e4a4428a6169
diff --git a/gitiles-servlet/src/test/java/com/google/gitiles/TestGitilesUrls.java b/gitiles-servlet/src/test/java/com/google/gitiles/TestGitilesUrls.java
index f8a0883..14ccef7 100644
--- a/gitiles-servlet/src/test/java/com/google/gitiles/TestGitilesUrls.java
+++ b/gitiles-servlet/src/test/java/com/google/gitiles/TestGitilesUrls.java
@@ -19,20 +19,21 @@
 /** {@link GitilesUrls} for testing. */
 public class TestGitilesUrls implements GitilesUrls {
   public static final GitilesUrls URLS = new TestGitilesUrls();
+  public static final String HOST_NAME = "test-host";
 
   @Override
   public String getHostName(HttpServletRequest req) {
-    return "test-host";
+    return HOST_NAME;
   }
 
   @Override
   public String getBaseGitUrl(HttpServletRequest req) {
-    return "git://test-host/foo";
+    return "git://" + HOST_NAME + "/foo";
   }
 
   @Override
   public String getBaseGerritUrl(HttpServletRequest req) {
-    return "http://test-host-review/foo/";
+    return "http://" + HOST_NAME + "-review/foo/";
   }
 
   private TestGitilesUrls() {