Class HTMLScriptService

  • All Implemented Interfaces:
    ScriptService

    @Unstable
    @Component
    @Named("html")
    @Singleton
    public class HTMLScriptService
    extends Object
    implements ScriptService
    Script service dedicated to perform operations on html scripts.
    Since:
    14.10.4, 15.0RC1
    Version:
    $Id: cbc6a1e1b1a8e7c7505e9454959bbcd5717763e5 $
    • Constructor Detail

      • HTMLScriptService

        public HTMLScriptService()
    • Method Detail

      • isElementSafe

        public boolean isElementSafe​(String elementName)
        Check if the given html element can be considered safe or not. The definition of safe is based on the implementation of the configured HTMLElementSanitizer. By default it should use SecureHTMLElementSanitizer which itself relies partly on the configuration of the wiki (see HTMLElementSanitizerConfiguration).
        Parameters:
        elementName - the name of the HTML element
        Returns:
        true if the given element is allowed in principle (given appropriate attributes)
      • isAttributeSafe

        public boolean isAttributeSafe​(String elementName,
                                       String attributeName,
                                       String value)
        Check if the attribute and its value can be considered safe or not. The definition of safe is based on the implementation of the configured HTMLElementSanitizer. By default it should use SecureHTMLElementSanitizer which itself relies partly on the configuration of the wiki (see HTMLElementSanitizerConfiguration).
        Parameters:
        elementName - the element for which the attributes shall be checked
        attributeName - the attributes to check
        value - the value of the attribute
        Returns:
        true if the attribute with this value is considered safe