I have a servlet which is loaded on server startup <load-on-startup>1</load-on-startup>
in the init()
method of the servlet I am checking for some parameter from a properties file. If the Parameter is not there, I want to stop the Entire Context from initializing.
public void init(){
Readproperty pr = new ReadProperty();
if(!pr.parameterExists()){
//Edit:
throw new UnavailableException("Testing Stopping Context")
}
}
What is the best way to do this? I do now want to Move this Code to my Context Listener Class so I am looking for the best way to do it from the `init()' method.