code: @SuppressWarnings("null")
    public @NotNull List<Resource> getResources(@Nullable Predicate<Resource> filter, @Nullable Resource baseResource) {
  
      // resolve base path or fallback to current page's content if not specified
      Resource baseResourceToUse = baseResource;
      if (baseResourceToUse == null) {
        PageManager pageManager = request.getResourceResolver().adaptTo(PageManager.class);
        Page currentPage = pageManager.getContainingPage(request.getResource());
        if (currentPage != null) {
          baseResourceToUse = currentPage.getContentResource();
        }
        else {
          baseResourceToUse = request.getResource();
        }
      }
      return getResourcesWithBaseResource(filter, baseResourceToUse);
    }
docs: Get the resources selected in the suffix of the URL
  @param filter optional filter to select only specific resources
  @param baseResource the suffix path is relative to this resource path (null for current page's jcr:content node)
  @return a list containing the Resources