Package org.apache.sling.xss.impl
Class HtmlToHtmlContentContext
- java.lang.Object
-
- org.apache.sling.xss.impl.HtmlToHtmlContentContext
-
- All Implemented Interfaces:
XSSFilterRule
public class HtmlToHtmlContentContext extends Object implements XSSFilterRule
This class implements an escaping rule to be used for cleaning up existing HTML content. The output will still be HTML.The cleanup is performed using the AntiSamy library found at http://www.owasp.org/index.php/AntiSamy
-
-
Constructor Summary
Constructors Constructor Description HtmlToHtmlContentContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheck(PolicyHandler policyHandler, String str)Check to see if a given string contains policy violations.Stringfilter(PolicyHandler policyHandler, String unsafeString)Filter a given string to remove any policy violations.booleansupportsPolicy()
-
-
-
Method Detail
-
check
public boolean check(PolicyHandler policyHandler, String str)
Description copied from interface:XSSFilterRuleCheck to see if a given string contains policy violations.- Specified by:
checkin interfaceXSSFilterRule- Parameters:
policyHandler- the policy handler to use for filteringstr- the input to check- Returns:
- true if the source string is free of policy violations (as defined by policyHandler)
- See Also:
XSSFilterRule.check(PolicyHandler, String)
-
filter
public String filter(PolicyHandler policyHandler, String unsafeString)
Description copied from interface:XSSFilterRuleFilter a given string to remove any policy violations.- Specified by:
filterin interfaceXSSFilterRule- Parameters:
policyHandler- the policy handler to use for filteringunsafeString- the input to filter- Returns:
- a filtered string which is "safe" (as defined by policyHandler)
- See Also:
XSSFilterRule.filter(PolicyHandler, java.lang.String)
-
supportsPolicy
public boolean supportsPolicy()
- Specified by:
supportsPolicyin interfaceXSSFilterRule- See Also:
XSSFilterRule.supportsPolicy()
-
-