Class HtmlEntityEncodingHtmlSanitizer

java.lang.Object
io.micronaut.http.util.HtmlEntityEncodingHtmlSanitizer
All Implemented Interfaces:
HtmlSanitizer

@Singleton @Requires(missingBeans=HtmlSanitizer.class) public class HtmlEntityEncodingHtmlSanitizer extends Object implements HtmlSanitizer
Given an HTML string, it encodes the following characters: & to &amp;, < to &lt;, > to &gt;, " to &quot;, and ' to &#x27;.
See Also:
  • Constructor Details

    • HtmlEntityEncodingHtmlSanitizer

      public HtmlEntityEncodingHtmlSanitizer()
  • Method Details

    • sanitize

      public @NonNull String sanitize(@Nullable String html)
      Description copied from interface: HtmlSanitizer
      Sanitizes a string of HTML.
      Specified by:
      sanitize in interface HtmlSanitizer
      Parameters:
      html - the String of HTML to Sanitize
      Returns:
      a sanitized version of the supplied HTML String.