Class HtmlEncoder


  • public final class HtmlEncoder
    extends 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 Detail

      • encode

        public static String encode​(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