Search in sources :

Example 1 with IClassResolver

use of org.apache.wicket.application.IClassResolver in project gitblit by gitblit.

the class GitBlitWebApp method init.

@Override
public void init() {
    super.init();
    // Setup page authorization mechanism
    boolean useAuthentication = settings.getBoolean(Keys.web.authenticateViewPages, false) || settings.getBoolean(Keys.web.authenticateAdminPages, false);
    if (useAuthentication) {
        AuthorizationStrategy authStrategy = new AuthorizationStrategy(settings, homePageClass);
        getSecuritySettings().setAuthorizationStrategy(authStrategy);
        getSecuritySettings().setUnauthorizedComponentInstantiationListener(authStrategy);
    }
    // Grab Browser info (like timezone, etc)
    if (settings.getBoolean(Keys.web.useClientTimezone, false)) {
        getRequestCycleSettings().setGatherExtendedBrowserInfo(true);
    }
    // configure the resource cache duration to 90 days for deployment
    if (!isDebugMode()) {
        getResourceSettings().setDefaultCacheDuration(90 * 86400);
    }
    // setup the standard gitweb-ish urls
    mount("/repositories", RepositoriesPage.class);
    mount("/overview", OverviewPage.class, "r");
    mount("/summary", SummaryPage.class, "r");
    mount("/reflog", ReflogPage.class, "r");
    mount("/commits", LogPage.class, "r", "h");
    mount("/log", LogPage.class, "r", "h");
    mount("/tags", TagsPage.class, "r");
    mount("/branches", BranchesPage.class, "r");
    mount("/commit", CommitPage.class, "r", "h");
    mount("/tag", TagPage.class, "r", "h");
    mount("/tree", TreePage.class, "r", "h", "f");
    mount("/blob", BlobPage.class, "r", "h", "f");
    mount("/blobdiff", BlobDiffPage.class, "r", "h", "f");
    mount("/commitdiff", CommitDiffPage.class, "r", "h");
    mount("/compare", ComparePage.class, "r", "h");
    mount("/patch", PatchPage.class, "r", "h", "f");
    mount("/history", HistoryPage.class, "r", "h", "f");
    mount("/search", GitSearchPage.class);
    mount("/metrics", MetricsPage.class, "r");
    mount("/blame", BlamePage.class, "r", "h", "f");
    mount("/users", UsersPage.class);
    mount("/teams", TeamsPage.class);
    mount("/logout", LogoutPage.class);
    // setup ticket urls
    mount("/tickets", TicketsPage.class, "r", "h");
    mount("/tickets/new", NewTicketPage.class, "r");
    mount("/tickets/edit", EditTicketPage.class, "r", "h");
    mount("/tickets/export", ExportTicketPage.class, "r", "h");
    mount("/milestones/new", NewMilestonePage.class, "r");
    mount("/milestones/edit", EditMilestonePage.class, "r", "h");
    mount("/mytickets", MyTicketsPage.class, "r", "h");
    // setup the markup document urls
    mount("/docs", DocsPage.class, "r", "h");
    mount("/doc", DocPage.class, "r", "h", "f");
    mount("/editfile", EditFilePage.class, "r", "h", "f");
    // federation urls
    mount("/proposal", ReviewProposalPage.class, "t");
    mount("/registration", FederationRegistrationPage.class, "u", "n");
    mount("/new", NewRepositoryPage.class);
    mount("/edit", EditRepositoryPage.class, "r");
    mount("/activity", ActivityPage.class, "r", "h");
    mount("/lucene", LuceneSearchPage.class);
    mount("/project", ProjectPage.class, "p");
    mount("/projects", ProjectsPage.class);
    mount("/user", UserPage.class, "user");
    mount("/forks", ForksPage.class, "r");
    mount("/fork", ForkPage.class, "r");
    // filestore URL
    mount("/filestore", FilestorePage.class);
    // allow started Wicket plugins to initialize
    for (PluginWrapper pluginWrapper : pluginManager.getPlugins()) {
        if (PluginState.STARTED != pluginWrapper.getPluginState()) {
            continue;
        }
        if (pluginWrapper.getPlugin() instanceof GitblitWicketPlugin) {
            GitblitWicketPlugin wicketPlugin = (GitblitWicketPlugin) pluginWrapper.getPlugin();
            wicketPlugin.init(this);
        }
    }
    // customize the Wicket class resolver to load from plugins
    IClassResolver coreResolver = getApplicationSettings().getClassResolver();
    PluginClassResolver classResolver = new PluginClassResolver(coreResolver, pluginManager);
    getApplicationSettings().setClassResolver(classResolver);
    getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
}
Also used : GitblitWicketPlugin(com.gitblit.extensions.GitblitWicketPlugin) IClassResolver(org.apache.wicket.application.IClassResolver) PluginWrapper(ro.fortsoft.pf4j.PluginWrapper)

Aggregations

GitblitWicketPlugin (com.gitblit.extensions.GitblitWicketPlugin)1 IClassResolver (org.apache.wicket.application.IClassResolver)1 PluginWrapper (ro.fortsoft.pf4j.PluginWrapper)1