code: public static Optional<CmsResource> getDetailOnlyPage(
          CmsObject cms,
          CmsResource detailContent,
          String contentLocale) {
  
          try {
              CmsObject rootCms = OpenCms.initCmsObject(cms);
              rootCms.getRequestContext().setSiteRoot("");
              String path = getDetailOnlyPageNameWithoutLocaleCheck(detailContent.getRootPath(), contentLocale);
              if (rootCms.existsResource(path, CmsResourceFilter.ALL)) {
                  CmsResource detailOnlyRes = rootCms.readResource(path, CmsResourceFilter.ALL);
                  return Optional.of(detailOnlyRes);
              }
              return Optional.absent();
          } catch (CmsException e) {
              LOG.warn(e.getLocalizedMessage(), e);
              return Optional.absent();
          }
      }
docs: Gets the detail only page for a detail content.<p>
  
  @param cms the CMS context
  @param detailContent the detail content
  @param contentLocale the content locale
  
  @return the detail only page, or Optional.absent() if there is no detail only page