public class MultiTenantHandler extends Object implements Handler<RoutingContext>
X-Tenant
original non RX-ified interface using Vert.x codegen.| Modifier and Type | Field and Description |
|---|---|
static io.vertx.lang.rx.TypeArg<MultiTenantHandler> |
__TYPE_ARG |
static String |
TENANT
The default key used to identify a tenant in the context data.
|
| Constructor and Description |
|---|
MultiTenantHandler(MultiTenantHandler delegate) |
MultiTenantHandler(Object delegate) |
| 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.
|
boolean |
equals(Object o) |
MultiTenantHandler |
getDelegate() |
void |
handle(RoutingContext event)
Something has happened, so handle it.
|
int |
hashCode() |
static MultiTenantHandler |
newInstance(MultiTenantHandler arg) |
MultiTenantHandler |
removeTenant(String tenant)
Remove a handler for a given tenant from this handler.
|
String |
toString() |
public static final io.vertx.lang.rx.TypeArg<MultiTenantHandler> __TYPE_ARG
public static final String TENANT
public MultiTenantHandler(MultiTenantHandler delegate)
public MultiTenantHandler(Object delegate)
public MultiTenantHandler getDelegate()
public void handle(RoutingContext event)
handle in interface Handler<RoutingContext>event - the event to handlepublic static MultiTenantHandler create(String header)
header - the header to lookup (e.g.: "X-Tenant")public static MultiTenantHandler create(java.util.function.Function<RoutingContext,String> tenantExtractor)
tenantExtractor - the function that extracts the tenant id from the requestpublic static 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 contextpublic MultiTenantHandler addTenantHandler(String tenant, Handler<RoutingContext> handler)
tenant - the tenant idhandler - the handler to register.public MultiTenantHandler removeTenant(String tenant)
tenant - the tenant idpublic MultiTenantHandler addDefaultHandler(Handler<RoutingContext> handler)
handler - the handler to register.public static MultiTenantHandler newInstance(MultiTenantHandler arg)
Copyright © 2021 Eclipse. All rights reserved.