use of com.yahoo.vespa.config.server.RequestHandler in project vespa by vespa-engine.
the class HttpGetConfigHandler method handleGET.
@Override
public HttpResponse handleGET(HttpRequest req) {
HttpConfigRequest request = HttpConfigRequest.createFromRequestV2(req);
RequestHandler requestHandler = HttpConfigRequests.getRequestHandler(tenants, request);
HttpConfigRequest.validateRequestKey(request.getConfigKey(), requestHandler, request.getApplicationId());
return HttpConfigResponse.createFromConfig(resolveConfig(request, requestHandler));
}
use of com.yahoo.vespa.config.server.RequestHandler in project vespa by vespa-engine.
the class HttpListConfigsHandler method handleGET.
@Override
public HttpResponse handleGET(HttpRequest req) {
HttpListConfigsRequest listReq = HttpListConfigsRequest.createFromListRequest(req);
RequestHandler requestHandler = HttpConfigRequests.getRequestHandler(tenants, listReq);
ApplicationId appId = listReq.getApplicationId();
Set<ConfigKey<?>> configs = requestHandler.listConfigs(appId, Optional.empty(), listReq.isRecursive());
String urlBase = getUrlBase(req, listReq, appId, zone);
Set<ConfigKey<?>> allConfigs = requestHandler.allConfigsProduced(appId, Optional.empty());
return new ListConfigsResponse(configs, allConfigs, urlBase, listReq.isRecursive());
}
use of com.yahoo.vespa.config.server.RequestHandler 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);
}
use of com.yahoo.vespa.config.server.RequestHandler in project vespa by vespa-engine.
the class HttpListNamedConfigsHandler method handleGET.
@Override
public HttpResponse handleGET(HttpRequest req) {
HttpListConfigsRequest listReq = HttpListConfigsRequest.createFromNamedListRequest(req);
RequestHandler requestHandler = HttpConfigRequests.getRequestHandler(tenants, listReq);
ApplicationId appId = listReq.getApplicationId();
HttpConfigRequest.validateRequestKey(listReq.getKey(), requestHandler, appId);
Set<ConfigKey<?>> configs = requestHandler.listNamedConfigs(appId, Optional.empty(), listReq.getKey(), listReq.isRecursive());
String urlBase = HttpListConfigsHandler.getUrlBase(req, listReq, appId, zone);
Set<ConfigKey<?>> allConfigs = requestHandler.allConfigsProduced(appId, Optional.empty());
return new HttpListConfigsHandler.ListConfigsResponse(configs, allConfigs, urlBase, listReq.isRecursive());
}
Aggregations