How to access any HTTP session data in Oracle ADF

If you have ever wondered how to get access to any HTTP session in your ADF application this post will solve the problem.

The first step is to prepare your HttpSessionListener implementtion in a View Controller project.

 

After that register it in web.xml  file (1,2,3,4,5)

You can edit web.xml file directly:

 

Sessions are stored in HTTP_SESSIONS collection. The listener provides two additional static methods which allows you to access to the session data:

  • getHttpSessions – returns valid (current) sessions collection.
  • findHttpSession – returns session object or null if sessionId does’t exists.

 

The result

Turn on debug by uncommenting System.out lines in the listener. After login you should see something like below

 

Example

Now you are able to handle any creation and destruction of http session in your application by calling:

 

The peace of code below prints all active session’s id;

Facebooktwittergoogle_plusredditlinkedinmail

Leave a Reply

Feel free to ask me about anything!

Notify of
avatar
wpDiscuz