Package org.atmosphere.util
Class HtmlEncoder
java.lang.Object
org.atmosphere.util.HtmlEncoder
Utility class for encoding strings to prevent HTML injection (XSS).
Encodes the five critical HTML characters:
& < > " '.-
Method Summary
-
Method Details
-
encode
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 benull- Returns:
- the encoded string, or
nullif input wasnull
-