@Before
  public void setUp() throws Exception {

    server = new Server();

    //		Context scontext = new Context();
    //		scontext.setContextPath("/");
    //		scontext.setResourceBase(RES_DIR);
    //		// servlet handler?
    //		scontext.addServlet("JSP", "*.jsp",
    //				"org.apache.jasper.servlet.JspServlet");
    //		scontext.addHandler(new ResourceHandler());

    Context root = new Context(server, "/", Context.SESSIONS);
    root.setContextPath("/");
    root.setResourceBase(RES_DIR);
    ServletHolder sh = new ServletHolder(org.apache.jasper.servlet.JspServlet.class);
    root.addServlet(sh, "*.jsp");

    conf = new Configuration();
    conf.addResource("nutch-default.xml");
    conf.addResource("nutch-site-test.xml");

    http = new Http();
    http.setConf(conf);
  }
示例#2
0
  public static void main(String[] args) throws Exception {
    Server server = new Server(8080);

    Context root = new Context(server, "/");
    root.setResourceBase("./pom.xml");
    root.setHandler(new ResourceHandler());

    server.setStopAtShutdown(true);
    server.start();
  }
示例#3
0
  public void setUp(boolean redirection) throws Exception {
    conf = new Configuration();
    conf.addResource("nutch-default.xml");
    conf.addResource("nutch-site-test.xml");

    http = new Http();
    http.setConf(conf);

    server = new Server();

    if (redirection) {
      root = new Context(server, "/redirection", Context.SESSIONS);
      root.setAttribute("newContextURL", "/redirect");
    } else {
      root = new Context(server, "/", Context.SESSIONS);
    }

    ServletHolder sh = new ServletHolder(org.apache.jasper.servlet.JspServlet.class);
    root.addServlet(sh, "*.jsp");
    root.setResourceBase(RES_DIR);
  }