Azkaban的Web Server源碼探究系列9: Servlet引擎初始化

下面就是具體的路徑映射與具體的servlet對應了。css

=============================================================spa

Context root = new Context(server, "/", Context.SESSIONS);rest

root.setMaxFormContentSize(MAX_FORM_CONTENT_SIZE);orm

String defaultServletPath = azkabanSettings.getString("azkaban.default.servlet.path", "/index");server

root.setResourceBase(staticDir);get

//servlet

//it

//im

ServletHolder indexRedirect = new ServletHolder(new IndexRedirectServlet(defaultServletPath));stl

root.addServlet(indexRedirect, "/");

ServletHolder index = new ServletHolder(new ProjectServlet());

root.addServlet(index, "/index");

ServletHolder staticServlet = new ServletHolder(new DefaultServlet());

root.addServlet(staticServlet, "/css/*");

root.addServlet(staticServlet, "/js/*");

root.addServlet(staticServlet, "/images/*");

root.addServlet(staticServlet, "/fonts/*");

root.addServlet(staticServlet, "/favicon.ico");

root.addServlet(new ServletHolder(new ProjectManagerServlet()), "/manager");

root.addServlet(new ServletHolder(new ExecutorServlet()), "/executor");

root.addServlet(new ServletHolder(new HistoryServlet()), "/history");

root.addServlet(new ServletHolder(new ScheduleServlet()), "/schedule");

root.addServlet(new ServletHolder(new JMXHttpServlet()), "/jmx");

root.addServlet(new ServletHolder(new TriggerManagerServlet()), "/triggers");

root.addServlet(new ServletHolder(new StatsServlet()), "/stats");

ServletHolder restliHolder = new ServletHolder(new RestliServlet());

restliHolder.setInitParameter("resourcePackages", "azkaban.restli");

root.addServlet(restliHolder, "/restli/*");

純代碼流,裏面的具體細節後面再說,mark之。

相關文章
相關標籤/搜索