From cc47aad618137ee6481c8bc164d8074bd30fde9e Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 10 Dec 2013 11:04:46 -0500 Subject: [PATCH] Remove @Inject references because they confuse JEE containers Change-Id: I2e4a8e7424e7c62d1e89ca62a91423fdf3e36ac8 --- src/main/java/com/gitblit/DaggerModule.java | 146 +++++++++++++++++- .../gitblit/dagger/DaggerWicketFilter.java | 54 ------- src/main/java/com/gitblit/git/GitServlet.java | 2 - .../gitblit/servlet/BranchGraphServlet.java | 5 - .../gitblit/servlet/DownloadZipFilter.java | 7 +- .../gitblit/servlet/DownloadZipServlet.java | 5 - .../servlet/EnforceAuthenticationFilter.java | 7 +- .../gitblit/servlet/FederationServlet.java | 4 - .../java/com/gitblit/servlet/GitFilter.java | 2 - .../java/com/gitblit/servlet/LogoServlet.java | 5 - .../java/com/gitblit/servlet/PagesFilter.java | 7 +- .../com/gitblit/servlet/PagesServlet.java | 4 - .../com/gitblit/servlet/RobotsTxtServlet.java | 6 - .../java/com/gitblit/servlet/RpcFilter.java | 6 +- .../java/com/gitblit/servlet/RpcServlet.java | 4 - .../servlet/SparkleShareInviteServlet.java | 4 - .../gitblit/servlet/SyndicationFilter.java | 6 +- .../gitblit/servlet/SyndicationServlet.java | 4 - .../gitblit/wicket/GitblitWicketFilter.java | 36 +++-- 19 files changed, 170 insertions(+), 144 deletions(-) delete mode 100644 src/main/java/com/gitblit/dagger/DaggerWicketFilter.java diff --git a/src/main/java/com/gitblit/DaggerModule.java b/src/main/java/com/gitblit/DaggerModule.java index 857f36a2..b12510c9 100644 --- a/src/main/java/com/gitblit/DaggerModule.java +++ b/src/main/java/com/gitblit/DaggerModule.java @@ -17,8 +17,6 @@ package com.gitblit; 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; @@ -176,7 +174,7 @@ public class DaggerModule { federationManager); } - @Provides @Singleton WebApplication provideWebApplication( + @Provides @Singleton GitBlitWebApp provideWebApplication( IRuntimeManager runtimeManager, INotificationManager notificationManager, IUserManager userManager, @@ -196,4 +194,146 @@ public class DaggerModule { 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 diff --git a/src/main/java/com/gitblit/dagger/DaggerWicketFilter.java b/src/main/java/com/gitblit/dagger/DaggerWicketFilter.java deleted file mode 100644 index b778f1f6..00000000 --- a/src/main/java/com/gitblit/dagger/DaggerWicketFilter.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 webApplicationProvider; - - @Inject - public DaggerWicketFilter() { - super(); - } - - @Override - protected IWebApplicationFactory getApplicationFactory() { - return new IWebApplicationFactory() { - @Override - public WebApplication createApplication(WicketFilter filter) { - return webApplicationProvider.get(); - } - }; - } -} diff --git a/src/main/java/com/gitblit/git/GitServlet.java b/src/main/java/com/gitblit/git/GitServlet.java index db671e4b..cf54e6d3 100644 --- a/src/main/java/com/gitblit/git/GitServlet.java +++ b/src/main/java/com/gitblit/git/GitServlet.java @@ -15,7 +15,6 @@ */ package com.gitblit.git; -import javax.inject.Inject; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -35,7 +34,6 @@ public class GitServlet extends org.eclipse.jgit.http.server.GitServlet { private final IGitblit gitblit; - @Inject public GitServlet(IGitblit gitblit) { super(); this.gitblit = gitblit; diff --git a/src/main/java/com/gitblit/servlet/BranchGraphServlet.java b/src/main/java/com/gitblit/servlet/BranchGraphServlet.java index 3efe60de..1f6d3a87 100644 --- a/src/main/java/com/gitblit/servlet/BranchGraphServlet.java +++ b/src/main/java/com/gitblit/servlet/BranchGraphServlet.java @@ -36,8 +36,6 @@ import java.util.Set; import java.util.TreeSet; import javax.imageio.ImageIO; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -55,7 +53,6 @@ import org.eclipse.jgit.revwalk.RevCommit; import com.gitblit.Constants; import com.gitblit.IStoredSettings; import com.gitblit.Keys; -import com.gitblit.Keys.web; import com.gitblit.manager.IRepositoryManager; import com.gitblit.manager.IRuntimeManager; import com.gitblit.utils.JGitUtils; @@ -67,7 +64,6 @@ import com.gitblit.utils.StringUtils; * @author James Moger * */ -@Singleton public class BranchGraphServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -85,7 +81,6 @@ public class BranchGraphServlet extends HttpServlet { private final IRepositoryManager repositoryManager; - @Inject public BranchGraphServlet( IRuntimeManager runtimeManager, IRepositoryManager repositoryManager) { diff --git a/src/main/java/com/gitblit/servlet/DownloadZipFilter.java b/src/main/java/com/gitblit/servlet/DownloadZipFilter.java index 398121d3..30bb9cb9 100644 --- a/src/main/java/com/gitblit/servlet/DownloadZipFilter.java +++ b/src/main/java/com/gitblit/servlet/DownloadZipFilter.java @@ -15,13 +15,10 @@ */ package com.gitblit.servlet; -import javax.inject.Inject; -import javax.inject.Singleton; - import com.gitblit.Constants.AccessRestrictionType; +import com.gitblit.manager.IAuthenticationManager; import com.gitblit.manager.IRepositoryManager; import com.gitblit.manager.IRuntimeManager; -import com.gitblit.manager.IAuthenticationManager; import com.gitblit.models.RepositoryModel; import com.gitblit.models.UserModel; @@ -33,10 +30,8 @@ import com.gitblit.models.UserModel; * @author James Moger * */ -@Singleton public class DownloadZipFilter extends AccessRestrictionFilter { - @Inject public DownloadZipFilter( IRuntimeManager runtimeManager, IAuthenticationManager authenticationManager, diff --git a/src/main/java/com/gitblit/servlet/DownloadZipServlet.java b/src/main/java/com/gitblit/servlet/DownloadZipServlet.java index d26f73ea..437a9c26 100644 --- a/src/main/java/com/gitblit/servlet/DownloadZipServlet.java +++ b/src/main/java/com/gitblit/servlet/DownloadZipServlet.java @@ -20,8 +20,6 @@ import java.text.MessageFormat; import java.text.ParseException; import java.util.Date; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletResponse; @@ -34,7 +32,6 @@ import org.slf4j.LoggerFactory; import com.gitblit.Constants; import com.gitblit.IStoredSettings; import com.gitblit.Keys; -import com.gitblit.Keys.web; import com.gitblit.manager.IRepositoryManager; import com.gitblit.manager.IRuntimeManager; import com.gitblit.utils.CompressionUtils; @@ -49,7 +46,6 @@ import com.gitblit.utils.StringUtils; * @author James Moger * */ -@Singleton public class DownloadZipServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -79,7 +75,6 @@ public class DownloadZipServlet extends HttpServlet { } } - @Inject public DownloadZipServlet( IRuntimeManager runtimeManager, IRepositoryManager repositoryManager) { diff --git a/src/main/java/com/gitblit/servlet/EnforceAuthenticationFilter.java b/src/main/java/com/gitblit/servlet/EnforceAuthenticationFilter.java index 6655c6e1..b129c0ca 100644 --- a/src/main/java/com/gitblit/servlet/EnforceAuthenticationFilter.java +++ b/src/main/java/com/gitblit/servlet/EnforceAuthenticationFilter.java @@ -18,8 +18,6 @@ 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; @@ -34,9 +32,8 @@ import org.slf4j.LoggerFactory; 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; /** @@ -47,7 +44,6 @@ import com.gitblit.models.UserModel; * @author Laurens Vrijnsen * */ -@Singleton public class EnforceAuthenticationFilter implements Filter { protected transient Logger logger = LoggerFactory.getLogger(getClass()); @@ -56,7 +52,6 @@ public class EnforceAuthenticationFilter implements Filter { private final IAuthenticationManager authenticationManager; - @Inject public EnforceAuthenticationFilter( IRuntimeManager runtimeManager, IAuthenticationManager authenticationManager) { diff --git a/src/main/java/com/gitblit/servlet/FederationServlet.java b/src/main/java/com/gitblit/servlet/FederationServlet.java index 4d3cbbe2..8d352feb 100644 --- a/src/main/java/com/gitblit/servlet/FederationServlet.java +++ b/src/main/java/com/gitblit/servlet/FederationServlet.java @@ -25,8 +25,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.http.HttpServletResponse; import com.gitblit.Constants.FederationRequest; @@ -52,7 +50,6 @@ import com.gitblit.utils.TimeUtils; * @author James Moger * */ -@Singleton public class FederationServlet extends JsonServlet { private static final long serialVersionUID = 1L; @@ -65,7 +62,6 @@ public class FederationServlet extends JsonServlet { private final IFederationManager federationManager; - @Inject public FederationServlet( IRuntimeManager runtimeManager, IUserManager userManager, diff --git a/src/main/java/com/gitblit/servlet/GitFilter.java b/src/main/java/com/gitblit/servlet/GitFilter.java index 15facbe8..58a45ca2 100644 --- a/src/main/java/com/gitblit/servlet/GitFilter.java +++ b/src/main/java/com/gitblit/servlet/GitFilter.java @@ -17,7 +17,6 @@ package com.gitblit.servlet; import java.text.MessageFormat; -import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import com.gitblit.Constants.AccessRestrictionType; @@ -57,7 +56,6 @@ public class GitFilter extends AccessRestrictionFilter { private final IFederationManager federationManager; - @Inject public GitFilter( IRuntimeManager runtimeManager, IUserManager userManager, diff --git a/src/main/java/com/gitblit/servlet/LogoServlet.java b/src/main/java/com/gitblit/servlet/LogoServlet.java index e91fad05..e39cc695 100644 --- a/src/main/java/com/gitblit/servlet/LogoServlet.java +++ b/src/main/java/com/gitblit/servlet/LogoServlet.java @@ -21,8 +21,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -30,7 +28,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.gitblit.Keys; -import com.gitblit.Keys.web; import com.gitblit.manager.IRuntimeManager; /** @@ -39,7 +36,6 @@ import com.gitblit.manager.IRuntimeManager; * @author James Moger * */ -@Singleton public class LogoServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -48,7 +44,6 @@ public class LogoServlet extends HttpServlet { private final IRuntimeManager runtimeManager; - @Inject public LogoServlet(IRuntimeManager runtimeManager) { super(); this.runtimeManager = runtimeManager; diff --git a/src/main/java/com/gitblit/servlet/PagesFilter.java b/src/main/java/com/gitblit/servlet/PagesFilter.java index 42e7de75..fd7b10fe 100644 --- a/src/main/java/com/gitblit/servlet/PagesFilter.java +++ b/src/main/java/com/gitblit/servlet/PagesFilter.java @@ -15,15 +15,12 @@ */ package com.gitblit.servlet; -import javax.inject.Inject; -import javax.inject.Singleton; - import org.eclipse.jgit.lib.Repository; import com.gitblit.Constants.AccessRestrictionType; +import com.gitblit.manager.IAuthenticationManager; import com.gitblit.manager.IRepositoryManager; import com.gitblit.manager.IRuntimeManager; -import com.gitblit.manager.IAuthenticationManager; import com.gitblit.models.RepositoryModel; import com.gitblit.models.UserModel; @@ -34,10 +31,8 @@ import com.gitblit.models.UserModel; * @author James Moger * */ -@Singleton public class PagesFilter extends AccessRestrictionFilter { - @Inject public PagesFilter(IRuntimeManager runtimeManager, IAuthenticationManager authenticationManager, IRepositoryManager repositoryManager) { diff --git a/src/main/java/com/gitblit/servlet/PagesServlet.java b/src/main/java/com/gitblit/servlet/PagesServlet.java index 6146f132..8b91b486 100644 --- a/src/main/java/com/gitblit/servlet/PagesServlet.java +++ b/src/main/java/com/gitblit/servlet/PagesServlet.java @@ -24,7 +24,6 @@ import java.util.Set; import java.util.TreeSet; import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -40,7 +39,6 @@ import org.slf4j.LoggerFactory; import com.gitblit.Constants; import com.gitblit.IStoredSettings; import com.gitblit.Keys; -import com.gitblit.Keys.web; import com.gitblit.manager.IRepositoryManager; import com.gitblit.manager.IRuntimeManager; import com.gitblit.models.PathModel; @@ -59,7 +57,6 @@ import com.gitblit.wicket.MarkupProcessor.MarkupDocument; * @author James Moger * */ -@Singleton public class PagesServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -70,7 +67,6 @@ public class PagesServlet extends HttpServlet { private final IRepositoryManager repositoryManager; - @Inject public PagesServlet( IRuntimeManager runtimeManager, IRepositoryManager repositoryManager) { diff --git a/src/main/java/com/gitblit/servlet/RobotsTxtServlet.java b/src/main/java/com/gitblit/servlet/RobotsTxtServlet.java index c93675a0..94cc832a 100644 --- a/src/main/java/com/gitblit/servlet/RobotsTxtServlet.java +++ b/src/main/java/com/gitblit/servlet/RobotsTxtServlet.java @@ -18,16 +18,12 @@ package com.gitblit.servlet; import java.io.File; import java.io.IOException; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.gitblit.Keys; -import com.gitblit.Keys.web; -import com.gitblit.Keys.web.robots; import com.gitblit.manager.IRuntimeManager; import com.gitblit.utils.FileUtils; @@ -37,14 +33,12 @@ import com.gitblit.utils.FileUtils; * @author James Moger * */ -@Singleton public class RobotsTxtServlet extends HttpServlet { private static final long serialVersionUID = 1L; private final IRuntimeManager runtimeManager; - @Inject public RobotsTxtServlet(IRuntimeManager runtimeManager) { super(); this.runtimeManager = runtimeManager; diff --git a/src/main/java/com/gitblit/servlet/RpcFilter.java b/src/main/java/com/gitblit/servlet/RpcFilter.java index f39d37d8..fc838724 100644 --- a/src/main/java/com/gitblit/servlet/RpcFilter.java +++ b/src/main/java/com/gitblit/servlet/RpcFilter.java @@ -18,8 +18,6 @@ package com.gitblit.servlet; import java.io.IOException; import java.text.MessageFormat; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; @@ -30,8 +28,8 @@ import javax.servlet.http.HttpServletResponse; import com.gitblit.Constants.RpcRequest; import com.gitblit.IStoredSettings; import com.gitblit.Keys; -import com.gitblit.manager.IRuntimeManager; import com.gitblit.manager.IAuthenticationManager; +import com.gitblit.manager.IRuntimeManager; import com.gitblit.models.UserModel; /** @@ -47,14 +45,12 @@ import com.gitblit.models.UserModel; * @author James Moger * */ -@Singleton public class RpcFilter extends AuthenticationFilter { private final IStoredSettings settings; private final IRuntimeManager runtimeManager; - @Inject public RpcFilter( IRuntimeManager runtimeManager, IAuthenticationManager authenticationManager) { diff --git a/src/main/java/com/gitblit/servlet/RpcServlet.java b/src/main/java/com/gitblit/servlet/RpcServlet.java index 856bd839..a5d892fe 100644 --- a/src/main/java/com/gitblit/servlet/RpcServlet.java +++ b/src/main/java/com/gitblit/servlet/RpcServlet.java @@ -23,8 +23,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -55,7 +53,6 @@ import com.gitblit.utils.StringUtils; * @author James Moger * */ -@Singleton public class RpcServlet extends JsonServlet { private static final long serialVersionUID = 1L; @@ -66,7 +63,6 @@ public class RpcServlet extends JsonServlet { private final IGitblit gitblit; - @Inject public RpcServlet(IGitblit gitblit) { super(); diff --git a/src/main/java/com/gitblit/servlet/SparkleShareInviteServlet.java b/src/main/java/com/gitblit/servlet/SparkleShareInviteServlet.java index 5d2532d4..709e22ef 100644 --- a/src/main/java/com/gitblit/servlet/SparkleShareInviteServlet.java +++ b/src/main/java/com/gitblit/servlet/SparkleShareInviteServlet.java @@ -18,8 +18,6 @@ package com.gitblit.servlet; import java.io.IOException; import java.text.MessageFormat; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -42,7 +40,6 @@ import com.gitblit.utils.StringUtils; * @author James Moger * */ -@Singleton public class SparkleShareInviteServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -55,7 +52,6 @@ public class SparkleShareInviteServlet extends HttpServlet { private final IRepositoryManager repositoryManager; - @Inject public SparkleShareInviteServlet( IRuntimeManager runtimeManager, IUserManager userManager, diff --git a/src/main/java/com/gitblit/servlet/SyndicationFilter.java b/src/main/java/com/gitblit/servlet/SyndicationFilter.java index 7eb8af96..e4e5e1d6 100644 --- a/src/main/java/com/gitblit/servlet/SyndicationFilter.java +++ b/src/main/java/com/gitblit/servlet/SyndicationFilter.java @@ -18,8 +18,6 @@ package com.gitblit.servlet; import java.io.IOException; import java.text.MessageFormat; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; @@ -28,10 +26,10 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.gitblit.Constants.AccessRestrictionType; +import com.gitblit.manager.IAuthenticationManager; import com.gitblit.manager.IProjectManager; import com.gitblit.manager.IRepositoryManager; import com.gitblit.manager.IRuntimeManager; -import com.gitblit.manager.IAuthenticationManager; import com.gitblit.models.ProjectModel; import com.gitblit.models.RepositoryModel; import com.gitblit.models.UserModel; @@ -44,14 +42,12 @@ import com.gitblit.models.UserModel; * @author James Moger * */ -@Singleton public class SyndicationFilter extends AuthenticationFilter { private final IRuntimeManager runtimeManager; private final IRepositoryManager repositoryManager; private final IProjectManager projectManager; - @Inject public SyndicationFilter( IRuntimeManager runtimeManager, IAuthenticationManager authenticationManager, diff --git a/src/main/java/com/gitblit/servlet/SyndicationServlet.java b/src/main/java/com/gitblit/servlet/SyndicationServlet.java index a35efa83..a9555f7d 100644 --- a/src/main/java/com/gitblit/servlet/SyndicationServlet.java +++ b/src/main/java/com/gitblit/servlet/SyndicationServlet.java @@ -22,8 +22,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; import javax.servlet.http.HttpServlet; import org.eclipse.jgit.lib.ObjectId; @@ -58,7 +56,6 @@ import com.gitblit.utils.SyndicationUtils; * @author James Moger * */ -@Singleton public class SyndicationServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -71,7 +68,6 @@ public class SyndicationServlet extends HttpServlet { private final IProjectManager projectManager; - @Inject public SyndicationServlet( IRuntimeManager runtimeManager, IRepositoryManager repositoryManager, diff --git a/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java b/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java index 87b0a08f..9e554708 100644 --- a/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java +++ b/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java @@ -17,17 +17,17 @@ 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; +import org.apache.wicket.protocol.http.WebApplication; +import org.apache.wicket.protocol.http.WicketFilter; import org.apache.wicket.util.string.Strings; import org.eclipse.jgit.lib.Repository; 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; @@ -44,8 +44,7 @@ import com.gitblit.utils.StringUtils; * @author James Moger * */ -@Singleton -public class GitblitWicketFilter extends DaggerWicketFilter { +public class GitblitWicketFilter extends WicketFilter { private final IStoredSettings settings; @@ -55,17 +54,26 @@ public class GitblitWicketFilter extends DaggerWicketFilter { private final IProjectManager projectManager; - @Inject - public GitblitWicketFilter( - IRuntimeManager runtimeManager, - IRepositoryManager repositoryManager, - IProjectManager projectManager) { + private final GitBlitWebApp webapp; + + public GitblitWicketFilter(GitBlitWebApp webapp) { super(); - this.settings = runtimeManager.getSettings(); - this.runtimeManager = runtimeManager; - this.repositoryManager = repositoryManager; - this.projectManager = projectManager; + this.settings = webapp.settings(); + this.runtimeManager = webapp.runtime(); + this.repositoryManager = webapp.repositories(); + this.projectManager = webapp.projects(); + this.webapp = webapp; + } + + @Override + protected IWebApplicationFactory getApplicationFactory() { + return new IWebApplicationFactory() { + @Override + public WebApplication createApplication(WicketFilter filter) { + return webapp; + } + }; } /** -- 2.39.5