Support AcceptsPost on non top level REST collections

Change-Id: I67a7c62beb3125cda968cc84c92cdd6f8a46a6f4
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java
index c43a8ba..568c492 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java
@@ -820,6 +820,14 @@
     RestView<RestResource> core = views.get("gerrit", name);
     if (core != null) {
       return new ViewData(null, core);
+    } else {
+      name = "GET." + p.get(0);
+      core = views.get("gerrit", name);
+      if (core instanceof AcceptsPost && "POST".equals(method)) {
+        @SuppressWarnings("unchecked")
+        AcceptsPost<RestResource> ap = (AcceptsPost<RestResource>) core;
+        return new ViewData(null, ap.post(rsrc));
+      }
     }
 
     Map<String, RestView<RestResource>> r = Maps.newTreeMap();