use of com.yahoo.vespa.config.server.SuperModelRequestHandler in project vespa by vespa-engine.
the class RpcServer method createGetConfigContext.
/**
* Returns the context for this request, or null if the server is not properly set up with handlers
*/
public GetConfigContext createGetConfigContext(Optional<TenantName> optionalTenant, JRTServerConfigRequest request, Trace trace) {
if ("*".equals(request.getConfigKey().getConfigId())) {
return GetConfigContext.create(ApplicationId.global(), superModelRequestHandler, trace);
}
// perhaps needed for non-hosted?
TenantName tenant = optionalTenant.orElse(TenantName.defaultName());
if (!hasRequestHandler(tenant)) {
String msg = Tenants.logPre(tenant) + "Unable to find request handler for tenant. Requested from host '" + request.getClientHostName() + "'";
metrics.incUnknownHostRequests();
trace.trace(TRACELEVEL, msg);
log.log(LogLevel.WARNING, msg);
return null;
}
RequestHandler handler = getRequestHandler(tenant);
ApplicationId applicationId = handler.resolveApplicationId(request.getClientHostName());
if (trace.shouldTrace(TRACELEVEL_DEBUG)) {
trace.trace(TRACELEVEL_DEBUG, "Host '" + request.getClientHostName() + "' should have config from application '" + applicationId + "'");
}
return GetConfigContext.create(applicationId, handler, trace);
}
Aggregations