running! a servlet at tomcat startup 2007-11-05 - By loredana loredana
Back ok. long story short:
my web sites is formed of chunks of html-frames ...all these frames have content from a database. So to shorten page loading time, I used a cache system (Ehcache ....similar to OSCache for those who heard/used cache before). So I have a servlet that fills the cache, and the index.html loads the frames from cache). Problem is....when the server is restarted or stoped, the cache is emptyed and after restart I have to re-call the servlet that fills it. It would be perfect if every time I restart tomcat this servlet to be called autmatically. In case ur wondering why I used a servlet to fill the cache is because I need some variables like request.getContenxtPath, getRealPath() etc.
hope you understood why I need to do this. A really big thanks to the people that answered so far. Helps me a lot!
-- -- Original Message ---- From: Wade Chandler <hwadechandler-apache@(protected)> To: Tomcat Users List <users@(protected)> Sent: Monday, November 5, 2007 4:44:33 PM Subject: Re: running! a servlet at tomcat startup
I can see why you might want to load on startup, but the ability to actually perform a get when there is not client makes no sense at all to me. What exactly are you planning to achieve by doing such a thing?
Wade
-- -- Original Message ---- From: loredana loredana <loredana888888@(protected)> To: users@(protected) Sent: Monday, November 5, 2007 3:32:01 AM Subject: running! a servlet at tomcat startup
This issue is a classic one already I think. I've googled it and haven't found anything that could help solving this problem. I'm probably not the one to think about this but...if you would add the <load-on-startup>1</load-on-startup> to a servlet, and from the init() method you would somehow try to call the doGet() method, wouldn't that do it? wouldn't that run the servlet at startup? did anybody try this already? I am trying to do this but I'm having some problem creating HttpServletRequest and Response objects so I can call doGet(). So if anyone did this already, pls let me know how this issue can be fixed! 10x a lot!
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To start a new topic, e-mail: users@(protected) To unsubscribe, e-mail: users-unsubscribe@(protected) For additional commands, e-mail: users-help@(protected)
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To start a new topic, e-mail: users@(protected) To unsubscribe, e-mail: users-unsubscribe@(protected) For additional commands, e-mail: users-help@(protected)
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To start a new topic, e-mail: users@(protected) To unsubscribe, e-mail: users-unsubscribe@(protected) For additional commands, e-mail: users-help@(protected)
|
|