Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Empty ClientPreferences in ClientSession.execLoadSession after logout and re-login
Empty ClientPreferences in ClientSession.execLoadSession after logout and re-login [message #1800030] Wed, 19 December 2018 08:33 Go to next message
Miloslav Frajdl is currently offline Miloslav FrajdlFriend
Messages: 12
Registered: June 2018
Junior Member
Hello.

I have this problem:

I have execLoadSession in ClientSession class:
public class ClientSession extends AbstractClientSession {
...
	@Override
	protected void execLoadSession() {
		// pre-load all known code types
		CODES.getAllCodeTypes("cz.gpe.per.portal.app.shared");

		// The locale needs to be set before the Desktop is created.
	    String localeString = ClientUIPreferences.getClientPreferences(ClientSession.get()).get(PREF_USER_LOCALE, null);
	    LOG.info("localeString: " + (localeString == null ? "!!! NULL !!!" : localeString));
	    if (localeString != null) {
	      Locale userLocale = LocaleUtility.parse(localeString);
	      setLocale(userLocale);
	    }
	    
		setDesktop(new Desktop());
	
	}


If I login after server restart, "localeString" contains right value (i.e. "cs_CZ" or "en_US"), but if I logout and then login again (without server restart), then "localeString" is null (ClientPreferences has no elements).

Could someone advise me?
Thank you.
Re: Empty ClientPreferences in ClientSession.execLoadSession after logout and re-login [message #1800065 is a reply to message #1800030] Wed, 19 December 2018 13:28 Go to previous messageGo to next message
Miloslav Frajdl is currently offline Miloslav FrajdlFriend
Messages: 12
Registered: June 2018
Junior Member
Addition:

CientSesion.get() is null in this situation (login again after logout without server restart).

It seems that execLoadSession is called before ClientSession is initialized. But after server restart is that called after ClientSession initialize.

Where do I make a mistake, please? Thanx.
Re: Empty ClientPreferences in ClientSession.execLoadSession after logout and re-login [message #1800082 is a reply to message #1800065] Wed, 19 December 2018 16:01 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 147
Registered: September 2011
Senior Member
Hi Miloslav

I have not tested it, just guessing: Does it make a difference if you use the current instance (this) instead ClientSession.get()?
Re: Empty ClientPreferences in ClientSession.execLoadSession after logout and re-login [message #1800083 is a reply to message #1800082] Wed, 19 December 2018 16:36 Go to previous messageGo to next message
Miloslav Frajdl is currently offline Miloslav FrajdlFriend
Messages: 12
Registered: June 2018
Junior Member
Thank you for your interest, but my problem solved adding line:
initializeSharedVariables();

public class ClientSession extends AbstractClientSession {
...
	@Override
	protected void execLoadSession() {
		// pre-load all known code types
		CODES.getAllCodeTypes("cz.gpe.per.portal.app.shared");

		initializeSharedVariables();		// <<< THIS SOLVED MY PROBLEM

		// The locale needs to be set before the Desktop is created.
	    String localeString = ClientUIPreferences.getClientPreferences(ClientSession.get()).get(PREF_USER_LOCALE, null);
	    LOG.info("localeString: " + (localeString == null ? "!!! NULL !!!" : localeString));
	    if (localeString != null) {
	      Locale userLocale = LocaleUtility.parse(localeString);
	      setLocale(userLocale);
	    }
	    
		setDesktop(new Desktop());
	
	}
Re: Empty ClientPreferences in ClientSession.execLoadSession after logout and re-login [message #1800195 is a reply to message #1800083] Fri, 21 December 2018 08:25 Go to previous message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 147
Registered: September 2011
Senior Member
Ok, thank you for sharing the solution with us!
Previous Topic:How to track down an error thrown in the javascript code?
Next Topic:Deployment fails
Goto Forum:
  


Current Time: Sat Oct 19 04:25:25 GMT 2019

Powered by FUDForum. Page generated in 0.01955 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top