Class HtmlEncoder


  • public final class HtmlEncoder
    extends Object
    HTML encoding of special characters to prevent cross site scripting (XSS) attacks. Any data that is "echoed" back from a request can be used to execute a script in a browser unless properly encoded.
    • Method Detail

      • encode

        public static String encode​(String s)
        Encode HTML string replacing the special characters by their corresponding entities.
        Parameters:
        s - string to encode.
        Returns:
        encoded string.