Search in sources :

Example 1 with ContentHandler

use of com.yahoo.vespa.config.server.http.ContentHandler in project vespa by vespa-engine.

the class ApplicationHandler method handleGET.

@Override
public HttpResponse handleGET(HttpRequest request) {
    ApplicationId applicationId = getApplicationIdFromRequest(request);
    Tenant tenant = verifyTenantAndApplication(applicationId);
    if (isServiceConvergeRequest(request)) {
        return applicationRepository.serviceConvergenceCheck(tenant, applicationId, getHostNameFromRequest(request), request.getUri());
    }
    if (isClusterControllerStatusRequest(request)) {
        String hostName = getHostNameFromRequest(request);
        String pathSuffix = getPathSuffix(request);
        return applicationRepository.clusterControllerStatusPage(tenant, applicationId, hostName, pathSuffix);
    }
    if (isContentRequest(request)) {
        long sessionId = applicationRepository.getSessionIdForApplication(tenant, applicationId);
        String contentPath = ApplicationContentRequest.getContentPath(request);
        ApplicationFile applicationFile = applicationRepository.getApplicationFileFromSession(tenant.getName(), sessionId, contentPath, ContentRequest.getApplicationFileMode(request.getMethod()));
        ApplicationContentRequest contentRequest = new ApplicationContentRequest(request, sessionId, applicationId, zone, contentPath, applicationFile);
        return new ContentHandler().get(contentRequest);
    }
    if (isServiceConvergeListRequest(request)) {
        return applicationRepository.serviceListToCheckForConfigConvergence(tenant, applicationId, request.getUri());
    }
    if (isFiledistributionStatusRequest(request)) {
        Duration timeout = HttpHandler.getRequestTimeout(request, Duration.ofSeconds(5));
        return applicationRepository.filedistributionStatus(tenant, applicationId, timeout);
    }
    return new GetApplicationResponse(Response.Status.OK, applicationRepository.getApplicationGeneration(tenant, applicationId));
}
Also used : Tenant(com.yahoo.vespa.config.server.tenant.Tenant) ApplicationFile(com.yahoo.config.application.api.ApplicationFile) Duration(java.time.Duration) ApplicationId(com.yahoo.config.provision.ApplicationId) ContentHandler(com.yahoo.vespa.config.server.http.ContentHandler)

Aggregations

ApplicationFile (com.yahoo.config.application.api.ApplicationFile)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 ContentHandler (com.yahoo.vespa.config.server.http.ContentHandler)1 Tenant (com.yahoo.vespa.config.server.tenant.Tenant)1 Duration (java.time.Duration)1