Class UrlHandlerConfig

  • All Implemented Interfaces:
    io.wcm.sling.commons.caservice.ContextAwareService

    @ConsumerType
    public abstract class UrlHandlerConfig
    extends java.lang.Object
    implements io.wcm.sling.commons.caservice.ContextAwareService
    UrlHandlerConfig OSGi services provide application-specific configuration for URL handling. Applications can set service properties or bundle headers as defined in ContextAwareService to apply this configuration only for resources that match the relevant resource paths.
    • Field Summary

      • Fields inherited from interface io.wcm.sling.commons.caservice.ContextAwareService

        PROPERTY_ACCEPTS_CONTEXT_PATH_EMPTY, PROPERTY_CONTEXT_PATH_BLACKLIST_PATTERN, PROPERTY_CONTEXT_PATH_PATTERN
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull UrlMode getDefaultUrlMode()  
      VanityMode getDefaultVanityMode()
      By default, vanity paths will not be taken into account when building URLs.
      @NotNull java.util.Collection<IntegratorMode> getIntegratorModes()  
      abstract int getSiteRootLevel​(@Nullable org.apache.sling.api.resource.Resource contextResource)
      Returns the absolute path level where the root page of the site is located.
      boolean isHostProvidedBySlingMapping()
      By default, URL handler users Sling Mapping to externalize all URLs, but removes and host name that may be configured in the Sling Mapping to prefer the host names defined in the URL handler SiteConfig.
      boolean isIntegrator​(@NotNull com.day.cq.wcm.api.Page page)
      Detects if page is a integrator page and contains application redirect link information
      boolean isSecure​(@NotNull com.day.cq.wcm.api.Page page)
      Detects if a page has to be accessed in secure mode
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UrlHandlerConfig

        public UrlHandlerConfig()
    • Method Detail

      • getSiteRootLevel

        public abstract int getSiteRootLevel​(@Nullable
                                             @Nullable org.apache.sling.api.resource.Resource contextResource)
        Returns the absolute path level where the root page of the site is located.
        Parameters:
        contextResource - Context resource that is assumed to be inside the site context.
        Returns:
        Root level or -1 if it could not be detected
      • isSecure

        public boolean isSecure​(@NotNull
                                @NotNull com.day.cq.wcm.api.Page page)
        Detects if a page has to be accessed in secure mode
        Parameters:
        page - Page Page
        Returns:
        true if secure mode is required
      • isIntegrator

        public boolean isIntegrator​(@NotNull
                                    @NotNull com.day.cq.wcm.api.Page page)
        Detects if page is a integrator page and contains application redirect link information
        Parameters:
        page - Page
        Returns:
        true if Page is a integrator page
      • getDefaultUrlMode

        @NotNull
        public @NotNull UrlMode getDefaultUrlMode()
        Returns:
        Default URL mode that is used if no URL mode is specified
      • getIntegratorModes

        @NotNull
        public @NotNull java.util.Collection<IntegratorMode> getIntegratorModes()
        Returns:
        Supported integrator modes
      • isHostProvidedBySlingMapping

        public boolean isHostProvidedBySlingMapping()
        By default, URL handler users Sling Mapping to externalize all URLs, but removes and host name that may be configured in the Sling Mapping to prefer the host names defined in the URL handler SiteConfig. By setting this flag to true, URL handler also uses the host names provided by Sling Mapping, and falls back to the default behavior if no are defined.
        Returns:
        true if URL handler should also respect host names defined in Sling Mapping
      • getDefaultVanityMode

        public VanityMode getDefaultVanityMode()
        By default, vanity paths will not be taken into account when building URLs. Use the vanity mode to change this behaviour.
        Returns:
        the vanity mode to use when building urls