Search code examples
javaspring-mvctomcatweb-applicationstime-management

How to fix java spring mvc web application run time in Apache Tomcat 6 server?


I developed an web application using java spring mvc. Now i want to deploy the application on tomcat server and want the application to run in a certain period of time in a day. Say, the application will run from 10:00 AM to 6:00 PM everyday and other time of the day the application cannot be used. I have searched if anything can be done with tomcat server 6 where i want to deploy my application but unable to get any solution or clue how to achieve the purpose. So, my question is how can i implement what i wanted to do? Any solution, samples or ideas will be much helpful to complete the task.


Solution

  • Finally i have implemented the mechanism of running my web application on tomcat server for certain period of time in a day. I used an custom interceptor by extending HandlerInterceptorAdapter of spring framework to intercept all servlet requests. Then in the preHandle function, all servlet requests have been haul and then checked current time if it is within the time period the application will run. If it is within time period, then the requests are allowed to proceed, else redirected to a specific page prompting user they can't access the application currently.