This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Is there a way to access servlet configuration data of a given servlet (not the one currently handling the request)? I have an application with a JSF (Faces) servlet and servlet MyServlet. I want to programmatically access (read) access MyServlet's url-pattern as it was configured in web.xml from a request that is handled by the Faces Servlet. Is it possible at all?
Don't expect much. That sounds like something that Malware would like to be able to exploit, and if you want exploitable, Java tries very hard to be the last stop on the bus route.
Web.xml is kind of a funny critter, anyway. The application container digests it to create internal data structures for its own use - including the URL routing rules. They're not part of the webapp at all. So you're really talking about accessing server internal constructs which means that the requester would almost certainly have to know a lot about the internal organization of the server being used.
An IDE is no substitute for an Intelligent Developer.
Joined: Feb 18, 2008
Thanks, Tim. I supposed that it might be a security risk to allow for such listing. I'll have to duplicate this servlet configuration in web.xml and in the place where I need it, then.