File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the list of roles defined in web.xml

Junilu Lacar
Posts: 6529
Java Linux Mac Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apart from reading and parsing the web.xml, is there a way to get the list of roles defined under the <auth-constraint> element in web.xml?
I want to avoid hard-coding role names in my application. If I could get the list and iterate over it, I can write my additional role-based checking/processing code just once, keeping all the variables as properties in an application config file. I could put the list of roles in the application config file as well but that would mean that we would have to remember to change both web.xml and when a new role is created (yeah, I know about comments but there's no guarantee that everyone reads them).
I've waded through the JavaDocs and Googled but found no joy and would appreciate if someone could point me in the right direction, even if it's to say that I'm way out in left field on this.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic