title: Jetty :: ServletContextHandler#setContextPath(..) and how to associate Servlets with specific file extensions
body: <p>I have the following code in <a href="http://www.eclipse.org/jetty/documentation/current/" rel="nofollow">Jetty</a>:</p>
  
  <pre><code>ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
  contextHandler.setContextPath("/a");
  ServletHolder holder = new ServletHolder(MyServlet.class);
  contextHandler.addServlet(holder, "/b/*");
  </code></pre>
  
  <p>what is the difference between <code>"/a"</code> in the call to <code>setContextPath</code> and <code>"/b/*"</code> in the call to <code>addServlet</code> ? Are these paths concatenated to decide which requests <code>MyServlet</code> will serve?</p>
  
  <p>Also, is it possible to associate a servlet with a specific file extension? I.e. by looking at the "<code>endsWith</code>" part, so to speak, of a URI and so dispatching URIs ending in, e.g. ".xsd" to a specific Servlet? Or is dispatching entirely based on "<code>startsWith</code>" logic?</p>