|
Re: Scout app multi deployment - differents options ? [message #1835074 is a reply to message #1835030] |
Tue, 24 November 2020 10:47 |
|
Hi
Looks like a good idea to make your application multi-tenant capable.
When Scout creates a ClientSession you have access to all request parameters, see UiSession.java:
protected IClientSession createAndStartClientSession(Locale locale, UserAgent userAgent, Map<String, String> sessionStartupParams) {
return BEANS.get(ClientSessionProvider.class).provide(ClientRunContexts.copyCurrent()
.withLocale(locale)
.withUserAgent(userAgent)
.withProperties(sessionStartupParams)); // Make startup parameters available at {@link PropertyMap#CURRENT} during client session is starting.
}
So in MyProjectClientSession#execLoadSession you could do this:
m_tenantId = PropertyMap.CURRENT.get().get("tenantId");
You can access the ClientSession object in your client application from everywhere, so at this point you have the tenantId where needed, for instance to call your service methods, where tenantId is a parameter you simply pass each time.
Another solution is to set the tenantId on the ServerSession. For that you could try something like described in the the link you've posted, or you could simply define a method startup(String tentantId) on a service, which you call once, when your client application starts. The implementation of this method would set the tenantId on the server session instance, and use it where needed.
André
Eclipse Scout Homepage | Documentation | GitHub
[Updated on: Wed, 25 November 2020 06:27] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03161 seconds