Class RichTextInternalLinks

java.lang.Object
io.wcm.siteapi.integrationtestsupport.linkextractor.RichTextInternalLinks
All Implemented Interfaces:
LinkExtractor

public final class RichTextInternalLinks extends Object implements LinkExtractor
Extracts internal links from rich text fragments in JSON.

Looks for components with specific resource types and a "text" property containing the HTML fragment. Within the HTML fragments anchor tags with a attribute "data-type=internal" are processed, which is the default representation of internal links generated by wcm.io Link Handler.

  • Constructor Details

    • RichTextInternalLinks

      public RichTextInternalLinks(String... resourceTypes)
      Parameters:
      resourceTypes - Resource type(s) for components containing rich text.
    • RichTextInternalLinks

      public RichTextInternalLinks(List<String> resourceTypes)
      Parameters:
      resourceTypes - Resource type(s) for components containing rich text.
  • Method Details

    • accept

      public boolean accept(String suffix)
      Description copied from interface: LinkExtractor
      Returns true if the link extractor accepts the given suffix (processor mapped to this suffix).
      Specified by:
      accept in interface LinkExtractor
      Parameters:
      suffix - Suffix
      Returns:
      true if JSON response of this processor is supported
    • getLinks

      public Stream<String> getLinks(com.jayway.jsonpath.DocumentContext jsonPathContext)
      Description copied from interface: LinkExtractor
      Retrieves links from the JSON document via JSON path.
      Specified by:
      getLinks in interface LinkExtractor
      Parameters:
      jsonPathContext - Document context
      Returns:
      Link URLs