code: public static @Nullable Resource getContentResource(@NotNull HttpServletRequest request) {
  
      String contentPath = getContentPath(request);
  
      if (StringUtils.isNotEmpty(contentPath)) {
        SlingHttpServletRequest slingRequest = (SlingHttpServletRequest)request;
        return slingRequest.getResourceResolver().getResource(contentPath);
      }
      return null;
    }
docs: Current content resource
  @param request Request
  @return Current content resource or null