Class HtmlEncoder

java.lang.Object
org.atmosphere.util.HtmlEncoder

public final class HtmlEncoder extends Object
Utility class for encoding strings to prevent HTML injection (XSS). Encodes the five critical HTML characters: & < > " '.
  • Method Details

    • encode

      public static String encode(String input)
      Encodes a string by replacing HTML special characters with their corresponding HTML entities. This prevents cross-site scripting (XSS) when the string is rendered in an HTML context.
      Parameters:
      input - the string to encode, may be null
      Returns:
      the encoded string, or null if input was null