资源对象需要适应Page类或提取/引用与资源相关的页面的方法。我试过以下方法;然而,它似乎不工作
final Resource resource = resourceResolver.getResource(pagePath);
final Page cPage = resource.adaptTo(Page.class);
它返回null
o cPage
Try with PageManager
与路径:https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/PageManager.html getPage-java.lang.String——
资源:https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/PageManager.html getContainingPage-org.apache.sling.api.resource.Resource——