protected Response handleDirectRequest(UriInfo uriInfo, MediaType mediaType) {

    MultivaluedMap<String, String> queryParameters =
      uriInfo.getQueryParameters();

    Map<String, String> enumeratedQueryParameters =
      new HashMap<>();

    for (String queryName : queryParameters.keySet()) {
      List<String> queryValue = queryParameters.get(queryName);
      for (String value : queryValue) {
        enumeratedQueryParameters.put(queryName, value);
      }
    }

    AmbariManagementController controller =
      controllerFactory.getController();

    LoggingRequestHelper requestHelper =
      helperFactory.getHelper(controller, clusterName);

    if (requestHelper != null) {
      LogQueryResponse response =
        requestHelper.sendQueryRequest(enumeratedQueryParameters);

      if (response != null) {
        ResultSerializer serializer = mediaType == null ? getResultSerializer() : getResultSerializer(mediaType);

        Result result = new ResultImpl(new ResultStatus(ResultStatus.STATUS.OK));

        Resource loggingResource = new ResourceImpl(Resource.Type.LoggingQuery);
        // include the top-level query result properties
        loggingResource.setProperty("startIndex", response.getStartIndex());
        loggingResource.setProperty("pageSize", response.getPageSize());
        loggingResource.setProperty("resultSize", response.getResultSize());
        loggingResource.setProperty("queryTimeMMS", response.getQueryTimeMS());
        loggingResource.setProperty("totalCount", response.getTotalCount());

        // include the individual responses
        loggingResource.setProperty("logList", response.getListOfResults());

        result.getResultTree().addChild(loggingResource, "logging");

        Response.ResponseBuilder builder = Response.status(result.getStatus().getStatusCode()).entity(
          serializer.serialize(result));

        if (mediaType != null) {
          builder.type(mediaType);
        }

        RetryHelper.clearAffectedClusters();
        return builder.build();
      }
    } else {
      LOG.debug("LogSearch is not currently available, an empty response will be returned");
    }

    // return NOT_FOUND, with an error message describing that LogSearch is not running
    final Response.ResponseBuilder responseBuilder =
      Response.status(new ResultStatus(ResultStatus.STATUS.NOT_FOUND).getStatusCode());
    responseBuilder.entity("LogSearch is not currently available.  If LogSearch is deployed in this cluster, please verify that the LogSearch services are running.");

    return responseBuilder.build();
  }
Handling method for REST services that don't require the QueryParameter and
partial-response syntax support provided by the Ambari REST framework.

In the case of the LoggingService, the query parameters passed to the search engine must
be preserved, since they are passed to the LogSearch REST API.

@param uriInfo URI information for this request
@param mediaType media type for this request

@return a Response for the request associated with this UriInfo
ambari-server/src/main/java/org/apache/ambari/server/api/services/LoggingService.java