Hi all I have written a web application. I have configured a ServletContextListener and I am checking some of the initial context parameters in this for validity. If I found that some of the context parameters have inhvalid values then I want to stop the further deployment of the application and mark the web app as unavailable. How do I do this. I am using Tomcat 5.0.18, and JVM is Sun Microsystems 1.4.2_01-b06. TIA Sachin
You can throw a "ServletUnavailable" exception (from the javax.servlet package.) Bill
Joined: Jun 05, 2002
Thanks for the reply. I have thought about doing the same initially, but the problem is since I am using a contextListener, I can throw only exceptions defined in the interface. So defining the instnace like below is not compilable.
Moreover, I dont want to mark a single servlet as unAvailable, I want to marrk all the servlets in the application as unAvaialable, i.e. I don't want the application to be available in any form further. COnsider a scenario like this, I am initialising a connection pool for use in the web application and the username password used to connect to DB are being read from the web.xml file as context init params. I need to ensure that before the connection pool is created I have a valid username and password combination. If the user name password is not correct then there is no point in going further and deploying the application. I check the validity in the listener listed above. Now if the username password is incorrect I want to stop the application deployment process itself. Hope this has clarified the requirements. Sachin