Hi everybody,
I need to create a watchdog on a page that reloads the entire page when
I detect the server has restarted.
So far, my approach is to retrieve and image from the Tapestry web app
by setting an image src field, then reloading or not based upon onload
vs.onerror event handlers. This tests the webapp and server and I can
reload the page if I receive an onload after an onerror event.
In other words....
var img = new Image();
img.onerror = imageFailed;
img.onload = imageLoaded;
failed = false;
setTimeout( doPoll, 10000);
doPoll(){
img.src = location.locationhost + "/t/testpage/" + Date.UTC(); //
to prevent image caching
}
imageFailed()
{
failed = true;
setTimeout( doPoll, 10000);
}
imageLoaded()
{
if( failed == true ){
location.reload(true);
} else {
setTimeOut(doPoll, 10000);
}
}
I *think* I need to create a Tapestry page that returns an Asset or
StreamResponse. I don't want to handle this as an event on the watched
page because I'm not sure how Tapestry will handle the event if the
server has restarted.
So, it is possible for a Tapestry page to return a streamresponse? Or
is there a better way to do this? I hesitate to use Ajax requests
because I'm not sure that I'll be able to differentiate between the
server not up yet and Tapestry not knowing what to do with old Ajax
requests from another session. Images seem easy from the Javascript
side but I'm not sure how to handle this in tapestry.
Regards,
Chuck Kring
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org