Search in sources :

Example 1 with SuperModelRequestHandler

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);
}
Also used : RequestHandler(com.yahoo.vespa.config.server.RequestHandler) SuperModelRequestHandler(com.yahoo.vespa.config.server.SuperModelRequestHandler) TenantName(com.yahoo.config.provision.TenantName) ApplicationId(com.yahoo.config.provision.ApplicationId)

Aggregations

ApplicationId (com.yahoo.config.provision.ApplicationId)1 TenantName (com.yahoo.config.provision.TenantName)1 RequestHandler (com.yahoo.vespa.config.server.RequestHandler)1 SuperModelRequestHandler (com.yahoo.vespa.config.server.SuperModelRequestHandler)1