Search in sources :

Example 1 with GitilesServlet

use of com.google.gitiles.GitilesServlet in project gitiles by GerritCodeReview.

the class DevServer method appHandler.

private Handler appHandler() {
    DebugRenderer renderer = new DebugRenderer(STATIC_PREFIX, Arrays.asList(cfg.getStringList("gitiles", null, "customTemplates")), sourceRoot.resolve("gitiles-servlet/src/main/resources/com/google/gitiles/templates").toString(), firstNonNull(cfg.getString("gitiles", null, "siteTitle"), "Gitiles"));
    String docRoot = cfg.getString("gitiles", null, "docroot");
    Servlet servlet;
    if (!Strings.isNullOrEmpty(docRoot)) {
        servlet = createRootedDocServlet(renderer, docRoot);
    } else {
        servlet = new GitilesServlet(cfg, renderer, null, null, null, null, null, null, null);
    }
    ServletContextHandler handler = new ServletContextHandler();
    handler.setContextPath("");
    handler.addServlet(new ServletHolder(servlet), "/*");
    return handler;
}
Also used : DebugRenderer(com.google.gitiles.DebugRenderer) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) GitilesServlet(com.google.gitiles.GitilesServlet) Servlet(javax.servlet.Servlet) PathServlet(com.google.gitiles.PathServlet) RootedDocServlet(com.google.gitiles.RootedDocServlet) GitilesServlet(com.google.gitiles.GitilesServlet) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler)

Aggregations

DebugRenderer (com.google.gitiles.DebugRenderer)1 GitilesServlet (com.google.gitiles.GitilesServlet)1 PathServlet (com.google.gitiles.PathServlet)1 RootedDocServlet (com.google.gitiles.RootedDocServlet)1 Servlet (javax.servlet.Servlet)1 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)1 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)1