• Aug 30, 2016

For one of my projects recently, I put together a small custom control that I sure wish I had thought to do years ago: a "keep alive and alert" control. For a long time now, the Extension Library has had a "keepAlive" control, which keeps a page session (and, usually, authentication) alive while the user has the browser window open, avoiding the otherwise-common issue of someone sitting on a page "too long" and having it break underfoot. However, that doesn't cover the edge cases: the user putting their computer to sleep and waking it with the same page open, the server rebooting, a server cluster failover, expiring SSO token, or so forth. In those cases, the problem will fall more or less "silently" to the JavaScript console, and the page will just be mysteriously unresponsive.

This control has a similar starting point, where it will ping the server periodically (every 10 seconds in this case), but will also display a Bootstrap modal alert when things go awry. It's not too picky about the cause of the problem: since usually the only practical solution is to reload the page, it just says that and leaves it there. This could also be redone to be more efficient like the ExtLib one (which would avoid the page recomputation inherent in the partial refresh), and it may not cover the case of authorization expiring in an app that allows anonymous access, but it should do the job nicely in the normal case:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
	<xp:div id="keepAliveAndAlert" style="display: none"></xp:div>
		window.__keepAliveAndAlert = setInterval(function() {
			XSP.partialRefreshGet("#{id:keepAliveAndAlert}", {
				onComplete: function() {
					// Good!
				onError: function() {
						backdrop: 'static'
					window.__keepAliveAndAlert = null;
		}, 10 * 1000);
	<xp:div style="display: none" id="keepAliveAndAlertError" styleClass="modal fade error-modal" role="dialog">
		<div class='modal-dialog'><div class='modal-content'>
			<div class='modal-header'><h4 class='modal-title'>Page Session Expired</h4></div>
			<div class='modal-body'>
				<p>Your page session has expired.</p>
				<p>Please&#160;<a href="javascript:location.reload()">reload</a>&#160;the page to continue working.</p>
Aug 30, 2016
Paul Withers

That's something I've always liked about Vaadin. Out of the box it gives a nice message if the server is not available for whatever reason.

Oct 10, 2017

For one of my ventures as of late, I set up together a little custom control that I beyond any doubt wish I had thought to do years prior: a keep alive and ready control. For quite a while now, the Extension Library has had a keep Alive control, which keeps a page session alive while the client has the program window open, custom coursework help maintaining a strategic distance from the something else basic issue of somebody sitting on a page too long and having it break underneath.

Dec 4, 2017
torrent vpn

very interesting site..good work

torrent vpn

Dec 15, 2017
read more

Windows Check Tool runs automatically when an abrupt shutdown or in case if the file system gets corrupted. https://windowslibrary.org/

Jan 10, 2018
Henry Carter

As senior ASP.net developer of Best Dissertation Writing Help Services. I assume that I have clear my all bugs issues of programming has been clear by reading this on daily basis. 

Jan 10, 2018

That is something I've generally preferred about Vaadin. Out of the container, it gives a decent message if the server isn't accessible for reasons unknown.


ac maintenance

Jan 16, 2018

Game Hacker is an android app which is very popular that is used to hack or manipulate many popular games.

​game hacker app for android

Post New Comment