You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rodrigo Ruiz <rr...@gridsystems.com> on 2004/02/17 17:25:05 UTC

Re: Réf. : RE: How to know when Tomcat has completed startup?

AFAIK, the ServletContextListener initialization event is fired before 
Tomcat starts listening to external requests, so they won't work for you.
SessionListeners will be executed on a request basis, as their first 
execution will be fired on the first request asking for a session to be 
created. Depending on your requirements this could be good enough... or 
not. You decide ;-)

If I had undestood well, you want to invoke some JSP from within your 
own web-app during initialization, to do some data pre-generation.

Does your JSP performs all operations, or does it delegates in another 
class?
In my opinion:
  a) If your JSP (or Action if you use struts) is performing the 
operation itself, I would refactor the code and create a Helper class 
containing the necessary logic.
  b) If your logic is in a sepparate class, you could probably call its 
methods directly from a ServletContextListener, without needing to 
perform a JSP invocation. From a ServletContextListener you do not have 
access to a ServletResponse or ServletRequest, as there is no request in 
process, but you have access to the ServletContext, and many times it 
provides enough information for data preparing tasks.

HTH,
Rodrigo Ruiz

meissa.Sakho@assetmanagement.natexis.fr wrote:

>if your application is a struts one, you can do that with
>struts plugin mechanism.
>_______________________________________________
>NATEXIS ASSET MANAGEMENT
>Meissa SAKHO
>
>01 58 19 45 71. . . . . . . . . . . . (84571)
>meissa.sakho@assetmanagement.natexis.fr
>
>
>
>
>"Peter Guyatt" <pg...@telesoft-technologies.com>
>16/02/2004 14:26
>Veuillez répondre à "Tomcat Users List"
>
>
>
>        Pour :  "Tomcat Users List" <to...@jakarta.apache.org>
>        cc :
>
>        Objet : RE: How to know when Tomcat has completed startup?
>
>
>What about using a session listener.
>
>Why not call your method in the constructor for the SessionListsner
>
>Pete
>
>-----Original Message-----
>From: James Neville [mailto:james.neville@babcockbrown.com]
>Sent: 16 February 2004 12:38
>To: tomcat-user@jakarta.apache.org
>Subject: How to know when Tomcat has completed startup?
>
>
>Hi all,
>
>I'm trying to get a certain method within my startup class to *only*
>
>execute after Tomcat startup has fully completed.
>
>I understand I can implement a LifecycleListener, but there only seems
>
>to be before/after start/stop events.
>(i'm not sure that Lifecycle.AFTER_START_EVENT refers to 'startup is
>
>complete', or 'startup event was requested')
>
>In short, as part of my Startup procedure, we pre-generate(if rqd) a
>
>fornightly clandar of 'events' from some JSPs on the same Tomcat instance.
>The problem is mainly that we also use Apache/JK2, so a HTTP 500 error
>
>is generated (the Apache connection can be made, but Tomcat is not yet
>
>available), unless we can defer until Tomcat has started.
>I could, of course, defer the event for a few minutes, but that doesn't
>
>strike me as much of a graceful approach.
>
>I'm assuming this is probably pretty simple?
>Any pointers would be much appreciated. (not google.com, been all
>
>morning in there! :) )
>
>James
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>
>L'integrite de ce message n'etant pas assuree sur internet, Natexis
>Banques Populaires ne peut etre tenu responsable de
>son contenu. Toute utilisation ou diffusion non autorisee est
>interdite. Si vous n'etes pas destinataire de ce message, merci de le
>detruire et d'avertir l'expediteur.
>
>The integrity of this message cannot be guaranteed
>on the Internet. Natexis Banques Populaires can not therefore be
>considered responsible for the contents.Any unauthorized use or dissemination is prohibited.
>If you are not the intended recipient of this message, then please delete it and
>
>notify the sender.
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org