I have the following code in Jetty:
ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
contextHandler.setContextPath("/a");
ServletHolder holder = new ServletHolder(MyServlet.class);
contextHandler.addServlet(holder, "/b/*");
what is the difference between "/a"
in the call to setContextPath
and "/b/*"
in the call to addServlet
? Are these paths concatenated to decide which requests MyServlet
will serve?
Also, is it possible to associate a servlet with a specific file extension? I.e. by looking at the "endsWith
" 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 "startsWith
" logic?