Interface RichTextHandler

  • All Known Implementing Classes:
    RichTextHandlerImpl

    public interface RichTextHandler
    Contains methods to handle rich text formatting, as well as replacing image URL's with internal tags.
    See Also:
    RichText
    • Method Detail

      • applyPropertyMapping

        String applyPropertyMapping​(DataTranslationPropertyMapping propertyMapping,
                                    String value,
                                    boolean fromClient)
        Apply all property mapping definitions to the translated value according if the data is received or sent to the client
      • escapeTags

        String escapeTags​(String text)
        Replaces all '<' by '< ', effectively invalidating all HTML tags
      • replaceTagsByUrls

        String replaceTagsByUrls​(String html)
        Replaces internal tags to URLs. Should be invoked when converting a data to be sent to a client on an entity model (VO / DTO) from an entity.
        See Also:
        replaceUrlsByTags(String)
      • replaceUrlsByTags

        String replaceUrlsByTags​(String html)
        Replaces URLs to to internal tags. Normally a call to sanitize(String) is sufficient, but there might be cases where an HTML sanitization is not needed, just the replacing of URL tags by full URLs. The following tags are handled:
      • sanitize

        String sanitize​(String html)
        Sanitizes the given HTML, removing blacklisted tags, correctly closing unclosed tags and removing leading / trailing whitespaces. Administrators are allowed to use iframes and forms, but not regular users. Scripts and style tags are forbidden. Null inputs, as well as empty strings, results in null.