Class RootPathResolver


  • @ProviderType
    public final class RootPathResolver
    extends java.lang.Object
    Helper class for path-based GraniteUI components to resolve the root path.

    Resolution order for root path detection:

    • Reads configured root path from rootPath property
    • Calls the provided root path detector implementation to detect root path from context
    • Reads fallback root path from fallbackRootPath property
    • Uses fallback root path provided for this instance
    • Fallback to "/"

    Additionally the root path is modified:

    • If an appendPath property is configured it is appended to the detected root path
    • Than it is checked if the root path is valid - if not the next-valid parent path is returned
    • Constructor Summary

      Constructors 
      Constructor Description
      RootPathResolver​(@NotNull com.adobe.granite.ui.components.ComponentHelper cmp, @NotNull org.apache.sling.api.SlingHttpServletRequest request)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull java.lang.String get()
      Get the resolved and validated root path.
      java.util.Map<java.lang.String,​java.lang.Object> getOverrideProperties()
      Get map of override properties for super component based on the wcm.io Granite UI Extensions PathField.
      void setFallbackRootPath​(@NotNull java.lang.String fallbackRootPath)  
      void setRootPathDetector​(@NotNull RootPathDetector rootPathDetector)  
      • Methods inherited from class java.lang.Object

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

      • RootPathResolver

        public RootPathResolver​(@NotNull
                                @NotNull com.adobe.granite.ui.components.ComponentHelper cmp,
                                @NotNull
                                @NotNull org.apache.sling.api.SlingHttpServletRequest request)
        Parameters:
        cmp - Component helper
        request - Request
    • Method Detail

      • setRootPathDetector

        public void setRootPathDetector​(@NotNull
                                        @NotNull RootPathDetector rootPathDetector)
        Parameters:
        rootPathDetector - For detecting root path from context
      • setFallbackRootPath

        public void setFallbackRootPath​(@NotNull
                                        @NotNull java.lang.String fallbackRootPath)
        Parameters:
        fallbackRootPath - Fallback root path that is used if none is configured
      • get

        @NotNull
        public @NotNull java.lang.String get()
        Get the resolved and validated root path.
        Returns:
        Root path.
      • getOverrideProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getOverrideProperties()
        Get map of override properties for super component based on the wcm.io Granite UI Extensions PathField.
        Returns:
        Path properties