aspose file tools*
The moose likes Servlets and the fly likes All servlets in Web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "All servlets in Web application" Watch "All servlets in Web application" New topic
Author

All servlets in Web application

Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
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 ]

Rahul Juneja
ThoughtClicks - http://techlabs.thoughtclicks.com
Chris Stehno
Ranch Hand

Joined: Feb 26, 2001
Posts: 180
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
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
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
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: All servlets in Web application