protected void configureServlets()

in github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/GuiceHttpModule.java [46:100]


  protected void configureServlets() {
    bind(HttpClient.class).toProvider(PooledHttpClientProvider.class);

    bind(new TypeLiteral<ScopedProvider<GitHubLogin>>() {}).to(GitHubLogin.Provider.class);
    bind(new TypeLiteral<ScopedProvider<GitImporter>>() {}).to(GitImporter.Provider.class);

    install(new FactoryModuleBuilder().build(RemoteSiteUser.Factory.class));

    install(
        new FactoryModuleBuilder()
            .implement(ProtectedBranchesCheckStep.class, ProtectedBranchesCheckStep.class)
            .build(ProtectedBranchesCheckStep.Factory.class));
    install(
        new FactoryModuleBuilder()
            .implement(GitCloneStep.class, GitCloneStep.class)
            .build(GitCloneStep.Factory.class));
    install(
        new FactoryModuleBuilder()
            .implement(CreateProjectStep.class, CreateProjectStep.class)
            .build(CreateProjectStep.Factory.class));
    install(
        new FactoryModuleBuilder()
            .implement(ReplicateProjectStep.class, ReplicateProjectStep.class)
            .build(ReplicateProjectStep.Factory.class));
    install(
        new FactoryModuleBuilder()
            .implement(MagicRefCheckStep.class, MagicRefCheckStep.class)
            .build(MagicRefCheckStep.Factory.class));
    install(
        new FactoryModuleBuilder()
            .implement(PullRequestImportJob.class, PullRequestImportJob.class)
            .build(PullRequestImportJob.Factory.class));
    install(
        new FactoryModuleBuilder()
            .implement(GitHubRepository.class, GitHubRepository.class)
            .build(GitHubRepository.Factory.class));

    bind(RuntimeInstance.class)
        .annotatedWith(Names.named("PluginRuntimeInstance"))
        .toProvider(PluginVelocityRuntimeProvider.class);

    bind(String.class).annotatedWith(GitHubURL.class).toProvider(GitHubURLProvider.class);

    bind(OAuthServiceProvider.class)
        .annotatedWith(Exports.named("github"))
        .to(GitHubOAuthServiceProvider.class);

    serve("*.css", "*.js", "*.png", "*.jpg", "*.woff", "*.gif", "*.ttf")
        .with(VelocityStaticServlet.class);
    serve("*.gh").with(VelocityControllerServlet.class);
    serve("/webhook").with(WebhookServlet.class);

    serve("/static/*").with(VelocityViewServlet.class);
    filterRegex("(?!/webhook).*").through(GitHubOAuthFilter.class);
  }