Class SiteRoot


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

      Constructors 
      Constructor Description
      SiteRoot()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @Nullable com.day.cq.wcm.api.Page getRelativePage​(@NotNull java.lang.String relativePath)
      Get page relative to site root.
      @Nullable com.day.cq.wcm.api.Page getRootPage()
      Gets site root page of the current site.
      @Nullable java.lang.String getRootPath()
      Gets site root level path of the current site.
      @Nullable java.lang.String getRootPath​(@Nullable com.day.cq.wcm.api.Page page)
      Gets site root level path of a site.
      @Nullable java.lang.String getRootPath​(@Nullable org.apache.sling.api.resource.Resource resource)
      Gets site root level path of a site.
      boolean isRootPage​(@NotNull com.day.cq.wcm.api.Page page)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SiteRoot

        public SiteRoot()
    • Method Detail

      • getRootPath

        @Nullable
        public @Nullable java.lang.String getRootPath​(@Nullable
                                                      @Nullable 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

        @Nullable
        public @Nullable java.lang.String getRootPath​(@Nullable
                                                      @Nullable 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

        @Nullable
        public @Nullable java.lang.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

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

        @Nullable
        public @Nullable com.day.cq.wcm.api.Page getRelativePage​(@NotNull
                                                                 @NotNull java.lang.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​(@NotNull
                                  @NotNull com.day.cq.wcm.api.Page page)
        Parameters:
        page - Page
        Returns:
        true if given page is the site root page