public class BasicWhitelistConfiguration extends Object implements MutableWhitelistConfiguration
BasicWhitelistConfiguration class.
| Constructor and Description |
|---|
BasicWhitelistConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
MutableWhitelistConfiguration |
allowAttribute(String tagName,
String attrName)
Add an allowed attribute to the configuration
|
void |
allowedAttributes(BiConsumer<String,List<String>> fn)
fn will be called once for each allowed tag
with the allowed attributes as the second argument, for
example accept('a',['href','rel'])
|
void |
allowedProtocols(BiConsumer<String,Map<String,List<String>>> fn)
fn will be called once for each allowed tag
with the allowed protocols as the second argument, for
example accept('a',{ 'href':['http','https'] })
|
void |
allowedTags(Consumer<String> fn)
fn will be called once for each allowed tag.
|
MutableWhitelistConfiguration |
allowProtocol(String tagName,
String attrName,
String protocol)
Add an allowed protocol to the configuration
|
boolean |
allowsAttribute(String tagName,
String attrName) |
boolean |
allowsProtocol(String tagName,
String attrName,
String protocol)
allowsProtocol.
|
boolean |
allowsTag(String tagName) |
MutableWhitelistConfiguration |
allowTag(String tagName)
Add an allowed tag to the configuration
|
org.jsoup.safety.Whitelist |
apply(org.jsoup.safety.Whitelist whitelist)
Applies all the configured rules to the supplied
Whitelist instance. |
String |
base() |
MutableWhitelistConfiguration |
base(String base)
Sets the base whitelist to use when configuring a
Whitelist, 'none' is the default value. |
MutableWhitelistConfiguration |
enforceAttribute(String tagName,
String attrName,
String enforcedValue)
Add an enforced attribute value to the configuration
|
void |
enforcedAttributes(BiConsumer<String,Map<String,String>> fn)
fn will be called once for each allowed tag
with the enforced attributes map as the second argument, for
example accept('a',{ 'rel':'nofollow' })
|
boolean |
enforcesAttribute(String tagName,
String attrName) |
boolean |
enforcesAttribute(String tagName,
String attrName,
String enforcedValue) |
boolean |
equals(Object o) |
boolean |
hasAllowedAttributes(String tagName) |
boolean |
hasAllowedProtocols(String tagName) |
boolean |
hasAllowedProtocols(String tagName,
String attrName) |
boolean |
hasEnforcedAttributes(String tagName) |
int |
hashCode() |
String |
toString() |
org.jsoup.safety.Whitelist |
whitelist()
Constructs an empty
Whitelist and applies the configured
rules to it. |
public String base()
base in interface WhitelistConfigurationpublic MutableWhitelistConfiguration allowTag(String tagName)
Add an allowed tag to the configuration
allowTag in interface MutableWhitelistConfigurationtagName - (non null) an HTML tag nameMutableWhitelistConfiguration object.public void allowedTags(Consumer<String> fn)
fn will be called once for each allowed tag.
allowedTags in interface WhitelistConfigurationfn - (non null) a Consumer object.public void allowedAttributes(BiConsumer<String,List<String>> fn)
fn will be called once for each allowed tag with the allowed attributes as the second argument, for example accept('a',['href','rel'])
allowedAttributes in interface WhitelistConfigurationfn - a BiConsumer object.public void enforcedAttributes(BiConsumer<String,Map<String,String>> fn)
fn will be called once for each allowed tag with the enforced attributes map as the second argument, for example accept('a',{ 'rel':'nofollow' })
enforcedAttributes in interface WhitelistConfigurationfn - a BiConsumer object.public void allowedProtocols(BiConsumer<String,Map<String,List<String>>> fn)
fn will be called once for each allowed tag with the allowed protocols as the second argument, for example accept('a',{ 'href':['http','https'] })
allowedProtocols in interface WhitelistConfigurationfn - a BiConsumer object.public boolean allowsTag(String tagName)
allowsTag in interface WhitelistConfigurationtagName - (non null) a valid HTML tag namepublic boolean hasAllowedAttributes(String tagName)
hasAllowedAttributes in interface WhitelistConfigurationtagName - (non null) a valid HTML tag namepublic MutableWhitelistConfiguration allowAttribute(String tagName, String attrName)
Add an allowed attribute to the configuration
allowAttribute in interface MutableWhitelistConfigurationtagName - (non null) an HTML tag nameattrName - (non null) an HTML attribute nameMutableWhitelistConfiguration object.public boolean allowsAttribute(String tagName, String attrName)
allowsAttribute in interface WhitelistConfigurationtagName - (non null) a valid HTML tag nameattrName - (non null) a valid HTML attribute namepublic boolean hasEnforcedAttributes(String tagName)
hasEnforcedAttributes in interface WhitelistConfigurationtagName - (non null) a valid HTML tag namepublic boolean enforcesAttribute(String tagName, String attrName)
enforcesAttribute in interface WhitelistConfigurationtagName - (non null) a valid HTML tag nameattrName - (non null) a valid HTML attribute namepublic boolean enforcesAttribute(String tagName, String attrName, String enforcedValue)
enforcesAttribute in interface WhitelistConfigurationtagName - (non null) a valid HTML tag nameattrName - (non null) a valid HTML attribute nameenforcedValue - a String object.public MutableWhitelistConfiguration enforceAttribute(String tagName, String attrName, String enforcedValue)
Add an enforced attribute value to the configuration
enforceAttribute in interface MutableWhitelistConfigurationtagName - (non null) an HTML tag nameattrName - (non null) an HTML attribute nameenforcedValue - (non null) the string value for the specified attribute.MutableWhitelistConfiguration object.public boolean hasAllowedProtocols(String tagName)
hasAllowedProtocols in interface WhitelistConfigurationtagName - (non null) a valid HTML tag namepublic boolean hasAllowedProtocols(String tagName, String attrName)
hasAllowedProtocols in interface WhitelistConfigurationtagName - (non null) a valid HTML tag nameattrName - (non null) a valid HTML attribute namepublic MutableWhitelistConfiguration allowProtocol(String tagName, String attrName, String protocol)
Add an allowed protocol to the configuration
allowProtocol in interface MutableWhitelistConfigurationtagName - (non null) an HTML tag nameattrName - (non null) an HTML attribute nameprotocol - (non null) a protocol like 'https' or 'http'MutableWhitelistConfiguration object.public boolean allowsProtocol(String tagName, String attrName, String protocol)
allowsProtocol.
allowsProtocol in interface WhitelistConfigurationtagName - (non null) a valid HTML tag nameattrName - (non null) a valid HTML attribute nameprotocol - (non null) a protocol like 'https' or 'http'public MutableWhitelistConfiguration base(String base)
Sets the base whitelist to use when configuring a Whitelist, 'none' is the default value.
base in interface MutableWhitelistConfigurationbase - an instance of whitelist to use as the base whitelistMutableWhitelistConfiguration object.public org.jsoup.safety.Whitelist apply(org.jsoup.safety.Whitelist whitelist)
Applies all the configured rules to the supplied Whitelist instance.
apply in interface WhitelistConfigurationwhitelist - a Whitelist object.Whitelist instance.public org.jsoup.safety.Whitelist whitelist()
Constructs an empty Whitelist and applies the configured
rules to it.
whitelist in interface WhitelistConfigurationWhitelist object.Copyright © 2016. All rights reserved.