Add top level /config REST API

/config/server/ part is hard coded for now, but we may add more
config specific resource names later.

/config/server/capabilities retrieves the known server wide
capabilities list. The list has to be loaded dynamically from
the server to permit plugins to declare their own capabilities.

Change-Id: I83692bd021925d37659bfbc88b3e3b67b92c18c1
This commit is contained in:
David Ostrovsky
2013-06-09 02:16:57 +02:00
committed by Shawn Pearce
parent 665c2a88d3
commit 28b8ea6f9e
23 changed files with 628 additions and 64 deletions

View File

@@ -27,6 +27,7 @@ import com.google.gerrit.httpd.raw.ToolServlet;
import com.google.gerrit.httpd.rpc.account.AccountsRestApiServlet;
import com.google.gerrit.httpd.rpc.change.ChangesRestApiServlet;
import com.google.gerrit.httpd.rpc.change.DeprecatedChangeQueryServlet;
import com.google.gerrit.httpd.rpc.config.ConfigRestApiServlet;
import com.google.gerrit.httpd.rpc.group.GroupsRestApiServlet;
import com.google.gerrit.httpd.rpc.project.ProjectsRestApiServlet;
import com.google.gerrit.reviewdb.client.Change;
@@ -102,6 +103,7 @@ class UrlModule extends ServletModule {
serveRegex("^/(?:a/)?tools/(.*)$").with(ToolServlet.class);
serveRegex("^/(?:a/)?accounts/(.*)$").with(AccountsRestApiServlet.class);
serveRegex("^/(?:a/)?changes/(.*)$").with(ChangesRestApiServlet.class);
serveRegex("^/(?:a/)?config/(.*)$").with(ConfigRestApiServlet.class);
serveRegex("^/(?:a/)?groups/(.*)?$").with(GroupsRestApiServlet.class);
serveRegex("^/(?:a/)?projects/(.*)?$").with(ProjectsRestApiServlet.class);

View File

@@ -0,0 +1,32 @@
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.httpd.rpc.config;
import com.google.gerrit.httpd.restapi.RestApiServlet;
import com.google.gerrit.server.config.ConfigCollection;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
@Singleton
public class ConfigRestApiServlet extends RestApiServlet {
private static final long serialVersionUID = 1L;
@Inject
ConfigRestApiServlet(RestApiServlet.Globals globals,
Provider<ConfigCollection> configCollection) {
super(globals, configCollection);
}
}