• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to modify web.xml file at runtime???????

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all of you,
I m developing a security application using tomcat server.

I have to create security role and assign task to the created role....And i want that without restarting the Tomcat the changes i made in the web.xml file related to this "Role".

So, my question is ---
what parser should i use to modify existing "web.xml" file???

I mean i just want to add and delete Tags in existing web.xml file without deleting, modifying and then creating new file.....

Please help me out............

Thanks in Advance

Regards
Dheeraj
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some points that may help you:

- This page talks about how to set up Realms in Tomcat. You didn't mention where your user database lives; the simplest way would be an XML file called conf/tomcat-users.xml, in which case you need to configure a MemoryRealm.

- Some starting points how to configure your web.xml file can be found here, or, of course, in the servlet specification.

- Whenever you make a change to web.xml, the web application needs to be restarted to pick up those changes. Tomcat does not need to be restarted.
If you use MemopryRealm, though, the whole Tomcat server needs to be restarted.

- I'm not sure about your question concerning an XML parser. web.xml is an standard XML file; you can modify it with any DOM tool you like (XOM, JDOM, DOM, ...), but a parser alone will not be sufficient.
But you still need to restart the web app, no matter how you modify the file.

- To sum it up: If you want to change dynamically which pages are protected, and which users can see those, the standard security features of web apps are insufficient - you need to implement something yourself. If you just need to add new users or remove them at runtime, use a JDBCRealm, which looks up authorized users in a database.
[ August 26, 2005: Message edited by: Ulf Dittmer ]
 
dheeraj chhabra
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf Dittmer for ur kind reply......But sir i just want some more pouints from ur side:

Actually, i just want to Add and delete "security-constraint" tag in my web.xml file.

And i want the changed effect in my web application without restarting the tomcat server.

Would you please help me out in this context???

thanks in advance

Regards
Dheeraj
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Actually, i just want to Add and delete "security-constraint" tag in my web.xml file.


Re-read my previous post. It's an XML file - you can change it any way you want, and the way you do it has nothing to do with web applications. Personally, I might use XOM, but you may have a different preferred DOM library.


And i want the changed effect in my web application without restarting the tomcat server.


Re-read my previous post. Restarting Tomcat is not necessary. Restarting your web application is necessary.
[ August 26, 2005: Message edited by: Ulf Dittmer ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic