aspose file tools
The moose likes Servlets and the fly likes Programmatic access to servlet configuration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Programmatic access to servlet configuration" Watch "Programmatic access to servlet configuration" New topic

Programmatic access to servlet configuration

Adam Michalik
Ranch Hand

Joined: Feb 18, 2008
Posts: 128
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?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16540

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.

Customer surveys are for companies who didn't pay proper attention to begin with.
Adam Michalik
Ranch Hand

Joined: Feb 18, 2008
Posts: 128
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.
I agree. Here's the link:
subject: Programmatic access to servlet configuration