my dog learned polymorphism*
The moose likes Tomcat and the fly likes Shut down button? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Shut down button?" Watch "Shut down button?" New topic
Author

Shut down button?

Aaron Ting
Ranch Hand

Joined: Dec 13, 2005
Posts: 78
Hi to all,


I am currently doing on a project based on Spring and using Tomcat as the web server.

Was wondering if any of you guys have suggestion on how i can "lock" up the system by a click of a button, preventing any traffic from entering the server, on this period of time..

I thought that would be achievable using Tomcat and did some research online.. but, couldn't really get any source of information so far..

So, if you have any suggestion, kindly shed some light..

Thanks alot in advance..


Regards,
Aaron


If you can't convince them, confuse them!
Vivek Kr Singh
Ranch Hand

Joined: Oct 12, 2007
Posts: 56
Since you are using Spring, you could probably write an Interceptor which checks if the system is ready to serve requests or not. You can also use a normal http filter to achieve the same.


SCJP 1.4
Aaron Ting
Ranch Hand

Joined: Dec 13, 2005
Posts: 78
Vivek Kr Singh wrote:Since you are using Spring, you could probably write an Interceptor which checks if the system is ready to serve requests or not. You can also use a normal http filter to achieve the same.


Greetings Vivek,


Thanks for the prompt reply..

Besides the mentioned two ways, have you got any idea on how to do so using tomcat?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

Are you looking for application stop/start capabilities? That was a feature of the admin app, but should also be possible using Tomcat's JMX interface.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
The Tomcat Manager web app can be used to start/stop individual web apps; its URL is usually something like http://localhost:8080/manager/html/list


Ping & DNS - my free Android networking tools app
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

Ulf Dittmer wrote:The Tomcat Manager web app can be used to start/stop individual web apps; its URL is usually something like http://localhost:8080/manager/html/list


Providing it's installed, of course. It's no longer provided as part of the core Tomcat download.
Aaron Ting
Ranch Hand

Joined: Dec 13, 2005
Posts: 78
Thanks to all for the prompt replies..

The suggestions listed out so far have been really constructive..

However, I was actually looking into adding the functionality(shut down function) on my web application itself..

So, please kindly fill me in if there is any other suggestion in this area..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
Providing it's installed, of course. It's no longer provided as part of the core Tomcat download.

I think it's the Admin web app that's no longer provided; the Manager web app is still there.
Kees Jan Koster
JavaMonitor Support
Rancher

Joined: Mar 31, 2009
Posts: 251
    
    5
Dear Aaron,

Here is some code to programmatically stop and start the Tomcat HTTP connectors. Not sure how you would restart it from a servlet after you shut down the HTTP connector, but I'll leave that riddle for you to resolve.

http://java-monitor.com/forum/showthread.php?t=169

Hope this helps.

Kees Jan


Java-monitor, JVM monitoring made easy <- right here on Java Ranch
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Consider the use of the javax.servlet.UnavailableException

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Shut down button?
 
Similar Threads
Getting Error Starting Tomcat
How can i add tomcat server to Eclipse Galileo
Changing property file values dynamically using struts
Embedding the Netbeans Project to my site
Changing property file values dynamically using struts