code: @SuppressWarnings("null")
    public static @Nullable Page getContentPage(@NotNull HttpServletRequest request) {
      SlingHttpServletRequest slingRequest = (SlingHttpServletRequest)request;
      Resource contentResource = getContentResourceOrParent(request);
      if (contentResource != null) {
        PageManager pageManager = slingRequest.getResourceResolver().adaptTo(PageManager.class);
        return pageManager.getContainingPage(contentResource);
      }
      else {
        return null;
      }
    }
docs: Current content page. If the current resource does not exist the content page
  of the next-existing parent resource is returned.
  @param request Request
  @return Current content page or null