The user session expires after a certain period of inactivity,
usually defined in the Web deployment descriptor.
JViews components are stored in the HTTP user session.
For example, after the user session expires, queries to update the
image fail.
The beforeSessionExpirationHandler
property
allows you to add a JavaScriptâ„¢
handler
that is invoked when the user session is about to expire.
For example, to keep the session alive as long as the
browser page is open, use the following code:
In JViews Maps
<jvmf:mapView [...] beforeSessionExpirationHandler="view.updateImage();" />
In JViews Diagrammer
<jvdf:diagrammerView [...] beforeSessionExpirationHandler="view.updateImage();"
/>
At the JViews Framework level
<jvf:view [...] beforeSessionExpirationHandler="view.updateImage();" />
This example shows how to query an image and keep the
user session alive.
Note the use of view
, the
implicit object that represents the view JavaScript proxy. The internal
timer is reset only by requests issued by Rogue Wave® JViews objects.
If the application implements other requests that do not refresh the
image, this timer could be inaccurate. To reset the timer manually,
use the following JavaScript code:
viewID.getObject().resetSessionExpirationTimer();
where viewID
is the value
of the id
property of your view component.
Note
The beforeSessionExpirationHandler
is
called two minutes before the actual session expiration time.