Bind WebUiPlugins in Module instead of HttpModule
Gerrit core needs to inject WebUiPlugins in the server layer now and
hence WebUiPlugins must be bound in the system module to be available.
Change-Id: Iddbb13514782bca8d9127a0784d1dbdb32e9470c
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/cookbook/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/cookbook/HttpModule.java
index 5df7a2b..ab85671 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/cookbook/HttpModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/cookbook/HttpModule.java
@@ -14,25 +14,11 @@
package com.googlesource.gerrit.plugins.cookbook;
-import com.google.gerrit.extensions.registration.DynamicSet;
-import com.google.gerrit.extensions.webui.GwtPlugin;
-import com.google.gerrit.extensions.webui.JavaScriptPlugin;
-import com.google.gerrit.extensions.webui.WebUiPlugin;
import com.google.gerrit.httpd.plugins.HttpPluginModule;
public class HttpModule extends HttpPluginModule {
@Override
protected void configureServlets() {
serve("/say-hello/*").with(HelloWorldServlet.class);
- DynamicSet.bind(binder(), WebUiPlugin.class)
- .toInstance(new JavaScriptPlugin("greetings.js"));
- DynamicSet.bind(binder(), WebUiPlugin.class)
- .toInstance(new JavaScriptPlugin("hello-change.js"));
- DynamicSet.bind(binder(), WebUiPlugin.class)
- .toInstance(new JavaScriptPlugin("hello-project.js"));
- DynamicSet.bind(binder(), WebUiPlugin.class)
- .toInstance(new JavaScriptPlugin("hello-revision.js"));
- DynamicSet.bind(binder(), WebUiPlugin.class)
- .toInstance(new GwtPlugin("cookbook"));
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/cookbook/Module.java b/src/main/java/com/googlesource/gerrit/plugins/cookbook/Module.java
index 61f6375..1b54a09 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/cookbook/Module.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/cookbook/Module.java
@@ -27,9 +27,12 @@
import com.google.gerrit.extensions.restapi.RestApiModule;
import com.google.gerrit.extensions.webui.BranchWebLink;
import com.google.gerrit.extensions.webui.FileHistoryWebLink;
+import com.google.gerrit.extensions.webui.GwtPlugin;
+import com.google.gerrit.extensions.webui.JavaScriptPlugin;
import com.google.gerrit.extensions.webui.PatchSetWebLink;
import com.google.gerrit.extensions.webui.ProjectWebLink;
import com.google.gerrit.extensions.webui.TopMenu;
+import com.google.gerrit.extensions.webui.WebUiPlugin;
import com.google.gerrit.server.config.ProjectConfigEntry;
import com.google.gerrit.server.git.validators.CommitValidationListener;
import com.google.gerrit.server.git.validators.MergeValidationListener;
@@ -80,6 +83,17 @@
bind(ChangeOperatorFactory.class)
.annotatedWith(Exports.named("sample"))
.to(SampleOperator.class);
+
+ DynamicSet.bind(binder(), WebUiPlugin.class)
+ .toInstance(new JavaScriptPlugin("greetings.js"));
+ DynamicSet.bind(binder(), WebUiPlugin.class)
+ .toInstance(new JavaScriptPlugin("hello-change.js"));
+ DynamicSet.bind(binder(), WebUiPlugin.class)
+ .toInstance(new JavaScriptPlugin("hello-project.js"));
+ DynamicSet.bind(binder(), WebUiPlugin.class)
+ .toInstance(new JavaScriptPlugin("hello-revision.js"));
+ DynamicSet.bind(binder(), WebUiPlugin.class)
+ .toInstance(new GwtPlugin("cookbook"));
}
private void configurePluginParameters() {