| | |
| | | import org.apache.wicket.markup.html.WebPage; |
| | | import org.apache.wicket.protocol.http.WebApplication; |
| | | |
| | | import com.gitblit.GitBlit; |
| | | import com.gitblit.IStoredSettings; |
| | | import com.gitblit.Keys; |
| | | import com.gitblit.manager.IAuthenticationManager; |
| | | import com.gitblit.manager.IFederationManager; |
| | | import com.gitblit.manager.IGitblitManager; |
| | | import com.gitblit.manager.IGitblit; |
| | | import com.gitblit.manager.INotificationManager; |
| | | import com.gitblit.manager.IProjectManager; |
| | | import com.gitblit.manager.IRepositoryManager; |
| | | import com.gitblit.manager.IRuntimeManager; |
| | | import com.gitblit.manager.ISessionManager; |
| | | import com.gitblit.manager.IUserManager; |
| | | import com.gitblit.utils.StringUtils; |
| | | import com.gitblit.wicket.pages.ActivityPage; |
| | |
| | | |
| | | private final Map<String, CacheControl> cacheablePages = new HashMap<String, CacheControl>(); |
| | | |
| | | private IStoredSettings settings; |
| | | private final IStoredSettings settings; |
| | | |
| | | private final IRuntimeManager runtimeManager; |
| | | |
| | | private final INotificationManager notificationManager; |
| | | |
| | | private final IUserManager userManager; |
| | | |
| | | private final IAuthenticationManager authenticationManager; |
| | | |
| | | private final IRepositoryManager repositoryManager; |
| | | |
| | | private final IProjectManager projectManager; |
| | | |
| | | private final IFederationManager federationManager; |
| | | |
| | | private final IGitblit gitblit; |
| | | |
| | | public GitBlitWebApp( |
| | | IRuntimeManager runtimeManager, |
| | | INotificationManager notificationManager, |
| | | IUserManager userManager, |
| | | IAuthenticationManager authenticationManager, |
| | | IRepositoryManager repositoryManager, |
| | | IProjectManager projectManager, |
| | | IFederationManager federationManager, |
| | | IGitblit gitblit) { |
| | | |
| | | super(); |
| | | this.settings = runtimeManager.getSettings(); |
| | | this.runtimeManager = runtimeManager; |
| | | this.notificationManager = notificationManager; |
| | | this.userManager = userManager; |
| | | this.authenticationManager = authenticationManager; |
| | | this.repositoryManager = repositoryManager; |
| | | this.projectManager = projectManager; |
| | | this.federationManager = federationManager; |
| | | this.gitblit = gitblit; |
| | | } |
| | | |
| | | @Override |
| | | public void init() { |
| | | super.init(); |
| | | |
| | | settings = runtime().getSettings(); |
| | | |
| | | // Setup page authorization mechanism |
| | | boolean useAuthentication = settings.getBoolean(Keys.web.authenticateViewPages, false) |
| | |
| | | mount("/user", UserPage.class, "user"); |
| | | mount("/forks", ForksPage.class, "r"); |
| | | mount("/fork", ForkPage.class, "r"); |
| | | |
| | | |
| | | getMarkupSettings().setDefaultMarkupEncoding("UTF-8"); |
| | | super.init(); |
| | | } |
| | |
| | | * @return true if Gitblit is running in debug mode |
| | | */ |
| | | public boolean isDebugMode() { |
| | | return runtime().isDebugMode(); |
| | | return runtimeManager.isDebugMode(); |
| | | } |
| | | |
| | | /* |
| | |
| | | * step towards modularization across multiple commits. |
| | | */ |
| | | public Date getBootDate() { |
| | | return runtime().getBootDate(); |
| | | return runtimeManager.getBootDate(); |
| | | } |
| | | |
| | | public Date getLastActivityDate() { |
| | | return repositories().getLastActivityDate(); |
| | | return repositoryManager.getLastActivityDate(); |
| | | } |
| | | |
| | | public IRuntimeManager runtime() { |
| | | return GitBlit.getManager(IRuntimeManager.class); |
| | | return runtimeManager; |
| | | } |
| | | |
| | | public INotificationManager notifier() { |
| | | return GitBlit.getManager(INotificationManager.class); |
| | | return notificationManager; |
| | | } |
| | | |
| | | public IUserManager users() { |
| | | return GitBlit.getManager(IUserManager.class); |
| | | return userManager; |
| | | } |
| | | |
| | | public ISessionManager session() { |
| | | return GitBlit.getManager(ISessionManager.class); |
| | | public IAuthenticationManager authentication() { |
| | | return authenticationManager; |
| | | } |
| | | |
| | | public IRepositoryManager repositories() { |
| | | return GitBlit.getManager(IRepositoryManager.class); |
| | | return repositoryManager; |
| | | } |
| | | |
| | | public IProjectManager projects() { |
| | | return GitBlit.getManager(IProjectManager.class); |
| | | return projectManager; |
| | | } |
| | | |
| | | public IFederationManager federation() { |
| | | return GitBlit.getManager(IFederationManager.class); |
| | | return federationManager; |
| | | } |
| | | |
| | | public IGitblitManager gitblit() { |
| | | return GitBlit.getManager(IGitblitManager.class); |
| | | public IGitblit gitblit() { |
| | | return gitblit; |
| | | } |
| | | |
| | | public TimeZone getTimezone() { |
| | | return runtime().getTimezone(); |
| | | return runtimeManager.getTimezone(); |
| | | } |
| | | |
| | | @Override |
| | | public final String getConfigurationType() { |
| | | if (isDebugMode()) { |
| | | if (runtimeManager.isDebugMode()) { |
| | | return Application.DEVELOPMENT; |
| | | } |
| | | return Application.DEPLOYMENT; |