Class RtfCleaner

java.lang.Object
overit.geocall.ui.cleaner.Cleaner
overit.geocall.ui.cleaner.RtfCleaner
All Implemented Interfaces:
Serializable

public class RtfCleaner extends Cleaner
This class implements the Cleaner object that performs the sanitization that allows to insert some safe html code just to obtain a minimum of formatting (like bold, italic, paragraphs, etc), but prevents the insert of active html (such as the scripts). The active html is recognized and deleted from the string.
The sanitization is based on the OWASP libraries
See Also:
  • Constructor Details

    • RtfCleaner

      protected RtfCleaner()
  • Method Details

    • safeCopy

      public Cleaner safeCopy()
      Returns a new instance of the cleaner totally independent of the original, because the cleaning methodology is not thread safe
      Specified by:
      safeCopy in class Cleaner
      Returns:
      A new instance of the object totally independent of the original
    • sift

      public String sift(String rtf)
      Sifts the string to find and remove any html that is more than rtf. The html code that is not allowed is recognized and deleted from the string.
      Allowed elements and attributes for the cleaner
      Allowed elements and attributes
      Formattingb, i, font, s, u, o, sup, sub, ins, del, strong, strike, tt, code, big, small, br, span
      Blocksp, div, h1, h2, h3, h4, h5, h6, ul, ol, li, blockquote
      Specified by:
      sift in class Cleaner
      Parameters:
      rtf - The string to be sifted
      Returns:
      The string parameter without the unwanted substrings
    • quote

      public String quote(String rtf)
      The string is returned as is, beacuse there's no need to quote symobls
      Specified by:
      quote in class Cleaner
      Parameters:
      rtf - The string to return
      Returns:
      The parameter as is