Package io.wcm.handler.url
Interface UrlBuilder
@ProviderType
public interface UrlBuilder
Define URL handling requests using builder pattern.
-
Method Summary
Modifier and TypeMethodDescription@Nullable Stringbuild()Build URL@Nullable StringBuild externalized URL that links to a content page.@Nullable StringbuildExternalLinkUrl(@Nullable com.day.cq.wcm.api.Page targetPage) Build externalized URL that links to a content page.@Nullable StringBuild externalized URL that links to a resource (e.g. image, CSS or JavaScript reference).@Nullable StringbuildExternalResourceUrl(@Nullable org.apache.sling.api.resource.Resource targetResource) Build externalized URL that links to a resource (e.g. image, CSS or JavaScript reference).@NotNull UrlBuilderdisableSuffixSelector(boolean disableSuffixSelector) Disable the automatic addition of an additional selectorUrlHandler.SELECTOR_SUFFIXin case a suffix is present for building the URL.@NotNull UrlBuilderSet file extension@NotNull UrlBuilderSet fragment identifier@NotNull UrlBuilderqueryString(@Nullable String queryString) Set query parameters string@NotNull UrlBuilderqueryString(@Nullable String queryString, @NotNull Set<String> inheritableParameterNames) Set query parameters string@NotNull UrlBuilderSet selectors@NotNull UrlBuilderSet suffix@NotNull UrlBuilderSet URL mode for externalizing the URL@NotNull UrlBuildervanityMode(@Nullable VanityMode vanityMode) Set Vanity mode for building the URL
-
Method Details
-
selectors
Set selectors- Parameters:
selectors- Selector string- Returns:
- URL builder
-
extension
Set file extension- Parameters:
extension- file extension- Returns:
- URL builder
-
suffix
Set suffix- Parameters:
suffix- Suffix string- Returns:
- URL builder
-
queryString
Set query parameters string- Parameters:
queryString- Query parameters string (properly url-encoded)- Returns:
- URL builder
-
queryString
@NotNull @NotNull UrlBuilder queryString(@Nullable @Nullable String queryString, @NotNull @NotNull Set<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
Set fragment identifier- Parameters:
fragment- Fragment identifier- Returns:
- URL builder
-
urlMode
Set URL mode for externalizing the URL- Parameters:
urlMode- URL mode. If null, default URL mode is used.- Returns:
- URL builder
-
vanityMode
Set Vanity mode for building the URL- Parameters:
vanityMode- Vanity Mode. Only used when building for a page- Returns:
- URL builder
-
disableSuffixSelector
Disable the automatic addition of an additional selectorUrlHandler.SELECTOR_SUFFIXin 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
Build URL- Returns:
- URL
-
buildExternalLinkUrl
Build externalized URL that links to a content page. This may only be used if a page was given in theUrlHandler.get(Page)call.- Returns:
- URL
-
buildExternalLinkUrl
@Nullable @Nullable 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
Build externalized URL that links to a resource (e.g. image, CSS or JavaScript reference).- Returns:
- URL
-
buildExternalResourceUrl
@Nullable @Nullable 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
-