code: public void handleGet(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource, boolean endsWithSlash) throws ServletException, IOException
      {
          if (resource == null || !resource.exists())
              response.sendError(HttpResponse.__404_Not_Found);
          else
          {
  
              // check if directory
              if (resource.isDirectory())
              {
                  if (!endsWithSlash && !pathInContext.equals("/"))
                  {
                      String q = request.getQueryString();
                      StringBuffer buf = request.getRequestURL();
                      if (q != null && q.length() != 0)
                      {
                          buf.append('?');
                          buf.append(q);
                      }
                      response.setContentLength(0);
                      response.sendRedirect(response.encodeRedirectURL(URI.addPaths(buf.toString(), "/")));
                      return;
                  }
  
                  // See if index file exists
                  String welcome = _httpContext.getWelcomeFile(resource);
                  if (welcome != null)
                  {
                      String ipath = URI.addPaths(pathInContext, welcome);
                      if (_redirectWelcomeFiles)
                      {
                          // Redirect to the index
                          response.setContentLength(0);
                          response.sendRedirect(URI.addPaths(_httpContext.getContextPath(), ipath));
                      }
                      else
                      {
                          // Forward to the index
                          RequestDispatcher dispatcher = _servletHandler.getRequestDispatcher(ipath);
                          dispatcher.forward(request, response);
                      }
                      return;
                  }
  
                  // Check modified dates
                  if (!passConditionalHeaders(request, response, resource))
                      return;
  
                  // If we got here, no forward to index took place
                  sendDirectory(request, response, resource, pathInContext.length() > 1);
              }
              else
              {
                  // Check modified dates
                  if (!passConditionalHeaders(request, response, resource))
                      return;
  
                  // just send it
                  sendData(request, response, pathInContext, resource);
              }
          }
      }
docs: /* -------------------------------------------------------------------