0

Message AND redirect for session timeout

asked 2013-04-22 23:40:44 +0800

iank gravatar image iank
42 4

updated 2013-04-23 16:45:38 +0800

Hi there,

I'd like to know if it's possible to somehow combine

<session-config>
     <device-type>ajax</device-type>
     <timeout-message>label:timeout</timeout-message>
</session-config>

and

<session-config>
     <device-type>ajax</device-type>    
     <timeout-uri>/timeout.zul</timeout-uri>    
</session-config>

Doing this (below) causes a redirect without a message. How can I have it redirect after the message box is closed? Thanks!

<session-config>
     <device-type>ajax</device-type>   
     <timeout-message>label:timeout</timeout-message> 
     <timeout-uri>/timeout.zul</timeout-uri>    
</session-config>
delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-04-23 10:20:04 +0800

vincentjian gravatar image vincentjian
2245 6

Hi iank,

According to the document timeout message Element.

<timeout-message> and <timeout-uri> can't be used together. But you can override the obsolute function to redirect to other page when user click cancel button.

<script><![CDATA[
zk.afterMount(function() {
    zAu.cmd0.obsolete = function (dtid, msg) {
        if (msg.startsWith("script:"))
            return $eval(msg.substring(7));

        var v = zk.Desktop.$(dtid);
        if (v && (v = v.requestPath))
            msg = msg.replace(dtid, v + ' (' + dtid + ')');

        jq.alert(msg, {
            icon: 'ERROR',
            button: {
                Reload: function () {location.reload();},
                Cancel: function () {
                    /* do anything here when click cancel */
                    location.href = 'timeout.zul';
                }
            }
        });
    }
});
]]></script>
link publish delete flag offensive edit

Comments

Thanks for the reply! Where should I put this code?

iank ( 2013-04-23 16:47:06 +0800 )edit

Hi, you can put it on any zul page for single usage or zk.xml for global usage. Check the document on how to put in zk.xml

vincentjian ( 2013-04-24 03:10:06 +0800 )edit
0

answered 2013-07-04 05:03:25 +0800

mvr1510 gravatar image mvr1510
6

My application is developed in zk. Here when ia ma accessing my application simultaneous in two browsers i am getting the message like "The server is temporarily out of service. Would you like to try again? (0)"

i would not want this message, when ever i get this message my application would redirect automatically with out any message. I have used

<session-config> <device-type>ajax</device-type>
<timeout-message>label:timeout</timeout-message> <timeout-uri>/timeout.zul</timeout-uri>
</session-config>

in zk.xml. But i am getting the message. How can i redirect my application without message.

Regards, Vasanth

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-04-22 23:40:44 +0800

Seen: 90 times

Last updated: Jul 04 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More