diff options
author | Eric Anderson <eric@ericlanderson.com> | 2011-07-31 16:22:09 -0700 |
---|---|---|
committer | Eric Anderson <eric@ericlanderson.com> | 2011-08-02 11:44:47 -0700 |
commit | 713f07b1b5939206420f4151a940e00084c6612d (patch) | |
tree | 60ddaed2083a1af3aa3d402fe7b016a4bb03a097 | |
parent | f62e8a7f1d9b95821c536823c160836a93e12a40 (diff) | |
download | gerrit-713f07b1b5939206420f4151a940e00084c6612d.tar.gz |
Add rpc method for GerritConfig
The Eclipse Reviews plugin currently parses what types of reviews are possible
by parsing the javascript from a gerrit page load. This minor
improvement exposes the same information via json rpc that is provided
via the HTML.
Curl command to test:
curl --header 'Accept: application/json' --data-binary \
'{"jsonrpc":"2.0","method":"gerritConfig",id:2222}' -H 'Content-Type: \
application/json; charset=UTF-8' \
http://127.0.0.1:8080/gerrit/rpc/SystemInfoService
Bug: issue 848
Change-Id: Ie114d91073857304a234602187deee183eec4510
-rw-r--r-- | gerrit-common/src/main/java/com/google/gerrit/common/data/SystemInfoService.java | 2 | ||||
-rw-r--r-- | gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/SystemInfoServiceImpl.java | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/SystemInfoService.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/SystemInfoService.java index 3c160185..b008ee72 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/SystemInfoService.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/SystemInfoService.java @@ -34,4 +34,6 @@ public interface SystemInfoService extends RemoteJsonService { void contributorAgreements(AsyncCallback<List<ContributorAgreement>> callback); void clientError(String message, AsyncCallback<VoidResult> callback); + + public void gerritConfig(final AsyncCallback<GerritConfig> callback); } diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/SystemInfoServiceImpl.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/SystemInfoServiceImpl.java index b29f0a9b..393c44bb 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/SystemInfoServiceImpl.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/SystemInfoServiceImpl.java @@ -14,6 +14,7 @@ package com.google.gerrit.httpd.rpc; +import com.google.gerrit.common.data.GerritConfig; import com.google.gerrit.common.data.SshHostKey; import com.google.gerrit.common.data.SystemInfoService; import com.google.gerrit.reviewdb.ContributorAgreement; @@ -46,13 +47,15 @@ class SystemInfoServiceImpl implements SystemInfoService { private final SchemaFactory<ReviewDb> schema; private final List<HostKey> hostKeys; private final Provider<HttpServletRequest> httpRequest; + private final Provider<GerritConfig> config; @Inject SystemInfoServiceImpl(final SchemaFactory<ReviewDb> sf, final SshInfo daemon, - final Provider<HttpServletRequest> hsr) { + final Provider<HttpServletRequest> hsr, Provider<GerritConfig> cfg) { schema = sf; hostKeys = daemon.getHostKeys(); httpRequest = hsr; + config = cfg; } public void contributorAgreements( @@ -91,4 +94,9 @@ class SystemInfoServiceImpl implements SystemInfoService { log.error("Client UI JavaScript error: User-Agent=" + ua + ": " + message); callback.onSuccess(VoidResult.INSTANCE); } + + @Override + public void gerritConfig(final AsyncCallback<GerritConfig> callback) { + callback.onSuccess(config.get()); + } } |