org.owasp.html
Class PolicyFactory

java.lang.Object
  extended by org.owasp.html.PolicyFactory
All Implemented Interfaces:
com.google.common.base.Function<HtmlStreamEventReceiver,HtmlSanitizer.Policy>

@ThreadSafe
@Immutable
public final class PolicyFactory
extends java.lang.Object
implements com.google.common.base.Function<HtmlStreamEventReceiver,HtmlSanitizer.Policy>

A factory that can be used to link a sanitizer to an output receiver and that provides a convenient sanitize method and a and method to compose policies.

Author:
Mike Samuel

Method Summary
 PolicyFactory and(PolicyFactory f)
          Produces a factory that allows the union of the grants, and intersects policies where they overlap on a particular granted attribute or element name.
 HtmlSanitizer.Policy apply(HtmlStreamEventReceiver out)
          Produces a sanitizer that emits tokens to out.
 java.lang.String sanitize(java.lang.String html)
          A convenience function that sanitizes a string of HTML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.common.base.Function
equals
 

Method Detail

apply

public HtmlSanitizer.Policy apply(HtmlStreamEventReceiver out)
Produces a sanitizer that emits tokens to out.

Specified by:
apply in interface com.google.common.base.Function<HtmlStreamEventReceiver,HtmlSanitizer.Policy>

sanitize

public java.lang.String sanitize(@Nullable
                                 java.lang.String html)
A convenience function that sanitizes a string of HTML.


and

public PolicyFactory and(PolicyFactory f)
Produces a factory that allows the union of the grants, and intersects policies where they overlap on a particular granted attribute or element name.



Copyright © 2012 OWASP. All Rights Reserved.