Interface RewriteContentHandler

All Known Implementing Classes:
DefaultRewriteContentHandler

@ConsumerType public interface RewriteContentHandler
Allows to rewrite DOM elements and text elements.

If used for RichTextHandlerConfig this interface has to be implemented by a Sling Model class. The adaptables should be SlingHttpServletRequest and Resource.

  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable List<org.jdom2.Content>
    rewriteElement(@NotNull org.jdom2.Element element)
    Checks if the given element has to be rewritten.
    @Nullable List<org.jdom2.Content>
    rewriteText(@NotNull org.jdom2.Text text)
    Checks if the given text node has to be rewritten.
  • Method Details

    • rewriteElement

      @Nullable @Nullable List<org.jdom2.Content> rewriteElement(@NotNull @NotNull org.jdom2.Element element)
      Checks if the given element has to be rewritten. Is called for every child single element of the parent given to rewriteContent method.
      Parameters:
      element - Element to check
      Returns:
      null if nothing is to do with this element. Return empty list to remove this element. Return list with other content to replace element with new content.
    • rewriteText

      @Nullable @Nullable List<org.jdom2.Content> rewriteText(@NotNull @NotNull org.jdom2.Text text)
      Checks if the given text node has to be rewritten. Is called for every text node found as parent of given to rewriteContent method.
      Parameters:
      text - Text node
      Returns:
      null if nothing is to do with this element. Return empty list to remove the element. Return list with other content to replace element with new content.