Created
May 24, 2016 10:15
-
-
Save HDBandit/98e9e9931a7f6953af4739dbab1545d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RequestContextHolderUtils { | |
private static final String DEFAULT_TENANT_ID = "tenant_1"; | |
public static final String getCurrentTenantIdentifier() { | |
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); | |
if (requestAttributes != null) { | |
String identifier = (String) requestAttributes.getAttribute(CustomRequestAttributes.CURRENT_TENANT_IDENTIFIER,RequestAttributes.SCOPE_REQUEST); | |
if (identifier != null) { | |
return identifier; | |
} | |
} | |
return DEFAULT_TENANT_ID; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment