use of com.yahoo.vespa.config.server.http.NotFoundException in project vespa by vespa-engine.
the class HttpProxy method get.
public HttpResponse get(Application application, String hostName, String serviceType, String relativePath) {
HostInfo host = application.getModel().getHosts().stream().filter(hostInfo -> hostInfo.getHostname().equals(hostName)).findFirst().orElseThrow(() -> new NotFoundException("Failed to find host " + hostName));
ServiceInfo service = host.getServices().stream().filter(serviceInfo -> serviceType.equals(serviceInfo.getServiceType())).findFirst().orElseThrow(() -> new NotFoundException("Failed to find any service of type " + serviceType + " on host " + hostName));
// "http" and "state" seems to uniquely identify an interesting HTTP port on each service
PortInfo port = service.getPorts().stream().filter(portInfo -> portInfo.getTags().stream().collect(Collectors.toSet()).containsAll(Stream.of("http", "state").collect(Collectors.toSet()))).findFirst().orElseThrow(() -> new NotFoundException("Failed to find HTTP state port"));
return internalGet(host.getHostname(), port.getPort(), relativePath);
}
use of com.yahoo.vespa.config.server.http.NotFoundException in project vespa by vespa-engine.
the class ApplicationHandler method handlePOST.
@Override
public HttpResponse handlePOST(HttpRequest request) {
ApplicationId applicationId = getApplicationIdFromRequest(request);
Tenant tenant = verifyTenantAndApplication(applicationId);
if (request.getUri().getPath().endsWith("restart"))
return restart(request, applicationId);
if (request.getUri().getPath().endsWith("log"))
return grabLog(request, applicationId, tenant);
throw new NotFoundException("Illegal POST request '" + request.getUri() + "': Must end by /restart or /log");
}
Aggregations