Move handling of ListPluginsServlet to HttpPluginServlet HttpPluginServlet already handles serving URLs in the "/plugins/*" namespace. It makes sense to have it also serve the "/plugings/" URL, as we will add more actions soon, such as /plugins/?reload and /plugins/?install. Change-Id: Ic5eb5d9169139b8ded021a0e0f1cf421be0b2927 Signed-off-by: Brad Larson <bklarson@gmail.com>
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 a712f9b..9e69946 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
@@ -26,7 +26,6 @@ import com.google.gerrit.httpd.rpc.account.AccountCapabilitiesServlet; import com.google.gerrit.httpd.rpc.change.DeprecatedChangeQueryServlet; import com.google.gerrit.httpd.rpc.change.ListChangesServlet; -import com.google.gerrit.httpd.rpc.plugin.ListPluginsServlet; import com.google.gerrit.httpd.rpc.project.ListProjectsServlet; import com.google.gerrit.reviewdb.client.Change; import com.google.gerrit.reviewdb.client.Project; @@ -96,7 +95,6 @@ filter("/a/*").through(RequireIdentifiedUserFilter.class); serveRegex("^/(?:a/)?accounts/self/capabilities$").with(AccountCapabilitiesServlet.class); serveRegex("^/(?:a/)?changes/$").with(ListChangesServlet.class); - serveRegex("^/(?:a/)?plugins/$").with(ListPluginsServlet.class); serveRegex("^/(?:a/)?projects/(.*)?$").with(ListProjectsServlet.class); if (cfg.deprecatedQuery) {
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java index 47eae99..e737700 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java
@@ -19,6 +19,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gerrit.extensions.registration.RegistrationHandle; +import com.google.gerrit.httpd.rpc.plugin.ListPluginsServlet; import com.google.gerrit.server.MimeUtilFileTypeRegistry; import com.google.gerrit.server.config.CanonicalWebUrl; import com.google.gerrit.server.config.GerritServerConfig; @@ -79,6 +80,7 @@ private final Cache<ResourceKey, Resource> resourceCache; private final String sshHost; private final int sshPort; + private final ListPluginsServlet listServlet; private List<Plugin> pending = Lists.newArrayList(); private String base; @@ -90,10 +92,11 @@ @CanonicalWebUrl Provider<String> webUrl, @Named(HttpPluginModule.PLUGIN_RESOURCES) Cache<ResourceKey, Resource> cache, @GerritServerConfig Config cfg, - SshInfo sshInfo) { + SshInfo sshInfo, ListPluginsServlet listServlet) { this.mimeUtil = mimeUtil; this.webUrl = webUrl; this.resourceCache = cache; + this.listServlet = listServlet; String sshHost = "review.example.com"; int sshPort = 29418; @@ -185,6 +188,10 @@ public void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String name = extractName(req); + if (name.equals("")) { + listServlet.service(req, res); + return; + } final PluginHolder holder = plugins.get(name); if (holder == null) { noCache(res);