@ProviderType public final class XSSFunctions extends Object
| Modifier and Type | Method and Description |
|---|---|
static CharSequence |
encodeForHTML(org.apache.sling.xss.XSSAPI xssAPI,
String source)
Encode a string for HTML.
|
static CharSequence |
encodeForHTML(com.adobe.granite.xss.XSSAPI xssAPI,
String source)
Deprecated.
replaced by
encodeForHTML(XSSAPI, String)
Encode a string for HTML. |
static CharSequence |
encodeForHTMLAttr(org.apache.sling.xss.XSSAPI xssAPI,
String source)
Encode a string for an HTML attribute.
|
static CharSequence |
encodeForHTMLAttr(com.adobe.granite.xss.XSSAPI xssAPI,
String source)
Deprecated.
replaced by
encodeForHTMLAttr(XSSAPI, String)
Encode a string for an HTML attribute. |
static CharSequence |
encodeForJSString(org.apache.sling.xss.XSSAPI xssAPI,
String source)
Encode a string for an JavaScript string.
|
static CharSequence |
encodeForJSString(com.adobe.granite.xss.XSSAPI xssAPI,
String source)
Deprecated.
replaced by
encodeForJSString(XSSAPI, String)
Encode a string for an JavaScript string. |
static CharSequence |
filterHTML(org.apache.sling.xss.XSSAPI xssAPI,
String source)
Filter a string for HTML.
|
static CharSequence |
filterHTML(com.adobe.granite.xss.XSSAPI xssAPI,
String source)
Deprecated.
replaced by
filterHTML(XSSAPI, String)
Filter a string for HTML. |
static String |
getValidDimension(org.apache.sling.xss.XSSAPI xssAPI,
String dimension,
String defaultValue)
Validate a string which should contain a dimension, returning a default value if the source is
empty, can't be parsed, or contains XSS risks.
|
static String |
getValidDimension(com.adobe.granite.xss.XSSAPI xssAPI,
String dimension,
String defaultValue)
Deprecated.
replaced by
getValidDimension(XSSAPI, String, String)
Validate a string which should contain a dimension, returning a default value if the source is
empty, can't be parsed, or contains XSS risks. Allows integer dimensions and the keyword "auto". |
static CharSequence |
getValidHref(org.apache.sling.xss.XSSAPI xssAPI,
String source)
Get a valid href.
|
static CharSequence |
getValidHref(com.adobe.granite.xss.XSSAPI xssAPI,
String source)
Deprecated.
replaced by
getValidHref(XSSAPI, String)
Get a valid href. This does not use the standard XSS API due to a bug
impacting CQ 5.6.1 (and earlier). Internal bug reference: GRANITE-4193 |
static Integer |
getValidInteger(org.apache.sling.xss.XSSAPI xssAPI,
String integer,
int defaultValue)
Validate a string which should contain an integer, returning a default value if the source is
empty, can't be parsed, or contains XSS risks.
|
static Integer |
getValidInteger(com.adobe.granite.xss.XSSAPI xssAPI,
String integer,
int defaultValue)
Deprecated.
replaced by
getValidInteger(XSSAPI, String, int)
Validate a string which should contain an integer, returning a default value if the source is
empty, can't be parsed, or contains XSS risks. |
static String |
getValidJSToken(org.apache.sling.xss.XSSAPI xssAPI,
String token,
String defaultValue)
Validate a Javascript token.
|
static String |
getValidJSToken(com.adobe.granite.xss.XSSAPI xssAPI,
String token,
String defaultValue)
Deprecated.
replaced by
getValidJSToken(XSSAPI, String, String)
Validate a Javascript token. The value must be either a single identifier, a literal number,
or a literal string. |
public static CharSequence encodeForHTML(org.apache.sling.xss.XSSAPI xssAPI, String source)
xssAPI - the XSSAPIsource - the source string@Deprecated public static CharSequence encodeForHTML(com.adobe.granite.xss.XSSAPI xssAPI, String source)
encodeForHTML(XSSAPI, String)
Encode a string for HTML.xssAPI - the XSSAPIsource - the source stringpublic static CharSequence encodeForHTMLAttr(org.apache.sling.xss.XSSAPI xssAPI, String source)
xssAPI - the XSSAPIsource - the source string@Deprecated public static CharSequence encodeForHTMLAttr(com.adobe.granite.xss.XSSAPI xssAPI, String source)
encodeForHTMLAttr(XSSAPI, String)
Encode a string for an HTML attribute.xssAPI - the XSSAPIsource - the source stringpublic static CharSequence encodeForJSString(org.apache.sling.xss.XSSAPI xssAPI, String source)
xssAPI - the XSSAPIsource - the source string@Deprecated public static CharSequence encodeForJSString(com.adobe.granite.xss.XSSAPI xssAPI, String source)
encodeForJSString(XSSAPI, String)
Encode a string for an JavaScript string.xssAPI - the XSSAPIsource - the source stringpublic static CharSequence filterHTML(org.apache.sling.xss.XSSAPI xssAPI, String source)
xssAPI - the XSSAPIsource - the source string@Deprecated public static CharSequence filterHTML(com.adobe.granite.xss.XSSAPI xssAPI, String source)
filterHTML(XSSAPI, String)
Filter a string for HTML.xssAPI - the XSSAPIsource - the source stringpublic static CharSequence getValidHref(org.apache.sling.xss.XSSAPI xssAPI, String source)
xssAPI - the XSSAPIsource - the source string@Deprecated public static CharSequence getValidHref(com.adobe.granite.xss.XSSAPI xssAPI, String source)
getValidHref(XSSAPI, String)
Get a valid href. This does not use the standard XSS API due to a bug
impacting CQ 5.6.1 (and earlier). Internal bug reference: GRANITE-4193xssAPI - the XSSAPIsource - the source stringpublic static String getValidDimension(org.apache.sling.xss.XSSAPI xssAPI, String dimension, String defaultValue)
xssAPI - the XSSAPIdimension - the source dimensiondefaultValue - a default value if the source can't be used@Deprecated public static String getValidDimension(com.adobe.granite.xss.XSSAPI xssAPI, String dimension, String defaultValue)
getValidDimension(XSSAPI, String, String)
Validate a string which should contain a dimension, returning a default value if the source is
empty, can't be parsed, or contains XSS risks. Allows integer dimensions and the keyword "auto".xssAPI - the XSSAPIdimension - the source dimensiondefaultValue - a default value if the source can't be usedpublic static Integer getValidInteger(org.apache.sling.xss.XSSAPI xssAPI, String integer, int defaultValue)
xssAPI - the XSSAPIinteger - the source integerdefaultValue - a default value if the source can't be used@Deprecated public static Integer getValidInteger(com.adobe.granite.xss.XSSAPI xssAPI, String integer, int defaultValue)
getValidInteger(XSSAPI, String, int)
Validate a string which should contain an integer, returning a default value if the source is
empty, can't be parsed, or contains XSS risks.xssAPI - the XSSAPIinteger - the source integerdefaultValue - a default value if the source can't be usedpublic static String getValidJSToken(org.apache.sling.xss.XSSAPI xssAPI, String token, String defaultValue)
xssAPI - the XSSAPItoken - the source tokendefaultValue - a default value to use if the source doesn't meet validity constraints.@Deprecated public static String getValidJSToken(com.adobe.granite.xss.XSSAPI xssAPI, String token, String defaultValue)
getValidJSToken(XSSAPI, String, String)
Validate a Javascript token. The value must be either a single identifier, a literal number,
or a literal string.xssAPI - the XSSAPItoken - the source tokendefaultValue - a default value to use if the source doesn't meet validity constraints.Copyright © 2013–2020 Adobe. All rights reserved.