code: protected void sendDirectory(HttpServletRequest request, HttpServletResponse response, Resource resource, boolean parent) throws IOException
      {
          if (!_dirAllowed)
          {
              response.sendError(HttpResponse.__403_Forbidden);
              return;
          }
  
          byte[] data = null;
          if (resource instanceof CachedResource)
              data = ((CachedResource) resource).getCachedData();
  
          if (data == null)
          {
              String base = URI.addPaths(request.getRequestURI(), "/");
              String dir = resource.getListHTML(base, parent);
              if (dir == null)
              {
                  response.sendError(HttpResponse.__403_Forbidden, "No directory");
                  return;
              }
              data = dir.getBytes("UTF-8");
              if (resource instanceof CachedResource)
                  ((CachedResource) resource).setCachedData(data);
          }
  
          response.setContentType("text/html; charset=UTF-8");
          response.setContentLength(data.length);
  
          if (!request.getMethod().equals(HttpRequest.__HEAD))
              response.getOutputStream().write(data);
      }
docs: /* -------------------------------------------------------------------