I am seeing the following behavior when fetching tenant domain from
CarbonContext APIs.

CarbonContextHolder.getCurrentCarbonContextHolder().getTenantDomain()
returns NULL.
CarbonContext.getCurrentContext().getTenantDomain() returns NULL.
SuperTenantCarbonContext.getCurrentContext().getTenantDomain() returns NULL.

But getTenantId() is always successful returning -1234. Now if I try below
it gives super tenant domain.

SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true) returns
the super tenant domain.

Afterwards above three methods will also return the super tenant domain
properly. So does this mean we have to use the variant accepting the
boolean (boolean resolve) always to be sure that the domain gets resolved
properly? Any best practices regarding the CarbonContext API usage would be
helpful in this regard. I am invoking these methods during component
initialization. IIRC it used to be the case that component initialization
codes did not run as any tenant in previous carbon version. I assume this
is not the case anymore with recent Tomcat OSGification changes?

Regards
Buddhika
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to