Hi All, Can anybody help me how to find the names of all the servlets in a Web application. This is through the Java code only. I mean is there any method in API to find the name of all the servlets of any web application. Thanks, Rahul Juneja [ April 26, 2004: Message edited by: Rahul Juneja ]
There used to be a way to do this from the core servlets API; however, it was deemed a security risk and the methods were deprected... and they no longer work. The only other way I know of to do this would require access to the APIs for the server itself (at least on Tomcat). You would have to use some of the server management APIs to access the server itself rather than just a single application. Hope this helps.
- Chris Stehno, SCPJ
Joined: Aug 03, 2002
Chris, Can you give any Example and be more precise on this. Any Server API Example and it would be great if you can come across with a Solution for WebSphere or Weblogic but any server will work. Cheers, Rahul
You could read and parse the web.xml file - this would work only if the "invoker" was not in use. You could scan all of the class files under WEB-INF, counting the ones that implement the Servlet interface. Bill
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com