tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: Vetoing the start of a webapp
Date Tue, 01 Mar 2011 14:14:56 GMT
> From: Olivier Lefevre [] 
> 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

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:
For additional commands, e-mail:

View raw message