public class CmsParameterEscaper
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
DEFAULT_POLICY
The file name of the default policy.
|
protected static org.owasp.validator.html.Policy |
defaultPolicy
The default policy, which is used when no policy path is given.
|
构造器和说明 |
---|
CmsParameterEscaper() |
限定符和类型 | 方法和说明 |
---|---|
org.owasp.validator.html.AntiSamy |
createAntiSamy(CmsObject cms,
java.lang.String policyPath)
Creates a new AntiSamy instance for a given policy path.
|
void |
enableAntiSamy(CmsObject cms,
java.lang.String policyPath,
java.util.Set<java.lang.String> params)
Enables the AntiSamy HTML cleaning for some parameters.
|
java.lang.String |
escape(java.lang.String name,
java.lang.String html)
Escapes a single parameter value.
|
java.lang.String[] |
escape(java.lang.String name,
java.lang.String[] values)
Escapes an array of parameter values.
|
java.lang.String |
filterAntiSamy(java.lang.String html)
Filters HTML input using the internal AntiSamy instance.
|
static org.owasp.validator.html.Policy |
readPolicy(CmsObject cms,
java.lang.String sitePath)
Helper method for reading an AntiSamy policy file from the VFS.
|
void |
setExceptions(java.util.Collection<java.lang.String> exceptions)
Sets the set of names of parameters which shouldn't be escaped.
|
public static final java.lang.String DEFAULT_POLICY
protected static org.owasp.validator.html.Policy defaultPolicy
public static org.owasp.validator.html.Policy readPolicy(CmsObject cms, java.lang.String sitePath)
cms
- the current CMS contextsitePath
- the site path of the policy filepublic org.owasp.validator.html.AntiSamy createAntiSamy(CmsObject cms, java.lang.String policyPath)
cms
- the current CMS contextpolicyPath
- the policy site pathpublic void enableAntiSamy(CmsObject cms, java.lang.String policyPath, java.util.Set<java.lang.String> params)
cms
- the current CMS contextpolicyPath
- the policy site path in the VFSparams
- the parameters for which HTML cleaning should be enabledpublic java.lang.String escape(java.lang.String name, java.lang.String html)
name
- the name of the parameterhtml
- the value of the parameterpublic java.lang.String[] escape(java.lang.String name, java.lang.String[] values)
name
- the parameter namevalues
- the parameter valuespublic java.lang.String filterAntiSamy(java.lang.String html)
html
- the HTML to filterpublic void setExceptions(java.util.Collection<java.lang.String> exceptions)
exceptions
- a set of parameter names