Question

I am using two sessions namely CCXSession and Session in my sample web object application project, here Session class is inherited from CCXSession.

For the purpose of localization I need to send the session object from Session to CCXSession, but I failed in achieving this.

I need a confirmation on below points:

  1. Is it possible to send session values from one session to another?
  2. if yes how is it possible?

and the code is:

public String getDisplayAppName() {
    String retVal = null;
    retVal = (String)((CCXSession)session())
                .localizer()
                .valueForKey(
                    currentApp
                    .applicationLink()
                    .deployAppName()
                    .displayAppName()
                );
     return retVal;
}

here I am passing the key value to valueForKey();

Can anybody help me in this issue.

Was it helpful?

Solution

As per my Java EE concepts, session values can only be transferred via request and until and unless u are passing requests between the 2 variables, you have very few options left.

out of these options you can try the following:

  • Use Application context and set it at run time and retrieve it accordingly
  • or you could use some static class with singleton pattern to pass the value to the value. since the application is in the same code base, thus let other classes access the value from ccxsession and set it in the session class.
  • You could use DB tables to store and retrieve data as needed. but this will be a performance drawback
  • lastly if possible you could look into web services which will be the worst case scenario to pursue since both sessions are in same applications.

as per me the first 2 options should work for you

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top