2

Session Timeout on Upload Button [closed]

asked 2013-07-12 18:38:48 +0800

d2013 gravatar image d2013
21 1

I have a situation in which a user may upload a file after leaving their browser temporarily, which might result in a session timeout. I'm looking for a way to handle this gracefully. If a user attempts to upload a file they're prompted with a ZK messagebox with the following message:

"The server is temporarily out of service."

I would like to be able to either override this behavior, disable it completely, or change the message to something that sounds a little less severe since it's only a session timeout.

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by ashishd
close date 2014-01-13 06:26:42

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-07-16 10:15:13 +0800

iamsudhir4u gravatar image iamsudhir4u flag of India
545 7
http://corejavasupport.bl...

Create a class which is extending Initiator and check whether session is alive or not in doInit method.

public class SessionMonitor implements Initiator {

public void doAfterCompose(Page page) throws Exception {
}

public void doInit(Page page, Map args) throws Exception {
Session session = Executions.getCurrent().getDesktop().getSession();
// check whether session is alive or not.
// if session not alive then throw an exception(create your own exception)
throw new CustomException("The server is temporarily out of service."); }

public boolean doCatch(Throwable ex) throws Exception {
return false;
}

public void doFinally() throws Exception {        
}

Make entry of this SessionMonitor class in ZK.XML.

<listener>
<listener-class>com.test.SessionMonitor 
</listener-class>
</listener>
link publish delete flag offensive edit

Comments

good one !!

jatindersingh ( 2013-07-16 10:22:56 +0800 )edit

I'm not sure if I've explained my problem correctly. In my case the page is already loaded, and the page has been initiated. A user may then attempt to upload a file after the session has timed out. After the file is attempted to be uploaded to the server is when the problem occurs.

d2013 ( 2013-07-16 16:00:28 +0800 )edit
1

Is it like that you want to handle the exception that occurs if a user wants to upload a file and the session has expired.In that case when user tries to upload the file ,then you can check whether session is alive or not.

nsharma ( 2013-07-17 10:25:18 +0800 )edit

Execution doesn't seem to reach my onUpload listener in this situation. As a fix, I've also implemented an onclick listener for this button which does nothing. A user will be redirected to a timeout page when clicking the upload button instead of seeing the cryptic error message.

d2013 ( 2013-07-17 15:14:25 +0800 )edit

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-07-12 18:38:48 +0800

Seen: 14 times

Last updated: Jul 16 '13

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