cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Understanding GetGlobalSessionValues in relation to JSESSIONID

nikkolasep
12-Amethyst

Understanding GetGlobalSessionValues in relation to JSESSIONID

Hi all,

 

recently I have some doubts about whether one User can have multiple Session when accessing the same mashups?

 

Real case scenario:
1. I open the same mashup twice 

2. I change a session variable from one mashup > 

3. I run the service GetGlobalSessionValues and the session variable changes accordingly

4. I refresh my second mashup and the widget that is bound to the same session variable remains its value independently to the actual session variable shown in GetGlobalSessionValues 

 

So my questions are:

1. Can one user have multiple JSESSIONID?

2. Which service can keep tracking of the session variables of each JSESSIONID?

3. Which service can be executed to find how many and which are the currently active sessions of one particular user?

 

Best,

 

ACCEPTED SOLUTION

Accepted Solutions

For each question:

  1. Yes, if they access the platform from a private tab for example.
  2. All services take place in the context of a specific JSESSIONID (separation is provided by Tomcat, using the session concept). This is transparent to the underlying service, and as a result, there's no application-level mapping visible between JSESSIONID and a specific session variable.
  3. Resources["CurrentSessionInfo"].GetActiveUsers(params) gets all the active sessions for all the users. If you logged in twice, your user will appear twice, so you can use it through filtering to get how many active sessions you have for an user. Though, it's worth to mention that there is no mapping to JSESSIONID (for the above reason, also the JSESSIONID)

To summarize, if the user is accessing from the same JSESSIONID, he/she will always have access to the same session parameter value.

What happens in your case:

  • When you set a session param in Session 1, the label gets updated internally, via the Mashup's runtime.JS. The value is also set server side, via "SetGlobalSessionStringValue" (as an example)
  • However, on Session 2, the reason you don't see the value for Session Param you set on 1 is because:
    • on mashup load, the runtime.js does not execute any "get" call to the server to retrieve its existing value
    • also, on the same load, if a textbox is bound to the session param directly, it will automatically set the session param with its default value (just look at Developer Tools and see that SetGlobalSession ....)
    • there's no way to force reading the value of the session param if you bind directly to the Session Parameter from the Session tab. If you bind the value on the result of "GetGlobalSessions..." and trigger that service accordingly, you should see the same value regardless of the mashup

View solution in original post

1 REPLY 1

For each question:

  1. Yes, if they access the platform from a private tab for example.
  2. All services take place in the context of a specific JSESSIONID (separation is provided by Tomcat, using the session concept). This is transparent to the underlying service, and as a result, there's no application-level mapping visible between JSESSIONID and a specific session variable.
  3. Resources["CurrentSessionInfo"].GetActiveUsers(params) gets all the active sessions for all the users. If you logged in twice, your user will appear twice, so you can use it through filtering to get how many active sessions you have for an user. Though, it's worth to mention that there is no mapping to JSESSIONID (for the above reason, also the JSESSIONID)

To summarize, if the user is accessing from the same JSESSIONID, he/she will always have access to the same session parameter value.

What happens in your case:

  • When you set a session param in Session 1, the label gets updated internally, via the Mashup's runtime.JS. The value is also set server side, via "SetGlobalSessionStringValue" (as an example)
  • However, on Session 2, the reason you don't see the value for Session Param you set on 1 is because:
    • on mashup load, the runtime.js does not execute any "get" call to the server to retrieve its existing value
    • also, on the same load, if a textbox is bound to the session param directly, it will automatically set the session param with its default value (just look at Developer Tools and see that SetGlobalSession ....)
    • there's no way to force reading the value of the session param if you bind directly to the Session Parameter from the Session tab. If you bind the value on the result of "GetGlobalSessions..." and trigger that service accordingly, you should see the same value regardless of the mashup
Announcements


Top Tags