wood burning stoves 2.0*
The moose likes Servlets and the fly likes Stopping application deployment process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Stopping application deployment process" Watch "Stopping application deployment process" New topic
Author

Stopping application deployment process

sachin pathak
Greenhorn

Joined: Jun 05, 2002
Posts: 27
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
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
You can throw a "ServletUnavailable" exception (from the javax.servlet package.)
Bill
sachin pathak
Greenhorn

Joined: Jun 05, 2002
Posts: 27
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Stopping application deployment process