Fork taglib ver. 1.1

    Custom JSP taglib. Lets you simulate scheduler (or cron tab requests) right in your JSP pages. The idea is very simply. You can "borrow" requests from the visitors of your site. Of course, it assumes that your site consistently get visitors at a frequency greater than your schedulerís interval. You can add to your site a hidden (invisible) iframe where src attribute points to the "scheduler". And your "scheduler" will perform the requests to your periodical tasks (implemented as JSP pages or servlets). Your periodical tasks could be long running of course, so the direct request may delays site response to the visitors. And the more practical approach is doing this processing not as part of the main request from your visitor but rather by putting in the response HTML some JavaScript that will asynchronously send you HTTP requests in the background (typically not visible to the user). Of course it only works if your application has visitors who use web browsers, not if it only consumed by programs (e.g. through RSS feeds or other XML format). Body tag Fork lets you write such a "scheduler". For example:
 


<%@ taglib uri="taglib.tld" prefix="f" %>

<f:Fork url="my_periodical_task.jsp" frequency="2"/>

this code instructs your pseudo scheduler perform a request to my_periodical_task.jsp and do it for the each second visitor. As we wrote above this "scheduler" could be attached to your site via invisible iframe. Technically taglib returns JavaScript code that will perform Ajax request to the provided URL.

You can perform requests for the each visitor or set some restrictions. For example you can perform requests for the each "n-th" visitor only (attribute frequency) or set a minimal time between the requests (attribute minTime).
 

Tags are:

Fork

Body tag lets you implement "pseudo" scheduler. Attributes are:

1) url Describes a requested URL for your task.
2) delay Optional attribute. Describes a delay (in milliseconds) for the actual request. Default value is 1000 (1 sec).
3) frequency Optional attribute. Lets you perform the request one time per the given amount of visitors. Default value is 1 (perform request for the each visitor).
4) minTime Optional attribute. Describes a minimal time (in seconds) between the requests. By default is not defined.
 

for downloading:

 Library: forktag.jar     Description: taglib.tld

 © Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.

Also in Coldtags: