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

[EMAIL PROTECTED] 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)
[EMAIL PROTECTED]




"Peter Guyatt" <[EMAIL PROTECTED]> 16/02/2004 14:26 Veuillez r�pondre � "Tomcat Users List"



       Pour :  "Tomcat Users List" <[EMAIL PROTECTED]>
       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:[EMAIL PROTECTED]
Sent: 16 February 2004 12:38
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to