*
*/
@Module(
- library = true,
injects = {
IStoredSettings.class,
return new FileSettings();
}
- @Provides @Singleton IRuntimeManager provideRuntimeManager(IStoredSettings settings) {
- return new RuntimeManager(settings);
+ @Provides @Singleton IRuntimeManager provideRuntimeManager(RuntimeManager manager) {
+ return manager;
}
- @Provides @Singleton IPluginManager providePluginManager(IRuntimeManager runtimeManager) {
- return new PluginManager(runtimeManager);
+ @Provides @Singleton IPluginManager providePluginManager(PluginManager manager) {
+ return manager;
}
- @Provides @Singleton INotificationManager provideNotificationManager(IStoredSettings settings) {
- return new NotificationManager(settings);
+ @Provides @Singleton INotificationManager provideNotificationManager(NotificationManager manager) {
+ return manager;
}
- @Provides @Singleton IUserManager provideUserManager(
- IRuntimeManager runtimeManager,
- IPluginManager pluginManager) {
-
- return new UserManager(runtimeManager, pluginManager);
+ @Provides @Singleton IUserManager provideUserManager(UserManager manager) {
+ return manager;
}
- @Provides @Singleton IAuthenticationManager provideAuthenticationManager(
- IRuntimeManager runtimeManager,
- IUserManager userManager) {
-
- return new AuthenticationManager(
- runtimeManager,
- userManager);
+ @Provides @Singleton IAuthenticationManager provideAuthenticationManager(AuthenticationManager manager) {
+ return manager;
}
@Provides @Singleton IPublicKeyManager providePublicKeyManager(
}
}
- @Provides @Singleton IRepositoryManager provideRepositoryManager(
- IRuntimeManager runtimeManager,
- IPluginManager pluginManager,
- IUserManager userManager) {
-
- return new RepositoryManager(
- runtimeManager,
- pluginManager,
- userManager);
- }
-
- @Provides @Singleton IProjectManager provideProjectManager(
- IRuntimeManager runtimeManager,
- IUserManager userManager,
- IRepositoryManager repositoryManager) {
-
- return new ProjectManager(
- runtimeManager,
- userManager,
- repositoryManager);
- }
-
- @Provides @Singleton IFederationManager provideFederationManager(
- IRuntimeManager runtimeManager,
- INotificationManager notificationManager,
- IRepositoryManager repositoryManager) {
-
- return new FederationManager(
- runtimeManager,
- notificationManager,
- repositoryManager);
- }
-
- @Provides @Singleton IGitblit provideGitblit(
- IRuntimeManager runtimeManager,
- IPluginManager pluginManager,
- INotificationManager notificationManager,
- IUserManager userManager,
- IAuthenticationManager authenticationManager,
- IPublicKeyManager publicKeyManager,
- IRepositoryManager repositoryManager,
- IProjectManager projectManager,
- IFederationManager federationManager) {
-
- return new GitBlit(
- runtimeManager,
- pluginManager,
- notificationManager,
- userManager,
- authenticationManager,
- publicKeyManager,
- repositoryManager,
- projectManager,
- federationManager);
- }
-
- @Provides @Singleton GitBlitWebApp provideWebApplication(
- IRuntimeManager runtimeManager,
- IPluginManager pluginManager,
- INotificationManager notificationManager,
- IUserManager userManager,
- IAuthenticationManager authenticationManager,
- IPublicKeyManager publicKeyManager,
- IRepositoryManager repositoryManager,
- IProjectManager projectManager,
- IFederationManager federationManager,
- IGitblit gitblit) {
-
- return new GitBlitWebApp(
- runtimeManager,
- pluginManager,
- notificationManager,
- userManager,
- authenticationManager,
- publicKeyManager,
- repositoryManager,
- projectManager,
- 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);
-// }
-
-
- @Provides @Singleton GitblitWicketFilter provideGitblitWicketFilter(GitBlitWebApp webapp) {
- return new GitblitWicketFilter();
+ @Provides @Singleton IRepositoryManager provideRepositoryManager(RepositoryManager manager) {
+ return manager;
}
- @Provides GitServlet provideGitServlet(IGitblit gitblit) {
- return new GitServlet();
+ @Provides @Singleton IProjectManager provideProjectManager(ProjectManager manager) {
+ return manager;
}
- @Provides GitFilter provideGitFilter(
- IRuntimeManager runtimeManager,
- IUserManager userManager,
- IAuthenticationManager authenticationManager,
- IRepositoryManager repositoryManager,
- IFederationManager federationManager) {
-
- return new GitFilter();
- }
-
- @Provides @Singleton RawServlet provideRawServlet(
- IRuntimeManager runtimeManager,
- IRepositoryManager repositoryManager) {
-
- return new RawServlet();
+ @Provides @Singleton IFederationManager provideFederationManager(FederationManager manager) {
+ return manager;
}
- @Provides @Singleton RawFilter provideRawFilter(
- IRuntimeManager runtimeManager,
- IAuthenticationManager authenticationManager,
- IRepositoryManager repositoryManager) {
-
- return new RawFilter();
- }
-
- @Provides @Singleton PagesServlet providePagesServlet(
- IRuntimeManager runtimeManager,
- IRepositoryManager repositoryManager) {
-
- return new PagesServlet();
- }
-
- @Provides @Singleton PagesFilter providePagesFilter(
- IRuntimeManager runtimeManager,
- IAuthenticationManager authenticationManager,
- IRepositoryManager repositoryManager) {
-
- return new PagesFilter();
- }
-
- @Provides @Singleton RpcServlet provideRpcServlet(IGitblit gitblit) {
- return new RpcServlet();
- }
-
- @Provides @Singleton RpcFilter provideRpcFilter(
- IRuntimeManager runtimeManager,
- IAuthenticationManager authenticationManager) {
-
- return new RpcFilter();
- }
-
- @Provides @Singleton DownloadZipServlet provideDownloadZipServlet(
- IRuntimeManager runtimeManager,
- IRepositoryManager repositoryManager) {
-
- return new DownloadZipServlet();
- }
-
- @Provides @Singleton DownloadZipFilter provideDownloadZipFilter(
- IRuntimeManager runtimeManager,
- IAuthenticationManager authenticationManager,
- IRepositoryManager repositoryManager) {
-
- return new DownloadZipFilter();
- }
-
- @Provides @Singleton SyndicationServlet provideSyndicationServlet(
- IRuntimeManager runtimeManager,
- IRepositoryManager repositoryManager,
- IProjectManager projectManager) {
-
- return new SyndicationServlet();
- }
-
- @Provides @Singleton SyndicationFilter provideSyndicationFilter(
- IRuntimeManager runtimeManager,
- IAuthenticationManager authenticationManager,
- IRepositoryManager repositoryManager,
- IProjectManager projectManager) {
-
- return new SyndicationFilter();
- }
-
- @Provides @Singleton FederationServlet provideFederationServlet(
- IRuntimeManager runtimeManager,
- IUserManager userManager,
- IRepositoryManager repositoryManager,
- IFederationManager federationManager) {
-
- return new FederationServlet();
- }
-
- @Provides @Singleton SparkleShareInviteServlet provideSparkleshareInviteServlet(
- IRuntimeManager runtimeManager,
- IUserManager userManager,
- IAuthenticationManager authenticationManager,
- IRepositoryManager repositoryManager) {
-
- return new SparkleShareInviteServlet();
- }
-
- @Provides @Singleton BranchGraphServlet provideBranchGraphServlet(
- IRuntimeManager runtimeManager,
- IRepositoryManager repositoryManager) {
-
- return new BranchGraphServlet();
- }
-
- @Provides @Singleton RobotsTxtServlet provideRobotsTxtServlet(IRuntimeManager runtimeManager) {
- return new RobotsTxtServlet();
- }
-
- @Provides @Singleton LogoServlet provideLogoServlet(IRuntimeManager runtimeManager) {
- return new LogoServlet();
- }
-
- @Provides @Singleton PtServlet providePtServlet(IRuntimeManager runtimeManager) {
- return new PtServlet();
- }
-
- @Provides @Singleton ProxyFilter provideProxyFilter(
- IRuntimeManager runtimeManager,
- IAuthenticationManager authenticationManager) {
-
- return new ProxyFilter();
- }
-
- @Provides @Singleton EnforceAuthenticationFilter provideEnforceAuthenticationFilter(
- IRuntimeManager runtimeManager,
- IAuthenticationManager authenticationManager) {
-
- return new EnforceAuthenticationFilter();
+ @Provides @Singleton IGitblit provideGitblit(GitBlit gitblit) {
+ return gitblit;
}
}
\ No newline at end of file
import java.util.List;
import java.util.Set;
+import javax.inject.Inject;
import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest;
private ITicketService ticketService;
+ @Inject
public GitBlit(
IRuntimeManager runtimeManager,
IPluginManager pluginManager,
+++ /dev/null
-/*\r
- * Copyright 2013 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.dagger;\r
-\r
-import javax.servlet.FilterConfig;\r
-import javax.servlet.ServletContext;\r
-import javax.servlet.ServletException;\r
-\r
-import org.apache.wicket.protocol.http.WicketFilter;\r
-\r
-import dagger.ObjectGraph;\r
-\r
-/**\r
- * Uses Dagger to manually inject dependencies into a Wicket filter.\r
- * This class is useful for servlet containers that offer CDI and are\r
- * confused by Dagger.\r
- *\r
- * @author James Moger\r
- *\r
- */\r
-public abstract class DaggerWicketFilter extends WicketFilter {\r
-\r
- @Override\r
- public final void init(FilterConfig filterConfig) throws ServletException {\r
- ServletContext context = filterConfig.getServletContext();\r
- ObjectGraph objectGraph = (ObjectGraph) context.getAttribute(DaggerContext.INJECTOR_NAME);\r
- inject(objectGraph);\r
- super.init(filterConfig);\r
- }\r
-\r
- protected abstract void inject(ObjectGraph dagger);\r
-}\r
import java.util.Map;
import java.util.concurrent.TimeUnit;
+import javax.inject.Inject;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
private final Map<String, String> legacyRedirects;
+ @Inject
public AuthenticationManager(
IRuntimeManager runtimeManager,
IUserManager userManager) {
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
private final IRepositoryManager repositoryManager;
+ @Inject
public FederationManager(
IRuntimeManager runtimeManager,
INotificationManager notificationManager,
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import javax.inject.Inject;
import javax.mail.Message;
import org.slf4j.Logger;
private final MailService mailService;
+ @Inject
public NotificationManager(IStoredSettings settings) {
this.settings = settings;
this.mailService = new MailService(settings);
import java.util.Map;
import java.util.TreeMap;
+import javax.inject.Inject;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private int readTimeout = 12800;
+ @Inject
public PluginManager(IRuntimeManager runtimeManager) {
File dir = runtimeManager.getFileOrFolder(Keys.plugins.folder, "${baseFolder}/plugins");
dir.mkdirs();
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
+import javax.inject.Inject;
+
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.util.FS;
import org.slf4j.Logger;
private FileBasedConfig projectConfigs;
+ @Inject
public ProjectManager(
IRuntimeManager runtimeManager,
IUserManager userManager,
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
+import javax.inject.Inject;
+
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
import org.eclipse.jgit.lib.RepositoryCache.FileKey;
private MirrorService mirrorExecutor;
+ @Inject
public RepositoryManager(
IRuntimeManager runtimeManager,
IPluginManager pluginManager,
import java.util.Map;
import java.util.TimeZone;
+import javax.inject.Inject;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private TimeZone timezone;
+ @Inject
public RuntimeManager(IStoredSettings settings) {
this(settings, null);
}
import java.util.List;
import java.util.Map;
+import javax.inject.Inject;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private IUserService userService;
+ @Inject
public UserManager(IRuntimeManager runtimeManager, IPluginManager pluginManager) {
this.settings = runtimeManager.getSettings();
this.runtimeManager = runtimeManager;
import java.text.MessageFormat;\r
\r
import javax.servlet.FilterChain;\r
-import javax.servlet.FilterConfig;\r
import javax.servlet.ServletException;\r
import javax.servlet.ServletRequest;\r
import javax.servlet.ServletResponse;\r
import javax.servlet.http.HttpServletRequest;\r
import javax.servlet.http.HttpServletResponse;\r
\r
+import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.StringUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* The AccessRestrictionFilter is an AuthenticationFilter that confirms that the\r
* requested repository can be accessed by the anonymous or named user.\r
\r
protected IRepositoryManager repositoryManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
- super.inject(dagger, filterConfig);\r
- this.runtimeManager = dagger.get(IRuntimeManager.class);\r
- this.repositoryManager = dagger.get(IRepositoryManager.class);\r
+ protected AccessRestrictionFilter(\r
+ IRuntimeManager runtimeManager,\r
+ IAuthenticationManager authenticationManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
+ super(authenticationManager);\r
+\r
+ this.runtimeManager = runtimeManager;\r
+ this.repositoryManager = repositoryManager;\r
}\r
\r
/**\r
import java.util.HashMap;\r
import java.util.Map;\r
\r
+import javax.servlet.Filter;\r
import javax.servlet.FilterChain;\r
import javax.servlet.FilterConfig;\r
import javax.servlet.ServletException;\r
import org.slf4j.LoggerFactory;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.dagger.DaggerFilter;\r
import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.DeepCopier;\r
import com.gitblit.utils.StringUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* The AuthenticationFilter is a servlet filter that preprocesses requests that\r
* match its url pattern definition in the web.xml file.\r
* @author James Moger\r
*\r
*/\r
-public abstract class AuthenticationFilter extends DaggerFilter {\r
+public abstract class AuthenticationFilter implements Filter {\r
\r
protected static final String CHALLENGE = "Basic realm=\"" + Constants.NAME + "\"";\r
\r
\r
protected IAuthenticationManager authenticationManager;\r
\r
+ protected AuthenticationFilter(IAuthenticationManager authenticationManager) {\r
+ this.authenticationManager = authenticationManager;\r
+ }\r
+\r
+ @Override\r
+ public void init(FilterConfig filterConfig) throws ServletException {\r
+ }\r
+\r
@Override\r
- protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
- this.authenticationManager = dagger.get(IAuthenticationManager.class);\r
+ public void destroy() {\r
}\r
\r
/**\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 javax.servlet.http.HttpServletResponse;\r
\r
import com.gitblit.Constants;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* Handles requests for branch graphs\r
*\r
* @author James Moger\r
*\r
*/\r
-public class BranchGraphServlet extends DaggerServlet {\r
+@Singleton\r
+public class BranchGraphServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
\r
private IRepositoryManager repositoryManager;\r
\r
- public BranchGraphServlet() {\r
- super();\r
+ @Inject\r
+ public BranchGraphServlet(\r
+ IStoredSettings settings,\r
+ IRepositoryManager repositoryManager) {\r
+\r
+ this.settings = settings;\r
+ this.repositoryManager = repositoryManager;\r
+\r
strokeCache = new Stroke[4];\r
for (int i = 1; i < strokeCache.length; i++) {\r
strokeCache[i] = new BasicStroke(i);\r
}\r
}\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.settings = dagger.get(IStoredSettings.class);\r
- this.repositoryManager = dagger.get(IRepositoryManager.class);\r
- }\r
-\r
/**\r
* Returns an url to this servlet for the specified parameters.\r
*\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.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
+ IRepositoryManager repositoryManager) {\r
+\r
+ super(runtimeManager, authenticationManager, repositoryManager);\r
+ }\r
+\r
/**\r
* Extract the repository name from the url.\r
*\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
\r
import org.eclipse.jgit.lib.Repository;\r
import com.gitblit.Constants;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.utils.CompressionUtils;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.MarkdownUtils;\r
import com.gitblit.utils.StringUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* Streams out a zip file from the specified repository for any tree path at any\r
* revision.\r
* @author James Moger\r
*\r
*/\r
-public class DownloadZipServlet extends DaggerServlet {\r
+@Singleton\r
+public class DownloadZipServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
}\r
}\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.settings = dagger.get(IStoredSettings.class);\r
- this.repositoryManager = dagger.get(IRepositoryManager.class);\r
+ @Inject\r
+ public DownloadZipServlet(IStoredSettings settings, IRepositoryManager repositoryManager) {\r
+ this.settings = settings;\r
+ this.repositoryManager = repositoryManager;\r
}\r
\r
/**\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 javax.servlet.ServletException;
import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
-import com.gitblit.dagger.DaggerFilter;
import com.gitblit.manager.IAuthenticationManager;
import com.gitblit.models.UserModel;
-import dagger.ObjectGraph;
-
/**
* This filter enforces authentication via HTTP Basic Authentication, if the settings indicate so.
* It looks at the settings "web.authenticateViewPages" and "web.enforceHttpBasicAuthentication"; if
* @author Laurens Vrijnsen
*
*/
-public class EnforceAuthenticationFilter extends DaggerFilter {
+@Singleton
+public class EnforceAuthenticationFilter implements Filter {
protected transient Logger logger = LoggerFactory.getLogger(getClass());
private IAuthenticationManager authenticationManager;
+ @Inject
+ public EnforceAuthenticationFilter(
+ IStoredSettings settings,
+ IAuthenticationManager authenticationManager) {
+
+ this.settings = settings;
+ this.authenticationManager = authenticationManager;
+ }
+
@Override
- protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {
- this.settings = dagger.get(IStoredSettings.class);
- this.authenticationManager = dagger.get(IAuthenticationManager.class);
+ public void init(FilterConfig config) {
+ }
+
+ @Override
+ public void destroy() {
}
/*
chain.doFilter(request, response);
}
}
-
-
- /*
- * @see javax.servlet.Filter#destroy()
- */
- @Override
- public void destroy() {
- }
}
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
import com.gitblit.utils.StringUtils;\r
import com.gitblit.utils.TimeUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* Handles federation requests.\r
*\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 IFederationManager federationManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.settings = dagger.get(IStoredSettings.class);\r
- this.userManager = dagger.get(IUserManager.class);\r
- this.repositoryManager = dagger.get(IRepositoryManager.class);\r
- this.federationManager = dagger.get(IFederationManager.class);\r
+ @Inject\r
+ public FederationServlet(\r
+ IStoredSettings settings,\r
+ IUserManager userManager,\r
+ IRepositoryManager repositoryManager,\r
+ IFederationManager federationManager) {\r
+\r
+ this.settings = settings;\r
+ this.userManager = userManager;\r
+ this.repositoryManager = repositoryManager;\r
+ this.federationManager = federationManager;\r
}\r
\r
/**\r
\r
import java.text.MessageFormat;\r
\r
-import javax.servlet.FilterConfig;\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.http.HttpServletRequest;\r
\r
import com.gitblit.Constants.AccessRestrictionType;\r
import com.gitblit.GitBlitException;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
+import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.manager.IFederationManager;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.StringUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* The GitFilter is an AccessRestrictionFilter which ensures that Git client\r
* requests for push, clone, or view restricted repositories are authenticated\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class GitFilter extends AccessRestrictionFilter {\r
\r
protected static final String gitReceivePack = "/git-receive-pack";\r
\r
private IFederationManager federationManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
- super.inject(dagger, filterConfig);\r
- this.settings = dagger.get(IStoredSettings.class);\r
- this.federationManager = dagger.get(IFederationManager.class);\r
+ @Inject\r
+ public GitFilter(\r
+ IStoredSettings settings,\r
+ IRuntimeManager runtimeManager,\r
+ IAuthenticationManager authenticationManager,\r
+ IRepositoryManager repositoryManager,\r
+ IFederationManager federationManager) {\r
+\r
+ super(runtimeManager, authenticationManager, repositoryManager);\r
+\r
+ this.settings = settings;\r
+ this.federationManager = federationManager;\r
}\r
\r
/**\r
import java.io.IOException;\r
import java.util.Enumeration;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.FilterChain;\r
import javax.servlet.FilterConfig;\r
import javax.servlet.ServletConfig;\r
\r
import org.eclipse.jgit.http.server.GitFilter;\r
\r
-import com.gitblit.dagger.DaggerContext;\r
import com.gitblit.git.GitblitReceivePackFactory;\r
import com.gitblit.git.GitblitUploadPackFactory;\r
import com.gitblit.git.RepositoryResolver;\r
import com.gitblit.manager.IGitblit;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* The GitServlet provides http/https access to Git repositories.\r
* Access to this servlet is protected by the GitFilter.\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class GitServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final GitFilter gitFilter;\r
\r
- public GitServlet() {\r
+ @Inject\r
+ public GitServlet(IGitblit gitblit) {\r
gitFilter = new GitFilter();\r
+ gitFilter.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>(gitblit));\r
+ gitFilter.setUploadPackFactory(new GitblitUploadPackFactory<HttpServletRequest>(gitblit));\r
+ gitFilter.setReceivePackFactory(new GitblitReceivePackFactory<HttpServletRequest>(gitblit));\r
}\r
\r
@Override\r
public void init(final ServletConfig config) throws ServletException {\r
- ServletContext context = config.getServletContext();\r
- ObjectGraph dagger = (ObjectGraph) context.getAttribute(DaggerContext.INJECTOR_NAME);\r
- IGitblit gitblit = dagger.get(IGitblit.class);\r
- gitFilter.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>(gitblit));\r
- gitFilter.setUploadPackFactory(new GitblitUploadPackFactory<HttpServletRequest>(gitblit));\r
- gitFilter.setReceivePackFactory(new GitblitReceivePackFactory<HttpServletRequest>(gitblit));\r
\r
gitFilter.init(new FilterConfig() {\r
@Override\r
import java.text.MessageFormat;\r
\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 org.slf4j.LoggerFactory;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.dagger.DaggerServlet;\r
import com.gitblit.utils.JsonUtils;\r
import com.gitblit.utils.StringUtils;\r
\r
* @author James Moger\r
*\r
*/\r
-public abstract class JsonServlet extends DaggerServlet {\r
+public abstract class JsonServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\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.HttpServletRequest;\r
import javax.servlet.http.HttpServletResponse;\r
\r
import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
import com.gitblit.manager.IRuntimeManager;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* Handles requests for logo.png\r
*\r
* @author James Moger\r
*\r
*/\r
-public class LogoServlet extends DaggerServlet {\r
+@Singleton\r
+public class LogoServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
\r
private IRuntimeManager runtimeManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.runtimeManager = dagger.get(IRuntimeManager.class);\r
+ @Inject\r
+ public LogoServlet(IRuntimeManager runtimeManager) {\r
+ this.runtimeManager = runtimeManager;\r
}\r
\r
@Override\r
*/\r
package com.gitblit.servlet;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
+\r
+import com.gitblit.manager.IAuthenticationManager;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
+\r
\r
/**\r
* The PagesFilter is an AccessRestrictionFilter which ensures the gh-pages\r
* @author James Moger\r
*\r
*/\r
+\r
+@Singleton\r
public class PagesFilter extends RawFilter {\r
\r
+ @Inject\r
+ public PagesFilter(\r
+ IRuntimeManager runtimeManager,\r
+ IAuthenticationManager authenticationManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
+ super(runtimeManager, authenticationManager, repositoryManager);\r
+ }\r
\r
}\r
*/\r
package com.gitblit.servlet;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.http.HttpServletRequest;\r
import javax.servlet.http.HttpServletResponse;\r
\r
import com.gitblit.Constants;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
\r
/**\r
* Serves the content of a gh-pages branch.\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class PagesServlet extends RawServlet {\r
\r
private static final long serialVersionUID = 1L;\r
return baseURL + Constants.PAGES + repository + "/" + (path == null ? "" : ("/" + path));\r
}\r
\r
+ @Inject\r
+ public PagesServlet(\r
+ IRuntimeManager runtimeManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
+ super(runtimeManager, repositoryManager);\r
+ }\r
+\r
@Override\r
protected String getBranch(String repository, HttpServletRequest request) {\r
return "gh-pages";\r
package com.gitblit.servlet;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import ro.fortsoft.pf4j.PluginWrapper;
-import com.gitblit.dagger.DaggerFilter;
import com.gitblit.extensions.HttpRequestFilter;
import com.gitblit.manager.IPluginManager;
import com.gitblit.manager.IRuntimeManager;
-import dagger.ObjectGraph;
-
/**
* A request filter than allows registered extension request filters to access
* request data. The intended purpose is for server monitoring plugins.
* @author David Ostrovsky
* @since 1.6.0
*/
-public class ProxyFilter extends DaggerFilter {
- private List<HttpRequestFilter> filters;
+@Singleton
+public class ProxyFilter implements Filter {
+ private final IRuntimeManager runtimeManager;
+
+ private final IPluginManager pluginManager;
+
+ private final List<HttpRequestFilter> filters;
+
+ @Inject
+ public ProxyFilter(
+ IRuntimeManager runtimeManager,
+ IPluginManager pluginManager) {
+
+ this.runtimeManager = runtimeManager;
+ this.pluginManager = pluginManager;
+ this.filters = new ArrayList<>();
+
+ }
@Override
- protected void inject(ObjectGraph dagger, FilterConfig filterConfig) throws ServletException {
- IRuntimeManager runtimeManager = dagger.get(IRuntimeManager.class);
- IPluginManager pluginManager = dagger.get(IPluginManager.class);
+ public void init(FilterConfig filterConfig) throws ServletException {
- filters = pluginManager.getExtensions(HttpRequestFilter.class);
+ filters.addAll(pluginManager.getExtensions(HttpRequestFilter.class));
for (HttpRequestFilter f : filters) {
// wrap the filter config for Gitblit settings retrieval
PluginWrapper pluginWrapper = pluginManager.whichPlugin(f.getClass());
import java.io.InputStream;\r
import java.io.OutputStream;\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 org.apache.wicket.util.io.ByteArrayOutputStream;\r
import org.eclipse.jgit.lib.FileMode;\r
\r
-import com.gitblit.dagger.DaggerServlet;\r
import com.gitblit.manager.IRuntimeManager;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* Handles requests for the Barnum pt (patchset tool).\r
*\r
* @author James Moger\r
*\r
*/\r
-public class PtServlet extends DaggerServlet {\r
+@Singleton\r
+public class PtServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
\r
private IRuntimeManager runtimeManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.runtimeManager = dagger.get(IRuntimeManager.class);\r
+ @Inject\r
+ public PtServlet(IRuntimeManager runtimeManager) {\r
+ this.runtimeManager = runtimeManager;\r
}\r
\r
@Override\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.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class RawFilter extends AccessRestrictionFilter {\r
\r
+ @Inject\r
+ public RawFilter(\r
+ IRuntimeManager runtimeManager,\r
+ IAuthenticationManager authenticationManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
+ super(runtimeManager, authenticationManager, repositoryManager);\r
+ }\r
+\r
/**\r
* Extract the repository name from the url.\r
*\r
import java.util.Map;
import java.util.TreeMap;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.gitblit.Constants;
import com.gitblit.Keys;
-import com.gitblit.dagger.DaggerServlet;
import com.gitblit.manager.IRepositoryManager;
import com.gitblit.manager.IRuntimeManager;
import com.gitblit.models.PathModel;
import com.gitblit.utils.MarkdownUtils;
import com.gitblit.utils.StringUtils;
-import dagger.ObjectGraph;
-
/**
* Serves the content of a branch.
*
* @author James Moger
*
*/
-public class RawServlet extends DaggerServlet {
+@Singleton
+public class RawServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private transient Logger logger = LoggerFactory.getLogger(RawServlet.class);
- private IRuntimeManager runtimeManager;
+ private final IRuntimeManager runtimeManager;
- private IRepositoryManager repositoryManager;
+ private final IRepositoryManager repositoryManager;
- @Override
- protected void inject(ObjectGraph dagger) {
- this.runtimeManager = dagger.get(IRuntimeManager.class);
- this.repositoryManager = dagger.get(IRepositoryManager.class);
+ @Inject
+ public RawServlet(
+ IRuntimeManager runtimeManager,
+ IRepositoryManager repositoryManager) {
+
+ this.runtimeManager = runtimeManager;
+ this.repositoryManager = repositoryManager;
}
/**
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.dagger.DaggerServlet;\r
import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.utils.FileUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* Handles requests for robots.txt\r
*\r
* @author James Moger\r
*\r
*/\r
-public class RobotsTxtServlet extends DaggerServlet {\r
+@Singleton\r
+public class RobotsTxtServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private IRuntimeManager runtimeManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.runtimeManager = dagger.get(IRuntimeManager.class);\r
+ @Inject\r
+ public RobotsTxtServlet(IRuntimeManager runtimeManager) {\r
+ this.runtimeManager = runtimeManager;\r
}\r
\r
@Override\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.FilterConfig;\r
import javax.servlet.ServletException;\r
import javax.servlet.ServletRequest;\r
import javax.servlet.ServletResponse;\r
import com.gitblit.Constants.RpcRequest;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
+import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.models.UserModel;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* The RpcFilter is a servlet filter that secures the RpcServlet.\r
*\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class RpcFilter extends AuthenticationFilter {\r
\r
private IStoredSettings settings;\r
\r
private IRuntimeManager runtimeManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
- super.inject(dagger, filterConfig);\r
- this.settings = dagger.get(IStoredSettings.class);\r
- this.runtimeManager = dagger.get(IRuntimeManager.class);\r
+ @Inject\r
+ public RpcFilter(\r
+ IStoredSettings settings,\r
+ IRuntimeManager runtimeManager,\r
+ IAuthenticationManager authenticationManager) {\r
+\r
+ super(authenticationManager);\r
+\r
+ this.settings = settings;\r
+ this.runtimeManager = runtimeManager;\r
}\r
\r
/**\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
import com.gitblit.utils.RpcUtils;\r
import com.gitblit.utils.StringUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* Handles remote procedure calls.\r
*\r
* @author James Moger\r
*/\r
+@Singleton\r
public class RpcServlet extends JsonServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private IGitblit gitblit;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.settings = dagger.get(IStoredSettings.class);\r
- this.gitblit = dagger.get(IGitblit.class);\r
+ @Inject\r
+ public RpcServlet(IStoredSettings settings, IGitblit gitblit) {\r
+ this.settings = settings;\r
+ this.gitblit = gitblit;\r
}\r
\r
/**\r
import java.net.URL;\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
import javax.servlet.http.HttpServletResponse;\r
\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
import com.gitblit.manager.IAuthenticationManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IUserManager;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.StringUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* Handles requests for Sparkleshare Invites\r
*\r
* @author James Moger\r
*\r
*/\r
-public class SparkleShareInviteServlet extends DaggerServlet {\r
+@Singleton\r
+public class SparkleShareInviteServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
\r
private IRepositoryManager repositoryManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.settings = dagger.get(IStoredSettings.class);\r
- this.userManager = dagger.get(IUserManager.class);\r
- this.authenticationManager = dagger.get(IAuthenticationManager.class);\r
- this.repositoryManager = dagger.get(IRepositoryManager.class);\r
+ @Inject\r
+ public SparkleShareInviteServlet(\r
+ IStoredSettings settings,\r
+ IUserManager userManager,\r
+ IAuthenticationManager authenticationManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
+ this.settings = settings;\r
+ this.userManager = userManager;\r
+ this.authenticationManager = authenticationManager;\r
+ this.repositoryManager = repositoryManager;\r
}\r
\r
@Override\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.FilterConfig;\r
import javax.servlet.ServletException;\r
import javax.servlet.ServletRequest;\r
import javax.servlet.ServletResponse;\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.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* The SyndicationFilter is an AuthenticationFilter which ensures that feed\r
* requests for projects or view-restricted repositories have proper authentication\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class SyndicationFilter extends AuthenticationFilter {\r
\r
private IRuntimeManager runtimeManager;\r
private IRepositoryManager repositoryManager;\r
private IProjectManager projectManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
- super.inject(dagger, filterConfig);\r
- this.runtimeManager = dagger.get(IRuntimeManager.class);\r
- this.repositoryManager = dagger.get(IRepositoryManager.class);\r
- this.projectManager = dagger.get(IProjectManager.class);\r
+ @Inject\r
+ public SyndicationFilter(\r
+ IRuntimeManager runtimeManager,\r
+ IAuthenticationManager authenticationManager,\r
+ IRepositoryManager repositoryManager,\r
+ IProjectManager projectManager) {\r
+ super(authenticationManager);\r
+\r
+ this.runtimeManager = runtimeManager;\r
+ this.repositoryManager = repositoryManager;\r
+ this.projectManager = projectManager;\r
}\r
\r
/**\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
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
import com.gitblit.Constants;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
import com.gitblit.manager.IProjectManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.models.FeedEntryModel;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.utils.SyndicationUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
* SyndicationServlet generates RSS 2.0 feeds and feed links.\r
*\r
* @author James Moger\r
*\r
*/\r
-public class SyndicationServlet extends DaggerServlet {\r
+@Singleton\r
+public class SyndicationServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
\r
private IProjectManager projectManager;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.settings = dagger.get(IStoredSettings.class);\r
- this.repositoryManager = dagger.get(IRepositoryManager.class);\r
- this.projectManager = dagger.get(IProjectManager.class);\r
+ @Inject\r
+ public SyndicationServlet(\r
+ IStoredSettings settings,\r
+ IRepositoryManager repositoryManager,\r
+ IProjectManager projectManager) {\r
+\r
+ this.settings = settings;\r
+ this.repositoryManager = repositoryManager;\r
+ this.projectManager = projectManager;\r
}\r
\r
/**\r
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;
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;
private final IGitblit gitblit;
+ @Inject
public GitBlitWebApp(
IRuntimeManager runtimeManager,
IPluginManager pluginManager,
\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
\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
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
\r
-import dagger.ObjectGraph;\r
-\r
/**\r
*\r
* Customization of the WicketFilter to allow smart browser-side caching of\r
* @author James Moger\r
*\r
*/\r
-public class GitblitWicketFilter extends DaggerWicketFilter {\r
+@Singleton\r
+public class GitblitWicketFilter extends WicketFilter {\r
\r
private IStoredSettings settings;\r
\r
\r
private GitBlitWebApp webapp;\r
\r
- @Override\r
- protected void inject(ObjectGraph dagger) {\r
- this.settings = dagger.get(IStoredSettings.class);\r
- this.runtimeManager = dagger.get(IRuntimeManager.class);\r
- this.repositoryManager = dagger.get(IRepositoryManager.class);\r
- this.projectManager = dagger.get(IProjectManager.class);\r
- this.webapp = dagger.get(GitBlitWebApp.class);\r
+ @Inject\r
+ public GitblitWicketFilter(\r
+ IStoredSettings settings,\r
+ IRuntimeManager runtimeManager,\r
+ IRepositoryManager repositoryManager,\r
+ IProjectManager projectManager,\r
+ GitBlitWebApp webapp) {\r
+\r
+ this.settings = settings;\r
+ this.runtimeManager = runtimeManager;\r
+ this.repositoryManager = repositoryManager;\r
+ this.projectManager = projectManager;\r
+ this.webapp = webapp;\r
}\r
\r
@Override\r