|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.WysiwygManager
public final class WysiwygManager
HTML manipulation methods for use inside JCMS.
HtmlUtil
,
WysiwygMediasRewriter
,
WysiwygRenderer
,
WysiwygPolicyFilter
Field Summary | |
---|---|
static String |
CLEANHTML_CTXT_DATA
HTML cleanup context map key to use to store the Data instance for which HTML cleanup is being performed. |
static String |
CLEANHTML_CTXT_FIELDNAME
HTML cleanup context map key to use to store the name of the Data field for which HTML cleanup is being performed. |
Fields inherited from interface com.jalios.util.JPropertiesListener |
---|
REVISION |
Method Summary | |
---|---|
static String[] |
cleanHtml(String[] unsafeStrArray,
Map<String,Object> contextMap)
Get safe HTML from untrusted input HTML, by parsing input HTML and filtering it through a white-list of permitted tags and attributes. |
static String |
cleanHtml(String unsafeStr,
Map<String,Object> contextMap)
Get safe HTML from untrusted input HTML, by parsing input HTML and filtering it through a white-list of permitted tags and attributes. |
static Map<String,Object> |
getCleanHtmlContextMap(Data data,
String fieldName)
Retrieve a context map for use in cleanHtml method. |
static WysiwygManager |
getInstance()
Retrieve the WysiwygManager singleton. |
org.jsoup.safety.Whitelist |
getWhitelist()
Retrive the JSoup Whitelist used for HTML sanitization. |
static org.jsoup.safety.Whitelist |
loadWhitelist(JProperties properties)
Initialize a JSoup Whitelist from configuration available in the specifie JProperties. |
void |
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CLEANHTML_CTXT_DATA
public static final String CLEANHTML_CTXT_FIELDNAME
Method Detail |
---|
public static final WysiwygManager getInstance()
public void propertiesChange(JProperties properties)
JPropertiesListener
You cannot alter the value received in parameters.
propertiesChange
in interface JPropertiesListener
properties
- the properties which have been modified (may not contain all JCMS properties)public org.jsoup.safety.Whitelist getWhitelist()
public static org.jsoup.safety.Whitelist loadWhitelist(JProperties properties)
wysiwyg.sanitize-html.whitelist.*.
.
# Declare a configuration of whitelist # Is this whitelist enabled (if so, it will be added to other enabled whitelist configuration) wysiwyg.sanitize-html.whitelist.somewhitelist.enabled: false # HTML tags and attributes allowed by this whitelist wysiwyg.sanitize-html.whitelist.somewhitelist.tags:\ a[href|title],\ blockquote[cite],\ strong # Protocols authorized for use for the specified tag & attribute wysiwyg.sanitize-html.whitelist.somewhitelist.protocols.a: href[ftp|http|https|mailto] wysiwyg.sanitize-html.whitelist.somewhitelist.protocols.blockquote: cite[http|https]Only the configurations that have been enabled will be used to create the Whitelist object.
properties
- the JProperties from which configuration will be read to create the Whitelist
public static String cleanHtml(String unsafeStr, Map<String,Object> contextMap)
Cleaning will occurs only if HTML sanitization is enabled with property wysiwyg.sanitize-html: true
.
unsafeStr
- input untrusted HTML (body fragment)contextMap
- a contextual map used to provide additionnal information regarding sanization context
public static String[] cleanHtml(String[] unsafeStrArray, Map<String,Object> contextMap)
Cleaning will occurs only if HTML sanitization is enabled with property wysiwyg.sanitize-html: true
.
unsafeStrArray
- array of untrusted input HTML (body fragment)contextMap
- a contextual map used to provide additionnal information regarding sanization context
public static Map<String,Object> getCleanHtmlContextMap(Data data, String fieldName)
data
- the Data for which the HTML cleanup is being performedfieldName
- the name of the Data field for which the HTML cleanup is being performed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |