Jeanne Boyarsky wrote:Peter,
Welcome to JavaRanch!
What I do to disable a test servlet is have the build comment out the part of the web.xml that has that servlet. That way the code is the same (and I don't take the risk of messing things up) and it is completely automated. If I need to be absolutely sure the servlet can't be enabled, I'll have the build delete the .class file for the servlet too. That way if someone added it back to the web.xml the application wouldn't even start up.
Jeanne,
Thanks for the suggestion! What I was hoping to do is avoid a rebuild to exclude the web.xml entry just to eliminate the chance of new/modified code being introduced by accident thru source code control issues.
What I thought of doing was possibly preventing the init method of the servlet from completing successfully if an entry from a preferences file indicated that the servlet should be disabled. I'd have to subclass the JunitEE Servlet to do that I guess but that way we could use identical builds and just modify a preferences file.
Although I'm not sure if raising an exception in the init method would just prevent that one servlet from starting or prevent the entire app from starting???
What do you think?
Thanks,
Peter