public interface MultiTenantHandler extends Handler<RoutingContext>
X-Tenant
Modifier and Type | Field and Description |
---|---|
static String |
TENANT
The default key used to identify a tenant in the context data.
|
Modifier and Type | Method and Description |
---|---|
MultiTenantHandler |
addDefaultHandler(Handler<RoutingContext> handler)
Add a default handler for the case when no tenant was matched.
|
MultiTenantHandler |
addTenantHandler(String tenant,
Handler<RoutingContext> handler)
Add a handler for a given tenant to this handler.
|
static MultiTenantHandler |
create(java.util.function.Function<RoutingContext,String> tenantExtractor)
Create a MultiTenant handler using a custom tenant extraction function.
|
static MultiTenantHandler |
create(java.util.function.Function<RoutingContext,String> tenantExtractor,
String contextKey)
Create a MultiTenant handler using a custom tenant extraction function.
|
static MultiTenantHandler |
create(String header)
Create a MultiTenant handler that will extract the tenant id from a given header name.
|
MultiTenantHandler |
removeTenant(String tenant)
Remove a handler for a given tenant from this handler.
|
static final String TENANT
static MultiTenantHandler create(String header)
header
- the header to lookup (e.g.: "X-Tenant")static MultiTenantHandler create(java.util.function.Function<RoutingContext,String> tenantExtractor)
tenantExtractor
- the function that extracts the tenant id from the requeststatic MultiTenantHandler create(java.util.function.Function<RoutingContext,String> tenantExtractor, String contextKey)
tenantExtractor
- the function that extracts the tenant id from the requestcontextKey
- the custom key to store the tenant id in the contextMultiTenantHandler addTenantHandler(String tenant, Handler<RoutingContext> handler)
tenant
- the tenant idhandler
- the handler to register.IllegalStateException
- In case a handler is already present for that tenant.MultiTenantHandler removeTenant(String tenant)
tenant
- the tenant idMultiTenantHandler addDefaultHandler(Handler<RoutingContext> handler)
handler
- the handler to register.Copyright © 2024 Eclipse. All rights reserved.