Examples of Cleaner


Examples of no.priv.garshol.duke.Cleaner

  public void addValue(Column col, String value) {
    if (value == null || value.equals(""))
      return;
   
    String prop = col.getProperty();
    Cleaner cleaner = col.getCleaner();
    if (col.isSplit()) {
      for (String v : col.split(value)) {
        if (cleaner != null)
          v = cleaner.clean(v);
        if (v != null && !v.equals(""))
          record.addValue(prop, v);
      }
    } else {
      if (cleaner != null)
        value = cleaner.clean(value);
      if (value != null && !value.equals(""))
        record.addValue(prop, value);
    }
  }
View Full Code Here

Examples of org.jsoup.safety.Cleaner

     @see Cleaner#clean(Document)
     */
    public static String clean(String bodyHtml, String baseUri, Whitelist whitelist) {
        Document dirty = parseBodyFragment(bodyHtml, baseUri);
        Cleaner cleaner = new Cleaner(whitelist);
        Document clean = cleaner.clean(dirty);
        return clean.body().html();
    }
View Full Code Here

Examples of org.jsoup.safety.Cleaner

     @return true if no tags or attributes were removed; false otherwise
     @see #clean(String, org.jsoup.safety.Whitelist)
     */
    public static boolean isValid(String bodyHtml, Whitelist whitelist) {
        Document dirty = parseBodyFragment(bodyHtml, "");
        Cleaner cleaner = new Cleaner(whitelist);
        return cleaner.isValid(dirty);
    }
View Full Code Here

Examples of org.jsoup.safety.Cleaner

   private final Cleaner none;

   private final Cleaner relaxed;

   public JSoupXssFilter() {
     none = new Cleaner(Whitelist.none());
     relaxed = new Cleaner(getRelaxedWhiteList());
  }
View Full Code Here

Examples of org.jsoup.safety.Cleaner

      whitelist.addTags(el.getTagName());
            if(!el.getAttributes().isEmpty()) {
                whitelist.addAttributes(el.getTagName(), el.getAttributes().toArray(new String[el.getAttributes().size()]));
            }
    }
    cleaner = new Cleaner(whitelist);

    if(options.getTables().isLeftAsHtml()) {
      // we need to allow the table nodes to be ignored
      // since they are automatically ignored recursively, this is the only node we worry about.
      options.getIgnoredHtmlElements().add(IgnoredHtmlElement.create("table"));
View Full Code Here

Examples of org.jsoup.safety.Cleaner

     @see Cleaner#clean(Document)
     */
    public static String clean(String bodyHtml, String baseUri, Whitelist whitelist) {
        Document dirty = parseBodyFragment(bodyHtml, baseUri);
        Cleaner cleaner = new Cleaner(whitelist);
        Document clean = cleaner.clean(dirty);
        return clean.body().html();
    }
View Full Code Here

Examples of org.jsoup.safety.Cleaner

     * @return safe HTML (body fragment)
     * @see Cleaner#clean(Document)
     */
    public static String clean(String bodyHtml, String baseUri, Whitelist whitelist, Document.OutputSettings outputSettings) {
        Document dirty = parseBodyFragment(bodyHtml, baseUri);
        Cleaner cleaner = new Cleaner(whitelist);
        Document clean = cleaner.clean(dirty);
        clean.outputSettings(outputSettings);
        return clean.body().html();
    }
View Full Code Here

Examples of org.jsoup.safety.Cleaner

     @return true if no tags or attributes were removed; false otherwise
     @see #clean(String, org.jsoup.safety.Whitelist)
     */
    public static boolean isValid(String bodyHtml, Whitelist whitelist) {
        Document dirty = parseBodyFragment(bodyHtml, "");
        Cleaner cleaner = new Cleaner(whitelist);
        return cleaner.isValid(dirty);
    }
View Full Code Here

Examples of org.jsoup.safety.Cleaner

  public static String handleContent(String content, String baseUri, boolean keepTextOnly) {
    if (StringUtils.isNotBlank(content)) {
      baseUri = StringUtils.trimToEmpty(baseUri);

      Document dirty = Jsoup.parseBodyFragment(content, baseUri);
      Cleaner cleaner = new Cleaner(WHITELIST);
      Document clean = cleaner.clean(dirty);

      for (Element e : clean.select("iframe[style]")) {
        String style = e.attr("style");
        String escaped = escapeIFrameCss(style);
        e.attr("style", escaped);
View Full Code Here

Examples of org.jsoup.safety.Cleaner

  public boolean isValid(CharSequence value, ConstraintValidatorContext context) {
    if ( value == null ) {
      return true;
    }

    return new Cleaner( whitelist ).isValid( getFragmentAsDocument( value ) );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.