Package io.wcm.handler.url
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
Modifier and TypeMethodDescription@NotNull StringgetId()Gets the URL mode ID.@Nullable StringgetLinkUrlPrefix(@NotNull org.apache.sling.api.adapter.Adaptable adaptable, @NotNull Set<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 StringgetResourceUrlPrefix(@NotNull org.apache.sling.api.adapter.Adaptable adaptable, @NotNull Set<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.default booleanForces protocol and hostname to be stripped from URLs even is relying to hostnames provided by Sling Mapping.
-
Method Details
-
getId
Gets the URL mode ID.- Returns:
- Id uniquely identifying the URL mode
-
getLinkUrlPrefix
@Nullable @Nullable String getLinkUrlPrefix(@NotNull @NotNull org.apache.sling.api.adapter.Adaptable adaptable, @NotNull @NotNull Set<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 likeUrlHandlerConfigrunModes- Current sling run modescurrentPage- 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 String getResourceUrlPrefix(@NotNull @NotNull org.apache.sling.api.adapter.Adaptable adaptable, @NotNull @NotNull Set<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 likeUrlHandlerConfigrunModes- Current sling run modescurrentPage- 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
-
isForceStripHostName
default boolean isForceStripHostName()Forces protocol and hostname to be stripped from URLs even is relying to hostnames provided by Sling Mapping.- Returns:
- true if host name should always be stripped
-