class HttpHandler extends LoggingRequestHandler {

    @Override
    public HttpResponse handle(HttpRequest request) {
        log.log(Level.FINE, request.getMethod() + " " + request.getUri().toString());
        try {
            switch (request.getMethod()) {
                case POST:
                    return handlePOST(request);
                case GET:
                    return handleGET(request);
                case PUT:
                    return handlePUT(request);
                case DELETE:
                    return handleDELETE(request);
                default:
                    return createErrorResponse(request.getMethod());
            }
        } catch (NotFoundException | com.yahoo.vespa.config.server.NotFoundException e) {
            return HttpErrorResponse.notFoundError(getMessage(e, request));
        } catch (ActivationConflictException e) {
            return HttpErrorResponse.conflictWhenActivating(getMessage(e, request));
        } catch (BadRequestException | IllegalArgumentException | IllegalStateException e) {
            return HttpErrorResponse.badRequest(getMessage(e, request));
        } catch (OutOfCapacityException e) {
            return HttpErrorResponse.outOfCapacity(getMessage(e, request));
        } catch (InvalidApplicationException e) {
            return HttpErrorResponse.invalidApplicationPackage(getMessage(e, request));
        } catch (InternalServerException e) {
            return HttpErrorResponse.internalServerError(getMessage(e, request));
        } catch (UnknownVespaVersionException e) {
            return HttpErrorResponse.unknownVespaVersion(getMessage(e, request));
        } catch (RequestTimeoutException e) {
            return HttpErrorResponse.requestTimeout(getMessage(e, request));
        } catch (ApplicationLockException e) {
            return HttpErrorResponse.applicationLockFailure(getMessage(e, request));
        } catch (ParentHostUnavailableException e) {
            return HttpErrorResponse.parentHostNotReady(getMessage(e, request));
        } catch (CertificateNotReadyException e) {
            return HttpErrorResponse.certificateNotReady(getMessage(e, request));
        } catch (LoadBalancerServiceException e) {
            return HttpErrorResponse.loadBalancerNotReady(getMessage(e, request));
        } catch (Exception e) {
            log.log(Level.WARNING, "Unexpected exception handling a config server request", e);
            return HttpErrorResponse.internalServerError(getMessage(e, request));
        }
    }

    public  HttpHandler(HttpHandler.Context ctx);

}