0

Is there a way to get all the configured services / endpoints / servlets on a jetty server?

Some code how i add servlets:

ServletContextHandler con = new ServletContextHandler(ServletContextHandler.SESSIONS);      
ServletHolder servlet = con.addServlet(ServletContainer.class, "/" + prefix + "/" + version + "/*");
servlet.setInitParameter("jersey.config.server.provider.classnames", canonicalname);

HandlerList handlerList = new HandlerList();
handlerList.setHandlers(new Handler[] { con } );
server.setHandler(handlerList);

What i am looking for is something like:

server.listServices()
Gobliins
  • 3,848
  • 16
  • 67
  • 122

1 Answers1

1

That's not possible - because in general you may have custom dynamic endpoint mapper that produces any response.

You should use your servlet framework API to get that. E.g. if you are using Spring, you can use solution from "spring mvc get all request mappings".

If you use JAX-RS, you can use solution from "List all exposed/available endpoints of RestEasy service?"

Community
  • 1
  • 1
Dmitry Zvorygin
  • 473
  • 6
  • 14