org.apache.shindig.gadgets
Class BasicGadgetBlacklist
java.lang.Object
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/.*
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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.