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.
What's the difference between creating a ServletHandler
and adding servlets to it as opposed to creating a ServletContextHandler
and adding servlets to that?
For example:
//how is this different...
ServletHandler handler = new ServletHandler();
handler.addServletWithMapping(MyServlet.class, "/path");
//from this?
ServletContextHandler contextHandler = new ServletContextHandler();
contextHandler.addServlet(MyServlet.class, "/path");