WebSphere Commerce HttpSession Manage open page with exist Session

354 Views Asked by At

I've a problem with WebSphere Commerce and HttpSession. If I close browser page and then I re-open it I continue to the last session, until now no problem. When I do the first logon I send my user data to a program to trace my action but if I close and I re-open browser page the trace program "lost" session and the system not send my data to the trace program because I'm already logged.

How I can know when the browser page is open with a exist session?

I tried with a HttpSessionListener implementing the methods sessionCreated and sessionDestroyed but sessionCreated method is call only when I logon.

Any idea? I thinking to use a Listener or a Filter.

Thanks to all!

Thanks @Ranjith V for response.

I mean, I login in WCS then when I land in browser page there is a JS that know if I just logged and then it send my user data (user.123456.en) to a external system. This system trace my actions. When I close the browser I lost session with external system but in WCS my session continue. When I open a random page in WCS, as Home page or After sales, I already logged and JS not understand that must send my user data to external system. I need insert a variable in session if I open page and continue a exist session. The problem is here, how I know that this is a new browser session?

There is a java class that check if I'm logged and continue a session? If there is I extend it and insert my variable here and at last JS know if it must send data.

I hope I'm making myself clear.

Thanks!

1

There are 1 best solutions below

0
On

I didn't quite get what you are trying to ask and what you mean by trace program. But you can use cookies to identify the session

How I can know when the browser page is open with a existing session?

WCS handles session using cookies. If you look at the request cookies, you know whether the user is authenticated or not. Look at the below article for more details on session handling

https://www.ibm.com/support/knowledgecenter/en/SSZLC2_7.0.0/com.ibm.commerce.admin.doc/concepts/csesmsession_mgmt.htm

I think you would need to use one of the below cookies

WC_SESSION_ESTABLISHED or WC_AUTHENTICATION_ID