@GET
  @Path("/listdir")
  @Produces(MediaType.APPLICATION_JSON)
  public Response listdir(@QueryParam("path") String path, @QueryParam("nameFilter") String nameFilter) {
    try {
      JSONObject response = new JSONObject();
      Map<String, Object> parentInfo = getApi().fileStatusToJSON(getApi().getFileStatus(path));
      DirStatus dirStatus = getApi().listdir(path, nameFilter, maxFilesPerPage);
      DirListInfo dirListInfo = dirStatus.getDirListInfo();
      parentInfo.put("originalSize", dirListInfo.getOriginalSize());
      parentInfo.put("truncated", dirListInfo.isTruncated());
      parentInfo.put("finalSize", dirListInfo.getFinalSize());
      parentInfo.put("nameFilter", dirListInfo.getNameFilter());
      response.put("files", getApi().fileStatusToJSON(dirStatus.getFileStatuses()));
      response.put("meta", parentInfo);
      return Response.ok(response).build();
    } catch (WebApplicationException ex) {
      throw ex;
    } catch (FileNotFoundException ex) {
      throw new NotFoundFormattedException(ex.getMessage(), ex);
    } catch (Exception ex) {
      throw new ServiceFormattedException(ex.getMessage(), ex);
    }
  }
List dir
@param path path
@param nameFilter : name on which filter is applied
@return response with dir content
contrib/views/commons/src/main/java/org/apache/ambari/view/commons/hdfs/FileOperationService.java