Search in sources :

Example 1 with PcapServiceCli

use of org.apache.metron.api.helper.service.PcapServiceCli in project metron by apache.

the class PcapService method main.

public static void main(String[] args) throws IOException {
    PcapServiceCli cli = new PcapServiceCli(args);
    cli.parse();
    ConfigurationUtil.setPcapOutputPath(cli.getPcapHdfsPath());
    LOG.info("Pcap location set to {}", cli.getPcapHdfsPath());
    ConfigurationUtil.setTempQueryOutputPath(cli.getQueryHdfsPath());
    LOG.info("Query temp location set to {}", cli.getQueryHdfsPath());
    Server server = new Server(cli.getPort());
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
    ServletHolder h = new ServletHolder(new HttpServletDispatcher());
    h.setInitParameter("javax.ws.rs.Application", "org.apache.metron.pcapservice.rest.JettyServiceRunner");
    context.addServlet(h, "/*");
    server.setHandler(context);
    try {
        server.start();
        server.join();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : PcapServiceCli(org.apache.metron.api.helper.service.PcapServiceCli) Server(org.eclipse.jetty.server.Server) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler) IOException(java.io.IOException) HttpServletDispatcher(org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher)

Aggregations

IOException (java.io.IOException)1 PcapServiceCli (org.apache.metron.api.helper.service.PcapServiceCli)1 Server (org.eclipse.jetty.server.Server)1 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)1 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)1 HttpServletDispatcher (org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher)1