tags:

views:

37

answers:

1

Bear with me so I can explain the layout of my problem. I am working on a website/web application that involves customers searching for real estate information. One feature on the website involves the customer performing a search on one page(well call this page A) and the following page(Page B) returns a list of line items that represent real estate information(agents,homes,etc).

Following the customer being able to view this list of information, they can select "View Profile" to view one of these line items of real estate information. This will then bring them to a page to view a profile(Page C) of the selected information.

The problem I am having is in designing/implementing one of the specifications for this feature. The requirements state that once a customer has proceeded to Page B where they are viewing the information. If they do not choose to go to Page C then an email needs to be sent. They can go back and forth between A and B as many times as they want, but if they fail to choose to go to the next step, then an email needs to be sent.

I apologize if this is a bad description, but I am unfortunately unable to give a more detailed description of the problem. I hope I was able to explain this well enough to understand.

+1  A: 
  • Maintain a state for each http session. Have 3 session states - 'VisitedA', 'VisitedB' and 'VisitedC'. The start state when the user lands on PageA is 'VisitedA'. Once the user moves to PageB, change the state to 'VisitedB' and Once the user moves to PageC, change the state to 'VisitedC'.
  • Maintain the time of last activity for each http session by recording the timestamps for GET, POST or other events on the site.
  • Decide on a threshold duration of inactivity, say 'ThresholdTime', after which the user will be considered to have abandoned the site. For example, if 'ThresholdTime' is 30 minutes, then if the times of last activity for an http session is older than 30 minutes, the associated user will be considered to have abandoned the site.
  • Use a scheduler API e.g. Quartz and schedule a job that will look at the stored data for all http sessions and find out the sessions whose period of inactivity is greater than 'ThresholdTime' and whose state is 'VisitedB'. It will then sends emails to the users associated with those http sessions.

Note that you'd need to maintain the time of last activity and state for each http session. You will have to look for the suitable place to store this data e.g. in a HttpSession table.

Samit G.