title: Serve both Thrift/TServlet and static files from same Jetty server
body: <p>I'm trying to serve static files and a Thrift service from the same Jetty server. Up until now I have the following code:</p>
  
  <pre><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();
  </code></pre>
  
  <p>The static files are served just fine, but the Thrift service keeps giving me 404 errors. What am I doing wrong?</p>
  
  <hr>
  
  <p><strong>Note</strong>: the code to serve static files was taken from <a href="https://stackoverflow.com/questions/10284584/serving-static-files-w-embedded-jetty">this question</a>, and the 'val' types are taken care of by <a href="http://projectlombok.org/" rel="nofollow noreferrer">project lombok</a>, but I left them in there because I think the current code is more readable.</p>