On Mar 30, 2009, at 13:18, David Avendasora wrote:

This is the approach I was thinking of. Have the client keep track of how long since the last server communication (I have no idea how to do that...) and set a timer based on the session timeout value. It's only job would be to give the user a few minutes warning to finish what they were working on, extend the session (if possible, a ping as you describe below would be perfect) or quit.

Right now this isn't a huge issue as most users are used to the concept of a Web session timing out without warning so they seem to be able to grasp that a desktop application can do the same. Some websites warn you they are about to timeout, but not all.

I implemented this too, it is in WOJCKit, available at:

http://web.mac.com/flor385/eSwamp/software/files/WOJCKit.zip

The above discussed functionality is in the org.wojc.client.SessionTimeoutTracker class. It does not provide actual handling, as that can differ from app to app, but allows you to easily setup session timeout tracking, and the execution of an arbitrary action X amount of time before the session will expire.

Works as far as I have tested it.

F

p.s. - here is also an adaptation of the code I use in one of my apps as a reaction to a timeout approaching, as an example.

        public static void showSessionTimeoutMessage(int allowedTimeMinutes){
                
                // TODO internationalize
                
                // prepare values to be displayed in the dialog
                String title = "Connection will expire...";
String message = LocUtilities.fillUp("The connection to the server will expire in {1} minutes, and the application will quit. Unsaved changes will be lost.\nWhat to do?",
                                allowedTimeMinutes);
                String quit = "Quit";
                String extend = "Refresh connection";
                
                // create the option pane and it's dialog
                JOptionPane op = new JOptionPane(message, 
JOptionPane.WARNING_MESSAGE,
                                0, dvisIcon, new Object[]{quit, extend}, quit);
                final JDialog dialog = op.createDialog(parentComponent, title);
                
                // schedule automatic closing of the dialog, if still visible
                WOJCKitUtil.SCHEDULED_EXECUTOR_SERVICE.schedule(new Runnable(){

                        public void run(){
                                if( ! SwingUtilities.isEventDispatchThread())
                                        SwingUtilities.invokeLater(this);
                                else 
if(dialog.isVisible())dialog.setVisible(false);
                        
                        }}, (allowedTimeMinutes * 60) - 10, TimeUnit.SECONDS);
                
                // make the dialog visible
                dialog.setVisible(true);
                
                // what did the user choose?
                if(op.getValue() == extend)
                        RemoteMethodInvoker.ping();
                else
                        System.exit(0);
        }
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to