Interface UrlMode


  • @ProviderType
    public interface UrlMode
    An UrlMode define the externalization logic for URLs depending on context-specific configuration parameters defined in SiteConfig.

    If you want to implement your own UrlMode you can create a singleton class extending this interface. See UrlModes class as an example.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      @NotNull java.lang.String getId()  
      @Nullable java.lang.String getLinkUrlPrefix​(@NotNull org.apache.sling.api.adapter.Adaptable adaptable, @NotNull java.util.Set<java.lang.String> runModes, @Nullable com.day.cq.wcm.api.Page currentPage, @Nullable com.day.cq.wcm.api.Page targetPage)
      Get prefix (scheme, hostname and context path or integrator placeholder) for externalizing a content page link URL.
      @Nullable java.lang.String getResourceUrlPrefix​(@NotNull org.apache.sling.api.adapter.Adaptable adaptable, @NotNull java.util.Set<java.lang.String> runModes, @Nullable com.day.cq.wcm.api.Page currentPage, @Nullable org.apache.sling.api.resource.Resource targetResource)
      Get prefix (scheme, hostname and context path or integrator placeholder) for externalizing a resource URL.
    • Method Detail

      • getId

        @NotNull
        @NotNull java.lang.String getId()
        Returns:
        Id uniquely identifying the URL mode
      • getLinkUrlPrefix

        @Nullable
        @Nullable java.lang.String getLinkUrlPrefix​(@NotNull
                                                    @NotNull org.apache.sling.api.adapter.Adaptable adaptable,
                                                    @NotNull
                                                    @NotNull java.util.Set<java.lang.String> runModes,
                                                    @Nullable
                                                    @Nullable com.day.cq.wcm.api.Page currentPage,
                                                    @Nullable
                                                    @Nullable com.day.cq.wcm.api.Page targetPage)
        Get prefix (scheme, hostname and context path or integrator placeholder) for externalizing a content page link URL.
        Parameters:
        adaptable - Either request or resource which can be adapted to model implementations like UrlHandlerConfig
        runModes - Current sling run modes
        currentPage - Current page (is null if not executed in request context)
        targetPage - Target page to which internal link points to.
        Returns:
        Prefix or null
      • getResourceUrlPrefix

        @Nullable
        @Nullable java.lang.String getResourceUrlPrefix​(@NotNull
                                                        @NotNull org.apache.sling.api.adapter.Adaptable adaptable,
                                                        @NotNull
                                                        @NotNull java.util.Set<java.lang.String> runModes,
                                                        @Nullable
                                                        @Nullable com.day.cq.wcm.api.Page currentPage,
                                                        @Nullable
                                                        @Nullable org.apache.sling.api.resource.Resource targetResource)
        Get prefix (scheme, hostname and context path or integrator placeholder) for externalizing a resource URL.
        Parameters:
        adaptable - Either request or resource which can be adapted to model implementations like UrlHandlerConfig
        runModes - Current sling run modes
        currentPage - Current page (is null if not executed in request context)
        targetResource - Target resource to which the resource link points to (may be null if it could not be resolved)
        Returns:
        Prefix or null