Class AbstractAntiSamyScanner

java.lang.Object
org.owasp.validator.html.scan.AbstractAntiSamyScanner
Direct Known Subclasses:
AntiSamyDOMScanner, AntiSamySAXScanner

public abstract class AbstractAntiSamyScanner extends Object
This class defines the basic structure for each type of AntiSamy scanner. All the scanning/filtration logic is to reside in each implementation of this class, but the implementations should not be called directly. All scanning should be done through an AntiSamy.scan() method invocation.
Author:
Arshan Dabirsiaghi
  • Field Details

    • policy

      protected final InternalPolicy policy
    • errorMessages

      protected final List<String> errorMessages
    • messages

      protected static final ResourceBundle messages
    • locale

      protected final Locale locale
    • isNofollowAnchors

      protected boolean isNofollowAnchors
    • isNoopenerAndNoreferrerAnchors

      protected boolean isNoopenerAndNoreferrerAnchors
    • isValidateParamAsEmbed

      protected boolean isValidateParamAsEmbed
  • Constructor Details

    • AbstractAntiSamyScanner

      public AbstractAntiSamyScanner(Policy policy)
      Construct an AntiSamy Scanner instance that uses the specified AntiSamy policy.
      Parameters:
      policy - The policy to use.
    • AbstractAntiSamyScanner

      public AbstractAntiSamyScanner() throws PolicyException
      Construct an AntiSamy Scanner instance that uses the default AntiSamy policy file.
      Throws:
      PolicyException - thrown when there is a problem validating or parsing the policy file. Any validation errors not caught by the XML validation will be thrown with this exception.
  • Method Details

    • scan

      public abstract CleanResults scan(String html) throws ScanException
      Throws:
      ScanException
    • getResults

      public abstract CleanResults getResults()
    • addError

      protected void addError(String errorKey, Object[] objs)
    • getOutputFormat

      protected org.apache.xml.serialize.OutputFormat getOutputFormat()
    • getHTMLSerializer

      protected org.apache.xml.serialize.HTMLSerializer getHTMLSerializer(Writer w, org.apache.xml.serialize.OutputFormat format)
    • trim

      protected String trim(String original, String cleaned)