code: public static CmsResource initResource(
          CmsObject cms,
          String resourceName,
          HttpServletRequest req,
          HttpServletResponse res)
      throws CmsException {
  
          return OpenCmsCore.getInstance().initResource(cms, resourceName, req, res);
      }
docs: Reads the requested resource from the OpenCms VFS,
  and in case a directory name is requested, the default files of the
  directory will be looked up and the first match is returned.<p>
  
  The resource that is returned is always a <code>{@link org.opencms.file.CmsFile}</code>,
  even though the content will usually not be loaded in the result. Folders are never returned since
  the point of this method is really to load the default file if just a folder name is requested.<p>
  
  The URI stored in the given OpenCms user context will be changed to the URI of the resource
  that was found and returned.<p>
  
  Implementing and configuring an <code>{@link I_CmsResourceInit}</code> handler
  allows to customize the process of default resource selection.<p>
  
  @param cms the current users OpenCms context
  @param resourceName the path of the requested resource in the OpenCms VFS
  @param req the current http request
  @param res the current http response
  @return the requested resource read from the VFS
  
  @throws CmsException in case the requested file does not exist or the user has insufficient access permissions