0

We are trying to get the Session object by using session id with the following constructor.

WOSession session = new WOSession(sessionID);

Is this code will get the existing session or else it will create a new session with that id. If it creates a new session we will have 2 sessions with the same sesion ID.

So please let me know, how to get the existing session by using sessionID?

1 Answers1

1

Usually you would just access the session in your WODirectAction or WOComponent subclass via session() or existingSession()? Why do you need to restore it manually?

If you really want to do it manually, maybe you are looking for something like this:

WOSessionStore st = application().sessionStore()
sn = st.checkOutSessionForID(snID, context())
...
st.checkInSessionForContext(snID)

Or (if you know what you are doing ;-)

st.restoreSessionForID(snID, context())
hnh
  • 13,957
  • 6
  • 30
  • 40
  • Actually what happening is, While login to my application,we will have two frames will be there in screen.In one frame, there is links to access the other applications.That links will call direct action of the application, which we want to access.That DA will navigate you to the home screen of that app.So It will create another session in the other frame.if we click on logout, we can terminate only one session, which will be there in that frame. Resulting, after logout, if we use back button in browser, we are able to access the application easily. So we should have to terminate both sessions. – Butchi Reddy Velagala Sep 11 '14 at 06:52
  • I don't fully understand what you are saying here. (maybe to restate the obvious:) But if you have two sessions in one browser, you also need to make sure the session-id is not stored in a cookie but in the URLs. – hnh Sep 11 '14 at 09:55
  • We have multiple apps(projects). To access those from single navigation page, we created an app. Navigation app contains login page and home page. After login, the home page will divided into two frames. The first frame contains links access the apps and second is empty(welcome message). When ever, the link has clicked, it will call the corresponding application's DirectAction(it will navigate to the app home screen) and will be displayed in 2nd frame(replacing welcome message). So we have 2 sessions for 2 apps(navigation app and the clicked app). – Butchi Reddy Velagala Sep 11 '14 at 11:37
  • if we clicked on Logout which is in the 2nd frame, we can terminate only the session which is in 2nd frame and navigate to logout message screen in complete browser. After this, if we will click on back button in browser, it will go to the Navigation app home screen(that is two frames with list of apps and welcome message). Because we didn't terminate the session of first frame(Navigation app's session).So the unauthorized user can access my application. For this purpose i would like to terminate both the sessions, when clicked on logout. – Butchi Reddy Velagala Sep 11 '14 at 11:48