code: public void handleGet(HttpRequest request,
                            HttpResponse response,
                            String pathInContext,
                            String pathParams,
                            Resource resource)
          throws IOException
      {
          if(log.isDebugEnabled())log.debug("Looking for "+resource);
          
          if (resource!=null && resource.exists())
          {            
              // check if directory
              if (resource.isDirectory())
              {
                  if (!pathInContext.endsWith("/") && !pathInContext.equals("/"))
                  {
                      log.debug("Redirect to directory/");
                      
                      String q=request.getQuery();
                      StringBuffer buf=request.getRequestURL();
                      if (q!=null&&q.length()!=0)
                      {
                          buf.append('?');
                          buf.append(q);
                      }
                      response.setField(HttpFields.__Location, URI.addPaths(buf.toString(),"/"));
                      response.setStatus(302);
                      request.setHandled(true);
                      return;
                  }
    
                  // See if index file exists
                  String welcome=getHttpContext().getWelcomeFile(resource);
                  if (welcome!=null)
                  {     
                      // Forward to the index
                      String ipath=URI.addPaths(pathInContext,welcome);
                      if (_redirectWelcomeFiles)
                      {
                          // Redirect to the index
                          ipath=URI.addPaths(getHttpContext().getContextPath(),ipath);
                          response.setContentLength(0);
                          response.sendRedirect(ipath);
                      }
                      else
                      {
                          URI uri=request.getURI();
                          uri.setPath(URI.addPaths(uri.getPath(),welcome));
                          getHttpContext().handle(ipath,pathParams,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);
              }
              // check if it is a file
              else if (resource.exists())
              {
                  // Check modified dates
                  if (!passConditionalHeaders(request,response,resource))
                      return;
                  sendData(request,response,pathInContext,resource,true);
              }
              else
                  // don't know what it is
                  log.warn("Unknown file type");
          }
      }
docs: /* -------------------------------------------------------------------