Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Programmatic access to servlet configuration

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Saloon Keeper
Posts: 24811
172
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Adam Michalik
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic