Package io.wcm.handler.url
Interface UrlBuilder
-
@ProviderType public interface UrlBuilder
Define URL handling requests using builder pattern.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable java.lang.String
build()
Build URL@Nullable java.lang.String
buildExternalLinkUrl()
Build externalized URL that links to a content page.@Nullable java.lang.String
buildExternalLinkUrl(@Nullable com.day.cq.wcm.api.Page targetPage)
Build externalized URL that links to a content page.@Nullable java.lang.String
buildExternalResourceUrl()
Build externalized URL that links to a resource (e.g.@Nullable java.lang.String
buildExternalResourceUrl(@Nullable org.apache.sling.api.resource.Resource targetResource)
Build externalized URL that links to a resource (e.g.@NotNull UrlBuilder
disableSuffixSelector(boolean disableSuffixSelector)
Disable the automatic addition of an additional selectorUrlHandler.SELECTOR_SUFFIX
in case a suffix is present for building the URL.@NotNull UrlBuilder
extension(@Nullable java.lang.String extension)
Set file extension@NotNull UrlBuilder
fragment(@Nullable java.lang.String fragment)
Set fragment identifier@NotNull UrlBuilder
queryString(@Nullable java.lang.String queryString)
Set query parameters string@NotNull UrlBuilder
queryString(@Nullable java.lang.String queryString, @NotNull java.util.Set<java.lang.String> inheritableParameterNames)
Set query parameters string@NotNull UrlBuilder
selectors(@Nullable java.lang.String selectors)
Set selectors@NotNull UrlBuilder
suffix(@Nullable java.lang.String suffix)
Set suffix@NotNull UrlBuilder
urlMode(@Nullable UrlMode urlMode)
Set URL mode for externalizing the URL@NotNull UrlBuilder
vanityMode(@Nullable VanityMode vanityMode)
Set Vanity mode for building the URL
-
-
-
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 selectorUrlHandler.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 theUrlHandler.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
-
-