This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stopping application deployment process

 
sachin pathak
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can throw a "ServletUnavailable" exception (from the javax.servlet package.)
Bill
 
sachin pathak
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic