Package org.owasp.html
Class HtmlChangeReporter<T>
- java.lang.Object
-
- org.owasp.html.HtmlChangeReporter<T>
-
- Type Parameters:
T
- The type of context value passed to the
public final class HtmlChangeReporter<T> extends Object
Sits between the HTML parser, the policy, and the renderer so that it can report dropped elements and attributes to anHtmlChangeListener
.HtmlChangeReporter<T> hcr = new HtmlChangeReporter<T>( renderer, htmlChangeListener, context); hcr.setPolicy(policyFactory.apply(hcr.getWrappedRenderer())); HtmlSanitizer.sanitize(html, hcr.getWrappedPolicy());
The renderer receives events from the policy unchanged, but the reporter notices differences between the events from the lexer and those from the policy.
-
-
Constructor Summary
Constructors Constructor Description HtmlChangeReporter(HtmlStreamEventReceiver renderer, HtmlChangeListener<? super T> listener, T context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HtmlSanitizer.Policy
getWrappedPolicy()
The underlying policy.HtmlStreamEventReceiver
getWrappedRenderer()
The underlying renderer.void
setPolicy(HtmlSanitizer.Policy policy)
Associates an input channel.
-
-
-
Constructor Detail
-
HtmlChangeReporter
public HtmlChangeReporter(HtmlStreamEventReceiver renderer, HtmlChangeListener<? super T> listener, @Nullable T context)
- Parameters:
context
- forwarded to listener along with any reports.
-
-
Method Detail
-
setPolicy
public void setPolicy(HtmlSanitizer.Policy policy)
Associates an input channel.this
receives events and forwards them to input.
-
getWrappedRenderer
public HtmlStreamEventReceiver getWrappedRenderer()
The underlying renderer.
-
getWrappedPolicy
public HtmlSanitizer.Policy getWrappedPolicy()
The underlying policy.
-
-