import javax.inject.Singleton;
-import org.apache.wicket.protocol.http.WebApplication;
-
import com.gitblit.git.GitServlet;
import com.gitblit.manager.AuthenticationManager;
import com.gitblit.manager.FederationManager;
federationManager);
}
- @Provides @Singleton WebApplication provideWebApplication(
+ @Provides @Singleton GitBlitWebApp provideWebApplication(
IRuntimeManager runtimeManager,
INotificationManager notificationManager,
IUserManager userManager,
federationManager,
gitblit);
}
+
+ @Provides @Singleton GitblitWicketFilter provideGitblitWicketFilter(GitBlitWebApp webapp) {
+ return new GitblitWicketFilter(webapp);
+ }
+
+ @Provides GitServlet provideGitServlet(IGitblit gitblit) {
+ return new GitServlet(gitblit);
+ }
+
+ @Provides GitFilter provideGitFilter(
+ IRuntimeManager runtimeManager,
+ IUserManager userManager,
+ IAuthenticationManager authenticationManager,
+ IRepositoryManager repositoryManager,
+ IFederationManager federationManager) {
+
+ return new GitFilter(
+ runtimeManager,
+ userManager,
+ authenticationManager,
+ repositoryManager,
+ federationManager);
+ }
+
+ @Provides @Singleton PagesServlet providePagesServlet(
+ IRuntimeManager runtimeManager,
+ IRepositoryManager repositoryManager) {
+
+ return new PagesServlet(runtimeManager, repositoryManager);
+ }
+
+ @Provides @Singleton PagesFilter providePagesFilter(
+ IRuntimeManager runtimeManager,
+ IAuthenticationManager authenticationManager,
+ IRepositoryManager repositoryManager) {
+
+ return new PagesFilter(
+ runtimeManager,
+ authenticationManager,
+ repositoryManager);
+ }
+
+ @Provides @Singleton RpcServlet provideRpcServlet(IGitblit gitblit) {
+ return new RpcServlet(gitblit);
+ }
+
+ @Provides @Singleton RpcFilter provideRpcFilter(
+ IRuntimeManager runtimeManager,
+ IAuthenticationManager authenticationManager) {
+
+ return new RpcFilter(runtimeManager, authenticationManager);
+ }
+
+ @Provides @Singleton DownloadZipServlet provideDownloadZipServlet(
+ IRuntimeManager runtimeManager,
+ IRepositoryManager repositoryManager) {
+
+ return new DownloadZipServlet(runtimeManager, repositoryManager);
+ }
+
+ @Provides @Singleton DownloadZipFilter provideDownloadZipFilter(
+ IRuntimeManager runtimeManager,
+ IAuthenticationManager authenticationManager,
+ IRepositoryManager repositoryManager) {
+
+ return new DownloadZipFilter(
+ runtimeManager,
+ authenticationManager,
+ repositoryManager);
+ }
+
+ @Provides @Singleton SyndicationServlet provideSyndicationServlet(
+ IRuntimeManager runtimeManager,
+ IRepositoryManager repositoryManager,
+ IProjectManager projectManager) {
+
+ return new SyndicationServlet(
+ runtimeManager,
+ repositoryManager,
+ projectManager);
+ }
+
+ @Provides @Singleton SyndicationFilter provideSyndicationFilter(
+ IRuntimeManager runtimeManager,
+ IAuthenticationManager authenticationManager,
+ IRepositoryManager repositoryManager,
+ IProjectManager projectManager) {
+
+ return new SyndicationFilter(
+ runtimeManager,
+ authenticationManager,
+ repositoryManager,
+ projectManager);
+ }
+
+ @Provides @Singleton FederationServlet provideFederationServlet(
+ IRuntimeManager runtimeManager,
+ IUserManager userManager,
+ IRepositoryManager repositoryManager,
+ IFederationManager federationManager) {
+
+ return new FederationServlet(
+ runtimeManager,
+ userManager,
+ repositoryManager,
+ federationManager);
+ }
+
+ @Provides @Singleton SparkleShareInviteServlet provideSparkleshareInviteServlet(
+ IRuntimeManager runtimeManager,
+ IUserManager userManager,
+ IAuthenticationManager authenticationManager,
+ IRepositoryManager repositoryManager) {
+
+ return new SparkleShareInviteServlet(
+ runtimeManager,
+ userManager,
+ authenticationManager,
+ repositoryManager);
+ }
+
+ @Provides @Singleton BranchGraphServlet provideBranchGraphServlet(
+ IRuntimeManager runtimeManager,
+ IRepositoryManager repositoryManager) {
+
+ return new BranchGraphServlet(runtimeManager, repositoryManager);
+ }
+
+ @Provides @Singleton RobotsTxtServlet provideRobotsTxtServlet(IRuntimeManager runtimeManager) {
+ return new RobotsTxtServlet(runtimeManager);
+ }
+
+ @Provides @Singleton LogoServlet provideLogoServlet(IRuntimeManager runtimeManager) {
+ return new LogoServlet(runtimeManager);
+ }
+
+ @Provides @Singleton EnforceAuthenticationFilter provideEnforceAuthenticationFilter(
+ IRuntimeManager runtimeManager,
+ IAuthenticationManager authenticationManager) {
+
+ return new EnforceAuthenticationFilter(runtimeManager, authenticationManager);
+ }
}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2013 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit.dagger;
-
-import groovy.lang.Singleton;
-
-import javax.inject.Inject;
-import javax.inject.Provider;
-
-import org.apache.wicket.protocol.http.IWebApplicationFactory;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.protocol.http.WicketFilter;
-
-/**
- *
- * A Wicket filter that supports Dagger injection.
- *
- * @author James Moger
- *
- */
-@Singleton
-public class DaggerWicketFilter extends WicketFilter {
-
- @Inject
- Provider<WebApplication> webApplicationProvider;
-
- @Inject
- public DaggerWicketFilter() {
- super();
- }
-
- @Override
- protected IWebApplicationFactory getApplicationFactory() {
- return new IWebApplicationFactory() {
- @Override
- public WebApplication createApplication(WicketFilter filter) {
- return webApplicationProvider.get();
- }
- };
- }
-}
*/\r
package com.gitblit.git;\r
\r
-import javax.inject.Inject;\r
import javax.servlet.ServletConfig;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServletRequest;\r
\r
private final IGitblit gitblit;\r
\r
- @Inject\r
public GitServlet(IGitblit gitblit) {\r
super();\r
this.gitblit = gitblit;\r
import java.util.TreeSet;\r
\r
import javax.imageio.ImageIO;\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletRequest;\r
import com.gitblit.Constants;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
-import com.gitblit.Keys.web;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.utils.JGitUtils;\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class BranchGraphServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final IRepositoryManager repositoryManager;\r
\r
- @Inject\r
public BranchGraphServlet(\r
IRuntimeManager runtimeManager,\r
IRepositoryManager repositoryManager) {\r
*/\r
package com.gitblit.servlet;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
-\r
import com.gitblit.Constants.AccessRestrictionType;\r
+import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
-import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class DownloadZipFilter extends AccessRestrictionFilter {\r
\r
- @Inject\r
public DownloadZipFilter(\r
IRuntimeManager runtimeManager,\r
IAuthenticationManager authenticationManager,\r
import java.text.ParseException;\r
import java.util.Date;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletResponse;\r
import com.gitblit.Constants;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
-import com.gitblit.Keys.web;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.utils.CompressionUtils;\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class DownloadZipServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
}\r
}\r
\r
- @Inject\r
public DownloadZipServlet(\r
IRuntimeManager runtimeManager,\r
IRepositoryManager repositoryManager) {\r
import java.io.IOException;
import java.text.MessageFormat;
-import javax.inject.Inject;
-import javax.inject.Singleton;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
-import com.gitblit.Keys.web;
-import com.gitblit.manager.IRuntimeManager;
import com.gitblit.manager.IAuthenticationManager;
+import com.gitblit.manager.IRuntimeManager;
import com.gitblit.models.UserModel;
/**
* @author Laurens Vrijnsen
*
*/
-@Singleton
public class EnforceAuthenticationFilter implements Filter {
protected transient Logger logger = LoggerFactory.getLogger(getClass());
private final IAuthenticationManager authenticationManager;
- @Inject
public EnforceAuthenticationFilter(
IRuntimeManager runtimeManager,
IAuthenticationManager authenticationManager) {
import java.util.Map;\r
import java.util.Set;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.http.HttpServletResponse;\r
\r
import com.gitblit.Constants.FederationRequest;\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class FederationServlet extends JsonServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final IFederationManager federationManager;\r
\r
- @Inject\r
public FederationServlet(\r
IRuntimeManager runtimeManager,\r
IUserManager userManager,\r
\r
import java.text.MessageFormat;\r
\r
-import javax.inject.Inject;\r
import javax.servlet.http.HttpServletRequest;\r
\r
import com.gitblit.Constants.AccessRestrictionType;\r
\r
private final IFederationManager federationManager;\r
\r
- @Inject\r
public GitFilter(\r
IRuntimeManager runtimeManager,\r
IUserManager userManager,\r
import java.io.InputStream;\r
import java.io.OutputStream;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.ServletContext;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletResponse;\r
\r
import com.gitblit.Keys;\r
-import com.gitblit.Keys.web;\r
import com.gitblit.manager.IRuntimeManager;\r
\r
/**\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class LogoServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final IRuntimeManager runtimeManager;\r
\r
- @Inject\r
public LogoServlet(IRuntimeManager runtimeManager) {\r
super();\r
this.runtimeManager = runtimeManager;\r
*/\r
package com.gitblit.servlet;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
-\r
import org.eclipse.jgit.lib.Repository;\r
\r
import com.gitblit.Constants.AccessRestrictionType;\r
+import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
-import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class PagesFilter extends AccessRestrictionFilter {\r
\r
- @Inject\r
public PagesFilter(IRuntimeManager runtimeManager,\r
IAuthenticationManager authenticationManager,\r
IRepositoryManager repositoryManager) {\r
import java.util.TreeSet;\r
\r
import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.ServletContext;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import com.gitblit.Constants;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
-import com.gitblit.Keys.web;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.models.PathModel;\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class PagesServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final IRepositoryManager repositoryManager;\r
\r
- @Inject\r
public PagesServlet(\r
IRuntimeManager runtimeManager,\r
IRepositoryManager repositoryManager) {\r
import java.io.File;\r
import java.io.IOException;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletRequest;\r
import javax.servlet.http.HttpServletResponse;\r
\r
import com.gitblit.Keys;\r
-import com.gitblit.Keys.web;\r
-import com.gitblit.Keys.web.robots;\r
import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.utils.FileUtils;\r
\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class RobotsTxtServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final IRuntimeManager runtimeManager;\r
\r
- @Inject\r
public RobotsTxtServlet(IRuntimeManager runtimeManager) {\r
super();\r
this.runtimeManager = runtimeManager;\r
import java.io.IOException;\r
import java.text.MessageFormat;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.FilterChain;\r
import javax.servlet.ServletException;\r
import javax.servlet.ServletRequest;\r
import com.gitblit.Constants.RpcRequest;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
-import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.manager.IAuthenticationManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.models.UserModel;\r
\r
/**\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class RpcFilter extends AuthenticationFilter {\r
\r
private final IStoredSettings settings;\r
\r
private final IRuntimeManager runtimeManager;\r
\r
- @Inject\r
public RpcFilter(\r
IRuntimeManager runtimeManager,\r
IAuthenticationManager authenticationManager) {\r
import java.util.List;\r
import java.util.Map;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServletRequest;\r
import javax.servlet.http.HttpServletResponse;\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class RpcServlet extends JsonServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final IGitblit gitblit;\r
\r
- @Inject\r
public RpcServlet(IGitblit gitblit) {\r
\r
super();\r
import java.io.IOException;\r
import java.text.MessageFormat;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletRequest;\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class SparkleShareInviteServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final IRepositoryManager repositoryManager;\r
\r
- @Inject\r
public SparkleShareInviteServlet(\r
IRuntimeManager runtimeManager,\r
IUserManager userManager,\r
import java.io.IOException;\r
import java.text.MessageFormat;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.FilterChain;\r
import javax.servlet.ServletException;\r
import javax.servlet.ServletRequest;\r
import javax.servlet.http.HttpServletResponse;\r
\r
import com.gitblit.Constants.AccessRestrictionType;\r
+import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.manager.IProjectManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
-import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.models.ProjectModel;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class SyndicationFilter extends AuthenticationFilter {\r
\r
private final IRuntimeManager runtimeManager;\r
private final IRepositoryManager repositoryManager;\r
private final IProjectManager projectManager;\r
\r
- @Inject\r
public SyndicationFilter(\r
IRuntimeManager runtimeManager,\r
IAuthenticationManager authenticationManager,\r
import java.util.List;\r
import java.util.Map;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.http.HttpServlet;\r
\r
import org.eclipse.jgit.lib.ObjectId;\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
public class SyndicationServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final IProjectManager projectManager;\r
\r
- @Inject\r
public SyndicationServlet(\r
IRuntimeManager runtimeManager,\r
IRepositoryManager repositoryManager,\r
\r
import java.util.Date;\r
\r
-import javax.inject.Inject;\r
-import javax.inject.Singleton;\r
import javax.servlet.http.HttpServletRequest;\r
\r
+import org.apache.wicket.protocol.http.IWebApplicationFactory;\r
+import org.apache.wicket.protocol.http.WebApplication;\r
+import org.apache.wicket.protocol.http.WicketFilter;\r
import org.apache.wicket.util.string.Strings;\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerWicketFilter;\r
import com.gitblit.manager.IProjectManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
* @author James Moger\r
*\r
*/\r
-@Singleton\r
-public class GitblitWicketFilter extends DaggerWicketFilter {\r
+public class GitblitWicketFilter extends WicketFilter {\r
\r
private final IStoredSettings settings;\r
\r
\r
private final IProjectManager projectManager;\r
\r
- @Inject\r
- public GitblitWicketFilter(\r
- IRuntimeManager runtimeManager,\r
- IRepositoryManager repositoryManager,\r
- IProjectManager projectManager) {\r
+ private final GitBlitWebApp webapp;\r
+\r
+ public GitblitWicketFilter(GitBlitWebApp webapp) {\r
\r
super();\r
- this.settings = runtimeManager.getSettings();\r
- this.runtimeManager = runtimeManager;\r
- this.repositoryManager = repositoryManager;\r
- this.projectManager = projectManager;\r
+ this.settings = webapp.settings();\r
+ this.runtimeManager = webapp.runtime();\r
+ this.repositoryManager = webapp.repositories();\r
+ this.projectManager = webapp.projects();\r
+ this.webapp = webapp;\r
+ }\r
+\r
+ @Override\r
+ protected IWebApplicationFactory getApplicationFactory() {\r
+ return new IWebApplicationFactory() {\r
+ @Override\r
+ public WebApplication createApplication(WicketFilter filter) {\r
+ return webapp;\r
+ }\r
+ };\r
}\r
\r
/**\r