Class HtmlTemplateHelper

java.lang.Object
org.mockserver.templates.engine.helpers.HtmlTemplateHelper

public class HtmlTemplateHelper extends Object
HTML entity escaping helpers for templates: escape a string so it can be safely embedded in HTML, and reverse the operation. Backed by Apache commons-text (already on the classpath), so the full HTML4 entity set is supported, with & < > " and named/numeric entities handled.
  • Constructor Details

    • HtmlTemplateHelper

      public HtmlTemplateHelper()
  • Method Details

    • escape

      public String escape(String value)
      Escapes the characters in the input using HTML entities (HTML 4.0). Returns an empty string for null input.
    • unescape

      public String unescape(String value)
      Unescapes a string containing HTML 4.0 entity escapes back to the original characters. Returns an empty string for null input.
    • toString

      public String toString()
      Overrides:
      toString in class Object