ADF Solution – Logout on Closing Browser

In this blog we will implement solution for problem of Handling Browser Close Event. Browser doesn’t send any event to the server to handle such events. The requirement is to logout and invalidate the user’s session when closing browser without logging out. This process is a part of application security, and it is important for performance improvement. The trick is to use ADF Bounded Task flow’s feature Run as Dialog. I will explain this technique.

I have developed sample application LogoutOnClosingBrowser.zip

in ADF (12.2.1.2.0).

We will go through this scenario:

When user starts application in the browser session created automatically.

User Login with Username & Password:

1

1) The Login button called bounded Task flow as Dialog in external-window.

Remember to change property useWindow=”true” in the Login button, which call task flow as dialog.

2

When user try to Logout from logout button, task flow execute After Listener to Invalidate Session and the logout action is working fine.

3

2) Configuring Finalizer to bounded task flow to handle Closing Browser Event.

4

We need to differentiate between two cases: Logout normally done from Logout button and Browser Closed.

Add <af:setPropertyListener> under the logout button, to send logoutFlag_P parameter equal true to Finalizer, if Logout action done from Logout button.

3(2)

 

3) Creating Security Bean and methods like this:

Logout Method: To handle Logout action.

5

Finalizer Method: To manage finalizing of the task flow.

6

Invalidate Session Method: To kill session after logging out.

7

To logout would be simply to close browser, and the user’s session will invalidate.

8

9

Creating Complex Task Flow in ADF – Part 2

In previous blog Creating Complex Task Flow in ADF – Part 1 we talked about creating bounded task flow and using ADF Train component. In this blog we will use other advanced features of ADF task flow. Such as Save Points (Explicit). It is very useful in case we need to split or delay transaction.

The Save Point capture the state of an ADF Fusion web application at a specific instance. This allows you to save application state and can be restored later.

An Explicit save point requires an end user action to enable task flow creates a save point, such as a click button. and it is available for both bounded and unbounded task flows.

I have developed sample application ComplexTaskFlow2.zip.

in ADF (12.2.1.2.0).

For implementing Save Point:

1) Preparing Task Flow to use Save Point: After creating the task flow in previous blog, Add a Method call activity to a bounded task flow to create a save point, and add Save Point Restore activity to restore application state and data associated with the created save points.

Add a task flow parameter to pass save point information for createSavePoint method.

a

2) Configuring application to use Save Point: In the Application Resources panel, Expand the Descriptors and ADF META-INF node, and open adf-config.xml.

In the overview editor, click the Controller navigation tab and then expand the Savepoints section and select the data source of data base connection:

b

A database table named ORADFCSAVPT is used to store save points information. If this database table does not exist, it is created automatically by ADF application.

3) Creating of Save Point: Use createSavePoint method to create save point and set the time to live in seconds to one month. The default value is 86400 seconds.

2

4) Restoring of Save Point: User should select the save point from a list populated programmatically then restore it by savePointRestore activity:

3.jpg

5) Removing Save Point: After the task flow’s state has been restored, Task flow invoke Save Point Restore Finalizer to execute removeSavePoint method and remove save point.

At Run time, User start registration task:

4

User click Save Later button to create save point:

14

User select save point from a list and click Restore button:

5

Task flow’s state of selected save point is restored:

666

User click Finish to save Employee registration and go back to main page.

7

Creating Complex Task Flow in ADF – Part 1

In this blog we will use advanced features of ADF task flow. Such as Train flows, Regions, Task Flow Parameters, Managing Transaction and Reentry.

The Train component represents a series of stops. Each train stop represents a page fragment in a flow. Which helps the user to walk through these stops one at a time and take a sequential path to complete.

I have developed this sample application –ComplexTaskFlow1.zip.

in ADF (12.2.1.2.0).

We need to create Bounded task flow Register_task-flow-definition.xml, where the end user can enter and review information to complete the Registration task.

a

The train stops are:

  • Personal
  • Job
  • Review

After creating the task flow, add activities to it, and configure control flow between the activities. and add Return activities to call Commit or Rollback transaction and go to the calling page.bTo display name in a train stop: In the task flow’s structure window, Insert Inside train-stop > Display Name and enter  the value in the property inspector.

There is a little trick when you are creating a Train flow based on same entity you need to skip validations on the page definition: SkipValidation=”true”.

1

At Run time, User click the Register button to start registration of new Employee.

The current train stop is the first train stop:

2

User navigate to the second train stop:

3

User navigate to the third train stop:

4

User click Finish to save new employee and go back to main page.

5