aspose file tools*
The moose likes Servlets and the fly likes Invoking a servlet on a time based event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Invoking a servlet on a time based event" Watch "Invoking a servlet on a time based event" New topic
Author

Invoking a servlet on a time based event

Harshavardhan Joshi
Greenhorn

Joined: Sep 27, 2011
Posts: 7

Hi All,

I wanted to know that is there any provision in Listener interface using which I can invoke a Servlet.

Its like scheduling a task at regular intervals.

Currently I am using Resin server which provides this kind of functionality.

You just have to add some tags in your DD as given below.



But I need something which will not be server/container specific.

Thanks.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

You could use the Timer service to call another class/method. However, a servlet's doPost/doGet require you to have an Http request open. Which you don't on a timer event. In other words, it would be more logical to call a non-servlet method. You could extract the logic from your servlet into a helper class/method that doesn't depend on the servlet API.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Hi,
Please check usage of Quartz that may be useful to you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invoking a servlet on a time based event