class TenantHandler extends HttpHandler {

    @Override
    protected HttpResponse handleGET(HttpRequest request) {
        if (isGetTenantRequest(request)) {
            final TenantName tenantName = getTenantNameFromRequest(request);
            Utils.checkThatTenantExists(tenantRepository, tenantName);
            return new TenantGetResponse(tenantName);
        } else if (isListTenantsRequest(request)) {
            return new ListTenantsResponse(ImmutableSet.copyOf(tenantRepository.getAllTenantNames()));
        } else {
            throw new BadRequestException(request.getUri().toString());
        }
    }

    @Inject public  TenantHandler(Context ctx, ApplicationRepository applicationRepository);

}