I have a JETTY service hosted on a remote machine. I do not have the source code of the war.
But, the war has doesn’t have swagger. My question is, how can I get all the URLs(paths) that my service has hosted.
The war does contain java melody. so I’m able to monitor the service. Through java melody, I’m able to see statistics related to HTTP. In particular, I’m also able to view all the recent HTTP hits and the paths. But, I want all the paths that are there, like swagger.
There’s really no practical way to obtain this information.
That’s because all of the technologies from Servlet up through the technologies that use Servlets use mappings, and rarely hardcoded paths.
Eg:
/people/*
/chat/{org}/{room}
*.jsp
*.do
/product/([0-9a-f]*)/([a-z]*)
What you can get …
- The context-path for the war. eg: the war is called myapp.war, the context-path (assuming you haven’t customized it) would be
/myapp/
. - The exposed servlet mappings.
- Statically defined in the contents of the war, see
WEB-INF/web.xml
. - Dynamically defined in annotations of the war.
- Turn on server dump (note: this is not heap dump or thread dump) to show the list of registered mappings on the console.
- Statically defined in the contents of the war, see
If the webapp / war uses anything more complex then standard servlets, then you’ll be subject to whatever configuration those libraries bring to the table.
Some common examples (not a comprehensive list):
- JSP: these will be individual JSP files each with their own registered mappings
- SpringMVC: these will all go through a a single controller servlet, the mappings for these are in the spring configurations / annotations
- REST: these will also go through a single controller servlet, the mappings for these are in the REST configurations and annotations.
You will have lots of digging to do, and dissection of the war file to know what’s technologies are being used, and from there how each of those technologies register their URL mappings.