diff options
author | James Moger <james.moger@gitblit.com> | 2014-05-16 13:50:59 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-07-03 16:20:37 -0400 |
commit | 1b34b05f5b8d2d0fd51819b286e22d7ddd27cb27 (patch) | |
tree | 99a983c404c4de3c5455bfa7aca89e4eb4e9bfa7 /src/main/java/com/gitblit/wicket | |
parent | 1fc1bda84e06f36a787ed84d681025e1e921c7f9 (diff) | |
download | gitblit-1b34b05f5b8d2d0fd51819b286e22d7ddd27cb27.tar.gz gitblit-1b34b05f5b8d2d0fd51819b286e22d7ddd27cb27.zip |
Embrace @Inject for Managers, Servlets, and Filters
Diffstat (limited to 'src/main/java/com/gitblit/wicket')
-rw-r--r-- | src/main/java/com/gitblit/wicket/GitBlitWebApp.java | 5 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/GitblitWicketFilter.java | 28 |
2 files changed, 22 insertions, 11 deletions
diff --git a/src/main/java/com/gitblit/wicket/GitBlitWebApp.java b/src/main/java/com/gitblit/wicket/GitBlitWebApp.java index f63ff3d9..e5b65508 100644 --- a/src/main/java/com/gitblit/wicket/GitBlitWebApp.java +++ b/src/main/java/com/gitblit/wicket/GitBlitWebApp.java @@ -21,6 +21,9 @@ import java.util.Locale; import java.util.Map; import java.util.TimeZone; +import javax.inject.Inject; +import javax.inject.Singleton; + import org.apache.wicket.Application; import org.apache.wicket.Request; import org.apache.wicket.Response; @@ -90,6 +93,7 @@ import com.gitblit.wicket.pages.TreePage; import com.gitblit.wicket.pages.UserPage; import com.gitblit.wicket.pages.UsersPage; +@Singleton public class GitBlitWebApp extends WebApplication implements GitblitWicketApp { private final Class<? extends WebPage> homePageClass = MyDashboardPage.class; @@ -120,6 +124,7 @@ public class GitBlitWebApp extends WebApplication implements GitblitWicketApp { private final IGitblit gitblit; + @Inject public GitBlitWebApp( IRuntimeManager runtimeManager, IPluginManager pluginManager, diff --git a/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java b/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java index 7865fb3b..72adbf51 100644 --- a/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java +++ b/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java @@ -17,6 +17,8 @@ package com.gitblit.wicket; import java.util.Date;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest;
import org.apache.wicket.protocol.http.IWebApplicationFactory;
@@ -28,7 +30,6 @@ import org.eclipse.jgit.revwalk.RevCommit; import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
-import com.gitblit.dagger.DaggerWicketFilter;
import com.gitblit.manager.IProjectManager;
import com.gitblit.manager.IRepositoryManager;
import com.gitblit.manager.IRuntimeManager;
@@ -37,8 +38,6 @@ import com.gitblit.models.RepositoryModel; import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
-import dagger.ObjectGraph;
-
/**
*
* Customization of the WicketFilter to allow smart browser-side caching of
@@ -47,7 +46,8 @@ import dagger.ObjectGraph; * @author James Moger
*
*/
-public class GitblitWicketFilter extends DaggerWicketFilter {
+@Singleton
+public class GitblitWicketFilter extends WicketFilter {
private IStoredSettings settings;
@@ -59,13 +59,19 @@ public class GitblitWicketFilter extends DaggerWicketFilter { private GitBlitWebApp webapp;
- @Override
- protected void inject(ObjectGraph dagger) {
- this.settings = dagger.get(IStoredSettings.class);
- this.runtimeManager = dagger.get(IRuntimeManager.class);
- this.repositoryManager = dagger.get(IRepositoryManager.class);
- this.projectManager = dagger.get(IProjectManager.class);
- this.webapp = dagger.get(GitBlitWebApp.class);
+ @Inject
+ public GitblitWicketFilter(
+ IStoredSettings settings,
+ IRuntimeManager runtimeManager,
+ IRepositoryManager repositoryManager,
+ IProjectManager projectManager,
+ GitBlitWebApp webapp) {
+
+ this.settings = settings;
+ this.runtimeManager = runtimeManager;
+ this.repositoryManager = repositoryManager;
+ this.projectManager = projectManager;
+ this.webapp = webapp;
}
@Override
|