• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Pattern for session restart

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm working on a Struts based system which is used for vehicle diagnostics. This application has the concept of user sessions which can be suspended and restarted at an indeterminate time in the future.

On restarting a user session the application should navigate the user back to the page where he/she left off with all screen state and any internal learnt variables (e.g vehicle information) restored to their original values.

This is purely a web application with no EJB's to talk of so I cant use Entity EJBs anything like that.

I've had a fairly unsuccesful hunt round the internet but wondered if any of you guys could point me at any patterns or articles that may be useful in implementing this functionality.

TIA Graham
[ October 26, 2005: Message edited by: Graham VMead ]
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you're on your own to implement this. You'll need to save state at some point in your application. On my project we tell users that saving after every field entry or minor action is too expensive. If you shut down the browser at this point you lose data, if you get to this point we save it all. We negotiated a bit on what gets saved and when.

You'll also want to make sure the pages they want to see when they resume are accessible by HTTP GET. If they're forced to POST a request to get to the page it will be harder to resume. There were a couple threads in the Servlet forum lately that referenced the POST-redirect-GET design for this.

Speaking of which forum, the bartender may decide to move us there.

Hope that helps!
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to take a look at the Memento pattern, perhaps it gives you some ideas...
 
Graham VMead
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Stan/Ilja,

Thought I was being a bit hopeful for a magic "pattern" to solve my problems.

Stan, we've decided that state will be saved on each screen transition so any data entered on the current screen would be lost, field by field would as you say be too expensive.

Ilja, thanks I've had a look at this pattern and as you say its a good starting point but I will need to implement it in a persistent manner rather than as the usual in memory undo function

Graham
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I find your topic rather interesting.

Here's my input:

Its pretty clear that you need to 'bookmark' the state of the application (or you may call saving of the session) and return to it. You should be using the Memento Pattern to do this.

Now, about your implmentation choices, I have a few suggestions:

1. Identify 'savepoints' until which the session can be saved and the user may be able to resume the operation from this 'savepoint' on his subsequent logins. This helps you define and scope the objects you need to worry about saving, and hence makes life easier for your design.

2. Once identified, all objects must adhere to a uniform interface. this allows easier saving and reloading(using factory/builder) of the objects.

3. identify the pages which are supported for resumption of session. Do not allow saving of session (state) across all pages on the applications.

4. Persist your state using database.

5. Users may/maynot return back to their persisted states, leading to maintainance nightmares of bulk of records (or states). So, make life easier by housekeeping the state, meaning each state will expire unless used within a timeperiod. Use an expireDate (default to 30 days) for each saved state.

Do post your comments and feedbacks on this topic, I am interested to know about your final choice of design (and its implementation flavours).

Regards,
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic