What if your web application requires some periodical process? It is good when your hosting provides some kind of cron tab scheduler, lets you invoke your own application, but to be honest it is not widely used option.
Here we are describing one trick lets you deploy the scheduler (well – pseudo scheduler) right in your web application.
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).
So you can add to your site some hidden frame:
<iframe style="display:none" src="my_scheduler.jsp"></iframe>
my_scheduler.jsp implements your pseudo scheduler. For the above mentioned approach (return the code for Ajax request to the real task) you can deploy Fork taglib from Coldtags suite. So your pseudo scheduler can simply deploy this taglib:
<%@ taglib uri="taglib.tld" prefix="f" %>
<f:Fork url="my_periodical_task.jsp"/>
where my_periodical.jsp task is your real periodical task. Taglib simply returns JavaScript code that performs asynchronous request to the real task with approximately one second (it is configurable of course) delay
Friday, June 27, 2008
Sunday, June 22, 2008
Telco articles
Telco developers are welcome to review our article about a new approach for service development. Shortly, we are suggesting implement IMS-related services right now, on the existing networks and our practical experience shows the practical possibilities for that. IMS itself is not a goal. It is a tool that may help to achieve some significant goals in the services area. So the conclusion is obvious – if services are the real goal, why do not start with them right now? Read more here
Labels:
telecom 2.0
Thursday, June 19, 2008
Cache per user
Cache taglib lets you describe dependencies for your cached chunks of data. For example, you can cache data for requests parameters, user agents and headers. The latest version lets you describe cache that vary by the cookies. So if you are keeping some user's identification in the cookies this feature lets you cache data per users too.
E.g. cache data per sessions:
<cache:Cache scope="session" key="mykey" varyByCookie="jsessionid">
your cached data
</cache:Cache>
E.g. cache data per sessions:
<cache:Cache scope="session" key="mykey" varyByCookie="jsessionid">
your cached data
</cache:Cache>
Wednesday, June 18, 2008
Big map
Big map - a full screen Google map with search bar. By the way, this mashup uses Tiny URL taglib from Coldtags suite.
Monday, June 16, 2008
Twitter taglib
Twitter taglib has been updated. Now you can update your time line or send direct messages right from JSP (or Coldfusion) pages.
Tuesday, June 03, 2008
JSOS 5.85
JSOS ver. 5.85 is ready. At the first hand provides a lot of improvements for filters. Also check out optimized components for images. E.g. Image View servlet.
Labels:
JSOS
Subscribe to:
Posts (Atom)