> From: Olivier Lefevre [mailto:lefev...@yahoo.com] 
> Subject: Vetoing the start of a webapp

> But what if the webapp has several servlets and you
> want to abort (or undo) the loading of the whole
> collection if any of the members fail to load: is
> there already an accepted best practice for that?

Normally, you would put such conditional activation code in a 
ServletContextListener, and have it throw an exception if things are not to 
your liking.  Doing so would prevent any further use of the webapp.  If you 
must do this on a servlet by servlet basis, then any servlet detecting a 
problem could set a flag in the ServletContext, which could be checked by a 
filter to see whether or not to allow requests through.

> the ServletContext is in web app scope but it *is* 
> not a webapp (or is it?).

There is a one-to-one correspondence between a ServletContext and a webapp; see 
SRV9.2:

"The servlet container must enforce a one to one correspondence between a Web 
application and a ServletContext. A ServletContext object provides a servlet 
with its view of the application."

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to