code: public static CmsJspContentAttachmentsBean getAttachmentsForCurrentPage(CmsObject cms, CmsResource content)
      throws CmsException {
  
          CmsResource page = cms.readResource(cms.getRequestContext().getUri(), CmsResourceFilter.IGNORE_EXPIRATION);
          String locale = CmsDetailOnlyContainerUtil.getDetailContainerLocale(
              cms,
              cms.getRequestContext().getLocale().toString(),
              page);
          Optional<CmsResource> detailOnly = CmsDetailOnlyContainerUtil.getDetailOnlyPage(cms, content, locale);
          if (detailOnly.isPresent()) {
              try {
                  return new CmsJspContentAttachmentsBean(cms, detailOnly.get());
              } catch (Exception e) {
                  LOG.error(e.getLocalizedMessage(), e);
                  return new CmsJspContentAttachmentsBean();
              }
          } else {
              return new CmsJspContentAttachmentsBean();
          }
      }
docs: Gets the attachments / detail-only contents for the current page (i.e. cms.getRequestContext().getUri()).<p>
  
  @param cms the CMS context
  @param content the content for which to get the attachments
  @return a bean providing access to the attachments for the resource
  
  @throws CmsException if something goes wrong