Class MockXSSAPIImpl
- java.lang.Object
-
- org.apache.sling.testing.mock.sling.MockXSSAPIImpl
-
- All Implemented Interfaces:
org.apache.sling.xss.XSSAPI
public final class MockXSSAPIImpl extends Object implements org.apache.sling.xss.XSSAPI
This is a very simplified mock implementation ofXSSAPI
which in most cases just returns the value that was passed in, or does only very basic validation.
-
-
Constructor Summary
Constructors Constructor Description MockXSSAPIImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable String
encodeForCSSString(@Nullable String source)
@Nullable String
encodeForHTML(@Nullable String source)
@Nullable String
encodeForHTMLAttr(@Nullable String source)
@Nullable String
encodeForJSString(@Nullable String source)
@Nullable String
encodeForXML(@Nullable String source)
@Nullable String
encodeForXMLAttr(@Nullable String source)
@NotNull String
filterHTML(@Nullable String source)
@Nullable String
getValidCSSColor(@Nullable String color, @Nullable String defaultColor)
@Nullable String
getValidDimension(@Nullable String dimension, @Nullable String defaultValue)
@Nullable Double
getValidDouble(@Nullable String source, double defaultValue)
@NotNull String
getValidHref(@Nullable String url)
@Nullable Integer
getValidInteger(@Nullable String integer, int defaultValue)
String
getValidJSON(@Nullable String json, @Nullable String defaultJson)
@Nullable String
getValidJSToken(@Nullable String token, @Nullable String defaultValue)
@Nullable Long
getValidLong(@Nullable String source, long defaultValue)
String
getValidMultiLineComment(@Nullable String comment, @Nullable String defaultComment)
@Nullable String
getValidStyleToken(@Nullable String token, @Nullable String defaultValue)
String
getValidXML(@Nullable String xml, @Nullable String defaultXml)
-
-
-
Method Detail
-
getValidInteger
@Nullable public @Nullable Integer getValidInteger(@Nullable @Nullable String integer, int defaultValue)
- Specified by:
getValidInteger
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidLong
@Nullable public @Nullable Long getValidLong(@Nullable @Nullable String source, long defaultValue)
- Specified by:
getValidLong
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidDouble
@Nullable public @Nullable Double getValidDouble(@Nullable @Nullable String source, double defaultValue)
- Specified by:
getValidDouble
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidDimension
@Nullable public @Nullable String getValidDimension(@Nullable @Nullable String dimension, @Nullable @Nullable String defaultValue)
- Specified by:
getValidDimension
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidHref
@NotNull public @NotNull String getValidHref(@Nullable @Nullable String url)
- Specified by:
getValidHref
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidJSToken
@Nullable public @Nullable String getValidJSToken(@Nullable @Nullable String token, @Nullable @Nullable String defaultValue)
- Specified by:
getValidJSToken
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidStyleToken
@Nullable public @Nullable String getValidStyleToken(@Nullable @Nullable String token, @Nullable @Nullable String defaultValue)
- Specified by:
getValidStyleToken
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidCSSColor
@Nullable public @Nullable String getValidCSSColor(@Nullable @Nullable String color, @Nullable @Nullable String defaultColor)
- Specified by:
getValidCSSColor
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidMultiLineComment
public String getValidMultiLineComment(@Nullable @Nullable String comment, @Nullable @Nullable String defaultComment)
- Specified by:
getValidMultiLineComment
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidJSON
public String getValidJSON(@Nullable @Nullable String json, @Nullable @Nullable String defaultJson)
- Specified by:
getValidJSON
in interfaceorg.apache.sling.xss.XSSAPI
-
getValidXML
public String getValidXML(@Nullable @Nullable String xml, @Nullable @Nullable String defaultXml)
- Specified by:
getValidXML
in interfaceorg.apache.sling.xss.XSSAPI
-
encodeForHTML
@Nullable public @Nullable String encodeForHTML(@Nullable @Nullable String source)
- Specified by:
encodeForHTML
in interfaceorg.apache.sling.xss.XSSAPI
-
encodeForHTMLAttr
@Nullable public @Nullable String encodeForHTMLAttr(@Nullable @Nullable String source)
- Specified by:
encodeForHTMLAttr
in interfaceorg.apache.sling.xss.XSSAPI
-
encodeForXML
@Nullable public @Nullable String encodeForXML(@Nullable @Nullable String source)
- Specified by:
encodeForXML
in interfaceorg.apache.sling.xss.XSSAPI
-
encodeForXMLAttr
@Nullable public @Nullable String encodeForXMLAttr(@Nullable @Nullable String source)
- Specified by:
encodeForXMLAttr
in interfaceorg.apache.sling.xss.XSSAPI
-
encodeForJSString
@Nullable public @Nullable String encodeForJSString(@Nullable @Nullable String source)
- Specified by:
encodeForJSString
in interfaceorg.apache.sling.xss.XSSAPI
-
encodeForCSSString
@Nullable public @Nullable String encodeForCSSString(@Nullable @Nullable String source)
- Specified by:
encodeForCSSString
in interfaceorg.apache.sling.xss.XSSAPI
-
-