I'm trying to serve static files and a Thrift service from the same Jetty server. Up until now I have the following code:
val server = new Server();
val connector = new SelectChannelConnector();
connector.setPort(4567);
server.addConnector(connector);
val servlet_handler = new ServletContextHandler(server,"/thrift",ServletContextHandler.SESSIONS);
servlet_handler.addServlet(new ServletHolder(new SomeThriftServlet()), "/thrift/*");
val resource_handler = new ResourceHandler();
resource_handler.setWelcomeFiles(new String[]{ "index.html" });
resource_handler.setResourceBase(".");
val handlers = new HandlerList();
handlers.setHandlers(new Handler[] { resource_handler, servlet_handler, new DefaultHandler() });
server.setHandler(handlers);
server.start();
server.join();
The static files are served just fine, but the Thrift service keeps giving me 404 errors. What am I doing wrong?
Note: the code to serve static files was taken from this question, and the 'val' types are taken care of by project lombok, but I left them in there because I think the current code is more readable.