Interface LinkHandler


@ProviderType public interface LinkHandler
Manages link resolving and markup generation.

The interface is implemented by a Sling Model. You can adapt from SlingHttpServletRequest or Resource to get a context-specific handler instance.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final @NotNull String
    Special link used to notify invalid links.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull LinkBuilder
    get(@Nullable com.day.cq.wcm.api.Page page)
    Build internal link referencing the given content page.
    @NotNull LinkBuilder
    get(@NotNull LinkRequest linkRequest)
    Build link for the given request holding all further request properties.
    @NotNull LinkBuilder
    get(@Nullable String reference)
    Build link with auto-detecting the type from the given string.
    @NotNull LinkBuilder
    get(@Nullable org.apache.sling.api.resource.Resource resource)
    Build link which is referenced in the resource (containing properties e.g. pointing to internal or external link).
    Returns an empty link that is marked as invalid.
  • Field Details

  • Method Details

    • get

      @NotNull @NotNull LinkBuilder get(@Nullable @Nullable org.apache.sling.api.resource.Resource resource)
      Build link which is referenced in the resource (containing properties e.g. pointing to internal or external link).
      Parameters:
      resource - Resource containing properties that define the link target
      Returns:
      Link builder
    • get

      @NotNull @NotNull LinkBuilder get(@Nullable @Nullable com.day.cq.wcm.api.Page page)
      Build internal link referencing the given content page.
      Parameters:
      page - Target content page
      Returns:
      Link builder
    • get

      @NotNull @NotNull LinkBuilder get(@Nullable @Nullable String reference)
      Build link with auto-detecting the type from the given string.
      Parameters:
      reference - Link reference (internal or external).
      Returns:
      Link builder
    • get

      @NotNull @NotNull LinkBuilder get(@NotNull @NotNull LinkRequest linkRequest)
      Build link for the given request holding all further request properties.
      Parameters:
      linkRequest - Link handling request
      Returns:
      Link builder
    • invalid

      Link invalid()
      Returns an empty link that is marked as invalid.
      Returns:
      Invalid link