title: What's the difference between a ServletHandler and a ServletContextHandler in Jetty?
body: <p>I'm trying to get started with an embedded Jetty server. I just want to map requests to different servlets based on the request path.</p>
  
  <p>What's the difference between creating a <code>ServletHandler</code> and adding servlets to it as opposed to creating a <code>ServletContextHandler</code> and adding servlets to that?</p>
  
  <p>For example:</p>
  
  <pre><code>//how is this different...
  ServletHandler handler = new ServletHandler();
  handler.addServletWithMapping(MyServlet.class, "/path");
  
  //from this?
  ServletContextHandler contextHandler = new ServletContextHandler();
  contextHandler.addServlet(MyServlet.class, "/path");
  </code></pre>