Allow admins to configure URL aliases

This allows to map plugin screens into the Gerrit URL namespace, e.g.:

  [urlAlias "MyPluginScreen"]
    match = /myscreen/(.*)
    token = /x/myplugin/myscreen/$1

This can also be used to replace Gerrit screens with plugin screens,
e.g. to replace change screen:

  [urlAlias "MyChangeScreen"]
    match = /c/(.*)
    token = /x/myplugin/c/$1

Defining URL aliases is similar to defining comment links. This is why
a similar representation in the gerrit.config was chosen.

Change-Id: Ie4a3b69703629051f7627eeb0c479dfc964f27ae
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2015-07-16 12:38:52 +02:00
parent 8586292fcf
commit fa0d494d11
8 changed files with 140 additions and 1 deletions

View File

@@ -96,6 +96,8 @@ import com.google.gerrit.reviewdb.client.Project;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.http.client.URL;
import com.google.gwt.regexp.shared.MatchResult;
import com.google.gwt.regexp.shared.RegExp;
import com.google.gwt.user.client.Window;
import com.google.gwtorm.client.KeyUtil;
@@ -204,7 +206,9 @@ public class Dispatcher {
}
}
private static void select(final String token) {
private static void select(String token) {
token = Gerrit.getUrlAliasMatcher().replace(token);
if (matchPrefix(QUERY, token)) {
query(token);