From Documentation

Jump to: navigation, search


[Default: false]

It specifies whether to keep the session alive, when receiving the onTimer event.

A session is considered as timeout (and then invalidated), if it doesn't receive any client requests in the specified timeout interval (see the session-timeout element for more information).

By setting this option to true, the onTimer event, just like any other events, will reset the session timeout counter (and then keep the session alive until timeout). Notice that, if this option is true and the timer is shorter than the session timeout, the session won't be expired.

By default, if this option is false, it means the onTimer event is ignored when handling the session timeout. In other words, the session will expire if no other event is received before timeout.

Notice that ZK will optimize the onTime event such that it won't be sent if there is no event listener at the server (for better performance). In other words, the following statement won't fire any onTimer event to the server.

<timer repeats="true" running="true" delay="1000"/>

Thus, if you have to add an event listener to enable the timer-keep-alive feature, such as

<timer repeats="true" running="true" delay="1000" onTimer=""/>

5.0.6 and Earlier

For 5.0.6 and earlier, the above statement will cause the interpreter to start and thus cause some performance penalty. However, for better performance, you could use a composer as follows.

<timer repeats="true" running="true" delay="1000" apply="foo.DoesNothingTimer"/>

And, then implement foo.DoesNothingTimer as follows.

public class DoesNothingTimer implements Composer {
    public void doAfterCompose(Component comp) throws Exception {
        comp.addEventListener("onTimer", new SerializableEventListener() {
            public void onEvent(Event event) throws Exception {
                //does nothing

Version History

Last Update : 2011/8/8

Version Date Content

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.

You got stuck here?
Let us know how we can improve this page
For specific questions please use the forum