Saturday, January 17, 2015

A few words about session timeout.
If the logic of the application does not require frequent reloading (submitting) of the page (for example, all information manipulating and retrieving are made using AJAX calls),  and the session has expired, the latest available at the moment version of Apex (4.2.6) does not behave as we would like. Partial page refresh leaves no error messages, except one thing: updated regions are empty. Quick look at the apex.server implementation gives the answer why this happens. Session expiration errors has not yet processed. If you take a look
at the body of the response to the POST request to region refresh , you’ll see a message about an incorrect password /user name in the body of the response, but it is hard to do something with it. Application developers are trying to solve this problem by using a plugin from SkillBuilders or something like that, or try to override apex.server for handling an ajax request error. Using the plug­in master­detail, you can also encounter this problem. One of the possible solution is the creation of dynamic action, which are looking for an empty region after the report refresh, and when it happens, reloads the page, then the user is automatically redirected to the registration page. 
So, if you use classic reports on your page, you can do following:
  • Create dynamic action on page load with "Execute Javascript Code" true action
  • Add  "Execute Javascript Code" "True" action with code like
  •  That's all.
The main goal is to look for a moment when after ajax call report region become empty. When it happens, plugin simply reload page and then APEX engine redirect user to login page.
Plugin works in application which utilize 26 theme. Other themes may require changing of  js code or jQuery selector.
 
Oracle APEX dynamic action plugin "Master-detail for classic reports" released. Cоmments, bug reports are welcome. Demo https://apex.oracle.com/pls/apex/f?p=16415