diff options
Diffstat (limited to 'src/main/java/com/gitblit/git/GitServlet.java')
-rw-r--r-- | src/main/java/com/gitblit/git/GitServlet.java | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/main/java/com/gitblit/git/GitServlet.java b/src/main/java/com/gitblit/git/GitServlet.java index 23ea3434..e4719d9b 100644 --- a/src/main/java/com/gitblit/git/GitServlet.java +++ b/src/main/java/com/gitblit/git/GitServlet.java @@ -15,12 +15,16 @@ */
package com.gitblit.git;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
-import com.gitblit.GitBlit;
import com.gitblit.manager.IRepositoryManager;
+import com.gitblit.manager.IRuntimeManager;
+import com.gitblit.manager.ISessionManager;
+import com.gitblit.manager.IUserManager;
/**
* The GitServlet provides http/https access to Git repositories.
@@ -29,19 +33,37 @@ import com.gitblit.manager.IRepositoryManager; * @author James Moger
*
*/
+@Singleton
public class GitServlet extends org.eclipse.jgit.http.server.GitServlet {
private static final long serialVersionUID = 1L;
- public GitServlet() {
+ private final IRuntimeManager runtimeManager;
+
+ private final IUserManager userManager;
+
+ private final ISessionManager sessionManager;
+
+ private final IRepositoryManager repositoryManager;
+
+ @Inject
+ public GitServlet(
+ IRuntimeManager runtimeManager,
+ IUserManager userManager,
+ ISessionManager sessionManager,
+ IRepositoryManager repositoryManager) {
+ super();
+ this.runtimeManager = runtimeManager;
+ this.userManager = userManager;
+ this.sessionManager = sessionManager;
+ this.repositoryManager = repositoryManager;
}
@Override
public void init(ServletConfig config) throws ServletException {
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);
- setRepositoryResolver(new RepositoryResolver<HttpServletRequest>(repositoryManager.getRepositoriesFolder()));
- setUploadPackFactory(new GitblitUploadPackFactory<HttpServletRequest>());
- setReceivePackFactory(new GitblitReceivePackFactory<HttpServletRequest>());
+ setRepositoryResolver(new RepositoryResolver<HttpServletRequest>(sessionManager, repositoryManager));
+ setUploadPackFactory(new GitblitUploadPackFactory<HttpServletRequest>(sessionManager));
+ setReceivePackFactory(new GitblitReceivePackFactory<HttpServletRequest>(runtimeManager, userManager, repositoryManager));
super.init(config);
}
}
|