Interface UrlBuilder


  • @ProviderType
    public interface UrlBuilder
    Define URL handling requests using builder pattern.
    • Method Detail

      • selectors

        @NotNull
        @NotNull UrlBuilder selectors​(@Nullable
                                      @Nullable java.lang.String selectors)
        Set selectors
        Parameters:
        selectors - Selector string
        Returns:
        URL builder
      • extension

        @NotNull
        @NotNull UrlBuilder extension​(@Nullable
                                      @Nullable java.lang.String extension)
        Set file extension
        Parameters:
        extension - file extension
        Returns:
        URL builder
      • suffix

        @NotNull
        @NotNull UrlBuilder suffix​(@Nullable
                                   @Nullable java.lang.String suffix)
        Set suffix
        Parameters:
        suffix - Suffix string
        Returns:
        URL builder
      • queryString

        @NotNull
        @NotNull UrlBuilder queryString​(@Nullable
                                        @Nullable java.lang.String queryString)
        Set query parameters string
        Parameters:
        queryString - Query parameters string (properly url-encoded)
        Returns:
        URL builder
      • queryString

        @NotNull
        @NotNull UrlBuilder queryString​(@Nullable
                                        @Nullable java.lang.String queryString,
                                        @NotNull
                                        @NotNull java.util.Set<java.lang.String> inheritableParameterNames)
        Set query parameters string
        Parameters:
        queryString - Query parameters string (properly url-encoded)
        inheritableParameterNames - Names of query string parameters that should be inherited from the current request
        Returns:
        URL builder
      • fragment

        @NotNull
        @NotNull UrlBuilder fragment​(@Nullable
                                     @Nullable java.lang.String fragment)
        Set fragment identifier
        Parameters:
        fragment - Fragment identifier
        Returns:
        URL builder
      • urlMode

        @NotNull
        @NotNull UrlBuilder urlMode​(@Nullable
                                    @Nullable UrlMode urlMode)
        Set URL mode for externalizing the URL
        Parameters:
        urlMode - URL mode. If null, default URL mode is used.
        Returns:
        URL builder
      • vanityMode

        @NotNull
        @NotNull UrlBuilder vanityMode​(@Nullable
                                       @Nullable VanityMode vanityMode)
        Set Vanity mode for building the URL
        Parameters:
        vanityMode - Vanity Mode. Only used when building for a page
        Returns:
        URL builder
      • disableSuffixSelector

        @NotNull
        @NotNull UrlBuilder disableSuffixSelector​(boolean disableSuffixSelector)
        Disable the automatic addition of an additional selector UrlHandler.SELECTOR_SUFFIX in case a suffix is present for building the URL. Although recommended as best practice, this can be omitted if you are sure your URLs are always either include a suffix or never do, so there is no risk for file name clashes in dispatcher cache.
        Parameters:
        disableSuffixSelector - If set to true, no additional suffix selector is added
        Returns:
        URL builder
      • build

        @Nullable
        @Nullable java.lang.String build()
        Build URL
        Returns:
        URL
      • buildExternalLinkUrl

        @Nullable
        @Nullable java.lang.String buildExternalLinkUrl()
        Build externalized URL that links to a content page. This may only be used if a page was given in the UrlHandler.get(Page) call.
        Returns:
        URL
      • buildExternalLinkUrl

        @Nullable
        @Nullable java.lang.String buildExternalLinkUrl​(@Nullable
                                                        @Nullable com.day.cq.wcm.api.Page targetPage)
        Build externalized URL that links to a content page.
        Parameters:
        targetPage - Target page of internal link (e.g. for checking url configuration and secure mode)
        Returns:
        URL
      • buildExternalResourceUrl

        @Nullable
        @Nullable java.lang.String buildExternalResourceUrl()
        Build externalized URL that links to a resource (e.g. image, CSS or JavaScript reference).
        Returns:
        URL
      • buildExternalResourceUrl

        @Nullable
        @Nullable java.lang.String buildExternalResourceUrl​(@Nullable
                                                            @Nullable org.apache.sling.api.resource.Resource targetResource)
        Build externalized URL that links to a resource (e.g. image, CSS or JavaScript reference).
        Parameters:
        targetResource - Target resource of resource link (e.g. for checking url configuration)
        Returns:
        URL