code: public static String getDefaultFileOrDetailType(CmsObject cms, CmsResource resource) {
  
          String type = null;
  
          if (resource.isFolder()
              && !(OpenCms.getResourceManager().getResourceType(resource) instanceof CmsResourceTypeFolderExtended)
              && !CmsJspNavBuilder.isNavLevelFolder(cms, resource)) {
              try {
                  CmsResource defaultFile = cms.readDefaultFile(resource, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
                  if (defaultFile != null) {
                      type = getDetailType(cms, defaultFile, resource);
                      if (type == null) {
                          type = OpenCms.getResourceManager().getResourceType(defaultFile).getTypeName();
                      }
  
                  }
              } catch (CmsSecurityException e) {
                  // ignore
              }
          } else if (CmsResourceTypeXmlContainerPage.isContainerPage(resource)) {
              type = getDetailType(cms, resource, null);
  
          }
          return type;
  
      }
docs: Returns the default file type or detail type for the given resource.<p>
  
  @param cms the cms context
  @param resource the container page resource
  
  @return the detail content type