You can write a javax.servlet.ServletContextListener which sends a callback of some 
sort to
your application code.  If you specify your implementation in the web.xml of a web 
application like so:

<listener>
    <listener-class>com.foo.MyListener</listener-class>
</listener>

then tomcat will call the contextInitialized method of this class as soon as the 
context is ready to process requests.

Sean

Sean Reilly
Programmer, Point2 Technologies, Inc.
(306) 955-1855
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

-----Original Message-----
From: Stefanos Karasavvidis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 05, 2002 10:55 AM
To: Tomcat Developers List
Subject: Re: [TC 4.0] How can I obtain the state of the tomcat server?


how about checking a url of the server unitl it gives a 200 response code??

Stefanos

Evans, Terry G wrote:

>I need to know when the server is "available for work".
>
>Our product does not use startup servlets nor context listeners.
>
>We display simple HTML documents on a browser once the Tomcat
>server has started.
>
>My ideal solution would be that my Java application would fire off
>the Tomcat server (we're using Runtime.getRuntime().exec() calls
>to start Tomcat and IE) and then would either check the status of
>the server or receive a callback from the server that it is ready,
>then my Java application would proceed with starting up the browser.
>
>I was hoping to use an internal tomcat feature to implement this.
>
>I've looked at CatalinaManager and CatalinaService, but I'm not
>certain of exactly what they are and what they could do for my
>situation.
>
>Thanks,
>Terry
>
>
>-----Original Message-----
>From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, September 05, 2002 11:22 AM
>To: Tomcat Developers List
>Subject: RE: [TC 4.0] How can I obtain the state of the tomcat server?
>
>
>Hi,
>"The state of the server process" can be many things.  It can be the
>server process is alive, it can be that the host/port respond to
>requests, and it can be that your app is actually available for work.
>All of these can be checked in various ways.
>
>Which one were you interested in?  What would be your ideal solution?
>
>One idea is, if you have any startup servlets or context listeners, have
>them write our a file in a specific location or a message to some log.
>Then have the process that starts the web browser poll, checking for the
>existence of this file or this message in the log.
>
>Another one is to use a 3rd tool, e.g. a JMS server, where you could
>send a message from your server to a queue, and have your java app wait
>for that message before starting the browser...
>
>You get my drift: there are many many ways to do this ;)  Were you
>looking for an internal tomcat feature?
>
>Yoav Shapira
>Millennium ChemInformatics
>
>
>  
>
>>-----Original Message-----
>>From: Evans, Terry G [mailto:[EMAIL PROTECTED]]
>>Sent: Thursday, September 05, 2002 11:01 AM
>>To: '[EMAIL PROTECTED]'
>>Subject: [TC 4.0] How can I obtain the state of the tomcat server?
>>
>>I am developing a Java application that is designed to start up a
>>    
>>
>Tomcat
>  
>
>>server and a web browser.  I don't want the web
>>browser to start up until the Tomcat server is running, but I don't
>>    
>>
>want to
>  
>
>>put in an arbitrary sleep time between starting
>>the server and starting the web browser.  Is there a way that I can
>>    
>>
>query
>  
>
>>the state of the server process?
>>
>>OS : Windows 2000 Professional
>>JDK/JRE : 1.4.0_01
>>Tomcat : 4.0
>>
>>Thanks for your time,
>>Terry
>>
>>--
>>To unsubscribe, e-mail:   <mailto:tomcat-dev-
>>[EMAIL PROTECTED]>
>>For additional commands, e-mail: <mailto:tomcat-dev-
>>[EMAIL PROTECTED]>
>>    
>>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>  
>


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


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

Reply via email to