Class HtmlEncoder


  • public final class HtmlEncoder
    extends java.lang.Object
    This type exposes helper methods that will help defend against XSS attacks with HTML encoding.

    For more information on XSS: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String encode​(java.lang.String s)
      Return an HTML-encoded version of the value passed in.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • encode

        public static java.lang.String encode​(java.lang.String s)
        Return an HTML-encoded version of the value passed in.
        Parameters:
        s - the string in which to replace HTML entities
        Returns:
        an HTML-encoded version of the String passed in, or null if the input was null