Class EscapeTool

java.lang.Object
org.owasp.dependencycheck.reporting.EscapeTool

@ThreadSafe public class EscapeTool extends Object
An extremely simple wrapper around various escape utils to perform URL and HTML encoding within the reports. This class was created to simplify the velocity configuration and avoid using the "built-in" escape tool.
Author:
Jeremy Long
  • Constructor Details

    • EscapeTool

      public EscapeTool()
  • Method Details

    • url

      public String url(String text)
      URL Encodes the provided text.
      Parameters:
      text - the text to encode
      Returns:
      the URL encoded text
    • html

      public String html(String text)
      HTML Encodes the provided text.
      Parameters:
      text - the text to encode
      Returns:
      the HTML encoded text
    • html

      public String html(Object o)
    • xml

      public String xml(String text)
      XML Encodes the provided text.
      Parameters:
      text - the text to encode
      Returns:
      the XML encoded text
    • xml

      public String xml(Object o)
    • json

      public String json(String text)
      JSON Encodes the provided text.
      Parameters:
      text - the text to encode
      Returns:
      the JSON encoded text
    • json

      public String json(Object o)
    • javascript

      public String javascript(String text)
      JavaScript encodes the provided text.
      Parameters:
      text - the text to encode
      Returns:
      the JavaScript encoded text
    • csv

      public String csv(String text)
      Formats text for CSV format. This includes trimming whitespace, replace line breaks with spaces, and if necessary quotes the text and/or escapes contained quotes.
      Parameters:
      text - the text to escape and quote
      Returns:
      the escaped and quoted text
    • csvIdentifiers

      public String csvIdentifiers(Set<Identifier> ids)
      Takes a set of Identifiers, filters them to none CPE, and formats them for display in a CSV.
      Parameters:
      ids - the set of identifiers
      Returns:
      the formatted list of none CPE identifiers
    • csvCpeConfidence

      public String csvCpeConfidence(Set<Identifier> ids)
      Takes a set of Identifiers, filters them to just CPEs, and formats them for confidence display in a CSV.
      Parameters:
      ids - the set of identifiers
      Returns:
      the formatted list of confidence