Class SiteRoot


  • @ProviderType
    @Model(adaptables={org.apache.sling.api.SlingHttpServletRequest.class,org.apache.sling.api.resource.Resource.class})
    public final class SiteRoot
    extends Object
    Model for detecting site root pages.
    • Constructor Detail

      • SiteRoot

        public SiteRoot()
    • Method Detail

      • getRootPath

        public String getRootPath​(com.day.cq.wcm.api.Page page)
        Gets site root level path of a site.
        Parameters:
        page - CQ Page of site
        Returns:
        Site root path for the site. The path is not checked for validness.
      • getRootPath

        public String getRootPath​(org.apache.sling.api.resource.Resource resource)
        Gets site root level path of a site.
        Parameters:
        resource - Resource within the site
        Returns:
        Site root path for the site. The path is not checked for validness.
      • getRootPath

        public String getRootPath()
        Gets site root level path of the current site.
        Returns:
        Site root path for the current site. The path is not checked for validness.
      • getRootPage

        public com.day.cq.wcm.api.Page getRootPage()
        Gets site root page of the current site.
        Returns:
        Site root page for the current site.
      • getRelativePage

        public com.day.cq.wcm.api.Page getRelativePage​(String relativePath)
        Get page relative to site root.
        Parameters:
        relativePath - Path relative to site root
        Returns:
        Page instance or null if not found
      • isRootPage

        public boolean isRootPage​(com.day.cq.wcm.api.Page page)
        Parameters:
        page - Page
        Returns:
        true if given page is the site root page