org.apache.shindig.gadgets
Class BasicGadgetBlacklist

java.lang.Object
  extended by org.apache.shindig.gadgets.BasicGadgetBlacklist
All Implemented Interfaces:
GadgetBlacklist

public class BasicGadgetBlacklist
extends Object
implements GadgetBlacklist

Basic implementation of a GadgetBlacklist, reading blacklist data from a text file. A single URL on a line blacklists this exact URL (case-insensitively). A regular expression prefixed by "REGEXP" and a space on a line blacklists all URL's that (case-insensitively) match that pattern. The regular expression syntax is PCRE-based (using java.util.regex, so there are a few insignificant differences). Regular expressions should be used sparingly as they influence performance of every single gadget being rendered. Lines starting with a "#" are comments. Example: # Block the illegal bar.xml gadget http://foo.com/bar.xml # Block all gadgets from the baz.com domain (including subdomains) REGEXP http://[^/]*baz.com/.*


Constructor Summary
BasicGadgetBlacklist(File blacklistFile)
          Constructs a new blacklist from the given file.
BasicGadgetBlacklist(String file)
           
 
Method Summary
 boolean isBlacklisted(Uri gadgetUri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicGadgetBlacklist

public BasicGadgetBlacklist(File blacklistFile)
                     throws IOException
Constructs a new blacklist from the given file.

Parameters:
blacklistFile - file containing blacklist entries
Throws:
IOException - if reading the file fails

BasicGadgetBlacklist

@Inject
public BasicGadgetBlacklist(String file)
                     throws IOException
Throws:
IOException
Method Detail

isBlacklisted

public boolean isBlacklisted(Uri gadgetUri)
Specified by:
isBlacklisted in interface GadgetBlacklist
Returns:
true if gadgetUri was found in this blacklist, false otherwise.


Copyright © 2007-2012. All Rights Reserved.