Package org.primefaces.util
Class EscapeUtils
java.lang.Object
org.primefaces.util.EscapeUtils
Utility methods contained herein must be used strictly for the appropriate context, e.g., HTML, HTML attribute, JS string.
Method calls are delegated to safe and well-tried allowlist encoders from owasp-java-encoding.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringforCssString(String input) static Stringstatic Stringstatic StringforHtmlAttribute(String input) static StringforHtmlContent(String input) static StringforHtmlUnquotedAttribute(String input) static Stringstatic StringforJavaScript(String input) static StringforJavaScriptAttribute(String input) static StringforJavaScriptBlock(String input) static StringforJavaScriptSource(String input) static StringforJavaScriptVarName(String input) static StringforUriComponent(String input) static Stringstatic StringforXmlAttribute(String input) static StringforXmlComment(String input) static StringforXmlContent(String input) static StringEnsure a valid XMLElement name is returned.
Uses theXMLChar
Replaces spaces by underscores, < by .lt, > by .gt.
-
Method Details
-
forHtml
- See Also:
-
Encode.forHtml(String)
-
forHtmlContent
- See Also:
-
Encode.forHtmlContent(String)
-
forHtmlAttribute
- See Also:
-
Encode.forHtmlAttribute(String)
-
forHtmlUnquotedAttribute
- See Also:
-
Encode.forHtmlUnquotedAttribute(String)
-
forCssString
- See Also:
-
Encode.forCssString(String)
-
forCssUrl
- See Also:
-
Encode.forCssUrl(String)
-
forUriComponent
- See Also:
-
Encode.forUriComponent(String)
-
forXml
- See Also:
-
Encode.forXml(String)
-
forXmlContent
- See Also:
-
Encode.forXmlContent(String)
-
forXmlAttribute
- See Also:
-
Encode.forXmlAttribute(String)
-
forXmlComment
- See Also:
-
Encode.forXmlComment(String)
-
forCDATA
- See Also:
-
Encode.forCDATA(String)
-
forJava
- See Also:
-
Encode.forJava(String)
-
forJavaScript
- See Also:
-
Encode.forJavaScript(String)
-
forJavaScriptAttribute
- See Also:
-
Encode.forJavaScriptAttribute(String)
-
forJavaScriptBlock
- See Also:
-
Encode.forJavaScriptBlock(String)
-
forJavaScriptSource
- See Also:
-
Encode.forJavaScriptSource(String)
-
forJavaScriptVarName
-
forXmlTag
Ensure a valid XMLElement name is returned.
Uses theXMLChar
Replaces spaces by underscores, < by .lt, > by .gt. and all other characters by '.X.', where is the output ofInteger.toHexString()- Parameters:
intag- the source for the element name- Returns:
- valid XML element name
-